axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r487191 - in /webservices/axis2/trunk/java/modules: adb-codegen/src/org/apache/axis2/schema/ adb-codegen/src/org/apache/axis2/schema/writer/ codegen/src/org/apache/axis2/wsdl/codegen/ codegen/src/org/apache/axis2/wsdl/codegen/extension/
Date Thu, 14 Dec 2006 12:36:49 GMT
Author: amilas
Date: Thu Dec 14 04:36:48 2006
New Revision: 487191

URL: http://svn.apache.org/viewvc?view=rev&rev=487191
Log:
add the ns2p support for codegen. refer issue AXIS2-1609

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java?view=diff&rev=487191&r1=487190&r2=487191
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
Thu Dec 14 04:36:48 2006
@@ -402,6 +402,7 @@
             }
         }
 
+
         // add the custom package name
         if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.PACKAGE)) {
             String packageName = (String) propertyMap.get(SchemaConstants.SchemaCompilerArguments.PACKAGE);
@@ -410,6 +411,9 @@
             }
 
         }
+
+        // set the package namespace to uri details
+        options.setNs2PackageMap(configuration.getUri2PackageNameMap());
 
         //add custom mapper package name
         if (propertyMap.containsKey(SchemaConstants.SchemaCompilerArguments.MAPPER_PACKAGE))
{

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=487191&r1=487190&r2=487191
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
Thu Dec 14 04:36:48 2006
@@ -231,7 +231,14 @@
                 if(nsp == null) {
                     nsp = URLProcessor.DEFAULT_PACKAGE;
                 }
-                writer.registerExtensionMapperPackageName(URLProcessor.makePackageName(nsp));
+
+                // if this name space exists in the ns2p list then we use it.
+                if ((options.getNs2PackageMap() != null)
+                        && (options.getNs2PackageMap().containsKey(nsp))){
+                    writer.registerExtensionMapperPackageName((String) options.getNs2PackageMap().get(nsp));
+                } else {
+                   writer.registerExtensionMapperPackageName(URLProcessor.makePackageName(nsp));
+                }
             }
             // second round - call the schema compiler one by one
             for (int i = 0; i < schemalist.size(); i++) {

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?view=diff&rev=487191&r1=487190&r2=487191
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
Thu Dec 14 04:36:48 2006
@@ -344,7 +344,7 @@
 
     private String getPackage(String namespaceURI) {
         String basePackageName;
-        if (ns2packageNameMap.containsKey(namespaceURI)) {
+        if ((ns2packageNameMap != null) && ns2packageNameMap.containsKey(namespaceURI))
{
             basePackageName = (String) ns2packageNameMap.get(namespaceURI);
         } else {
             basePackageName = URLProcessor.makePackageName(namespaceURI);

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?view=diff&rev=487191&r1=487190&r2=487191
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
Thu Dec 14 04:36:48 2006
@@ -448,12 +448,6 @@
 
     public void setAxisService(AxisService axisService) {
         this.axisService = axisService;
-        if (packageName == null || packageName.length() == 0 || URLProcessor.DEFAULT_PACKAGE.equals(packageName))
{
-            //use the target namespace from the axis service to form a package name
-            packageName = URLProcessor.makePackageName(
-                    axisService.getTargetNamespace()
-            );
-        }
     }
         
     	/**

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?view=diff&rev=487191&r1=487190&r2=487191
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
Thu Dec 14 04:36:48 2006
@@ -6,7 +6,9 @@
 # these are loaded in their lexical order
 # Note the last extension - It includes a check to figure out whether proper databinding
has taken place
 # This extension should appear AFTER all the databinding extensions inorder to function properly
-codegen.extension=org.apache.axis2.wsdl.codegen.extension.SchemaUnwrapperExtension,org.apache.axis2.wsdl.codegen.extension.JaxMeExtension,
\
+codegen.extension=org.apache.axis2.wsdl.codegen.extension.PackageFinder,\
+  org.apache.axis2.wsdl.codegen.extension.SchemaUnwrapperExtension,\
+  org.apache.axis2.wsdl.codegen.extension.JaxMeExtension, \
   org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension, \
   org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension, \
   org.apache.axis2.wsdl.codegen.extension.JiBXExtension, \

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java?view=diff&rev=487191&r1=487190&r2=487191
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PackageFinder.java
Thu Dec 14 04:36:48 2006
@@ -25,15 +25,24 @@
     public void engage(CodeGenConfiguration configuration) {
         String packageName = configuration.getPackageName();
         if (packageName == null || URLProcessor.DEFAULT_PACKAGE.equals(packageName)) {
-            //use the target namespace from the axis service to form a package
-            //name
-            packageName = URLProcessor.makePackageName(
-                    configuration.getAxisService().getTargetNamespace()
-            );
+
+            //use the target namespace from the axis service to form a package name
+            String targetNameSpace = configuration.getAxisService().getTargetNamespace();
+
+            // if this target name space exists in the ns2p then we have to get that package
+            if ((configuration.getUri2PackageNameMap() != null) &&
+                    configuration.getUri2PackageNameMap().containsKey(targetNameSpace.trim()))
{
+                packageName = (String) configuration.getUri2PackageNameMap().get(targetNameSpace);
+            } else {
+                // i.e. user have not given any ns2p information for this name space
+                packageName = URLProcessor.makePackageName(configuration.getAxisService().getTargetNamespace());
+            }
+
         }
 
-        if (null == packageName || "".equals(packageName))
+        if ((packageName == null) || "".equals(packageName)){
             packageName = URLProcessor.DEFAULT_PACKAGE;
+        }
 
         configuration.setPackageName(packageName.toLowerCase());
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message