You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2008/03/03 12:58:21 UTC

svn commit: r633048 - in /webservices/axis2/trunk/java/modules: java2wsdl/src/org/apache/ws/java2wsdl/ java2wsdl/src/org/apache/ws/java2wsdl/utils/ jaxbri/src/org/apache/axis2/jaxbri/ kernel/src/org/apache/axis2/description/java2wsdl/

Author: deepal
Date: Mon Mar  3 03:58:15 2008
New Revision: 633048

URL: http://svn.apache.org/viewvc?rev=633048&view=rev
Log:
added a way to give a custom schema when generating java2wsdl
 [http://jadeepal.blogspot.com/2008/03/java2wsdl-generation-with-custom-schema.html]

Modified:
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
    webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?rev=633048&r1=633047&r2=633048&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java Mon Mar  3 03:58:15 2008
@@ -74,6 +74,10 @@
     private String schemaGenClassName = null;
     private boolean generateDocLitBare = false;
     private AxisConfiguration axisConfig;
+    private String customScheamLocation;
+    // location of the class name to package mapping file
+    // File is simple file with qualifiedClassName:SchemaQName
+    private String mappingFileLocation;
 
     public Java2WSDLBuilder() {
         try {
@@ -208,6 +212,8 @@
         schemaGenerator.setExtraClasses(getExtraClasses());
         schemaGenerator.setNsGen(resolveNSGen());
         schemaGenerator.setPkg2nsmap(getPkg2nsMap());
+        schemaGenerator.setMappingFileLocation(mappingFileLocation);
+        schemaGenerator.setCustomScheamLocation(customScheamLocation);
         if (getPkg2nsMap() != null && !getPkg2nsMap().isEmpty() &&
             (getPkg2nsMap().containsKey(ALL) || getPkg2nsMap().containsKey(ALL.toUpperCase()))) {
             schemaGenerator.setUseWSDLTypesNamespace(true);
@@ -382,6 +388,23 @@
 
     public void setWSDLVersion(String wsdlVersion) {
         this.wsdlVersion = wsdlVersion;
+    }
+
+
+    public String getCustomScheamLocation() {
+        return customScheamLocation;
+    }
+
+    public void setCustomScheamLocation(String customScheamLocation) {
+        this.customScheamLocation = customScheamLocation;
+    }
+
+    public String getMappingFileLocation() {
+        return mappingFileLocation;
+    }
+
+    public void setMappingFileLocation(String mappingFileLocation) {
+        this.mappingFileLocation = mappingFileLocation;
     }
 }
 

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java?rev=633048&r1=633047&r2=633048&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java Mon Mar  3 03:58:15 2008
@@ -223,6 +223,19 @@
         if (option != null) {
             java2WsdlBuilder.setGenerateDocLitBare(true);
         }
+
+        option = loadOption(Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION,
+                           Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION_LONG,
+                           optionsMap);
+        if (option != null) {
+            java2WsdlBuilder.setCustomScheamLocation(option.getOptionValue());
+        }
+        option = loadOption(Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION,
+                           Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION_LONG,
+                           optionsMap);
+        if (option != null) {
+            java2WsdlBuilder.setMappingFileLocation(option.getOptionValue());
+        }
     }
     
     private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption, Map options) {

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java?rev=633048&r1=633047&r2=633048&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java Mon Mar  3 03:58:15 2008
@@ -65,10 +65,12 @@
                 Java2WSDLConstants.USE_OPTION.equalsIgnoreCase(optionType) ||
                 Java2WSDLConstants.USE_OPTION_LONG.equalsIgnoreCase(optionType)||
                 Java2WSDLConstants.WSDL_VERSION_OPTION.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION_LONG.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION_LONG.equalsIgnoreCase(optionType)||
                 Java2WSDLConstants.WSDL_VERSION_OPTION_LONG.equalsIgnoreCase(optionType)
         );
-
-
         return invalid;
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java Mon Mar  3 03:58:15 2008
@@ -19,12 +19,15 @@
 package org.apache.axis2.jaxbri;
 
 import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
+import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.util.Loader;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+import org.codehaus.jam.JMethod;
+import org.codehaus.jam.JClass;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -125,6 +128,7 @@
 
         return itr.next();
     }
+
 
     protected List<Class<?>> processMethods(Method[] declaredMethods) throws Exception {
         List<Class<?>> list = new ArrayList<Class<?>>();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Mon Mar  3 03:58:15 2008
@@ -33,9 +33,14 @@
 import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.apache.ws.commons.schema.utils.NamespacePrefixList;
 import org.codehaus.jam.*;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
 
 import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import java.util.*;
+import java.io.*;
 
 public class DefaultSchemaGenerator implements Java2WSDLConstants, SchemaGenerator {
 
@@ -88,6 +93,11 @@
 
     protected Class serviceClass = null;
     protected AxisService service;
+    // location of the custom schema , if any
+    protected String customScheamLocation;
+    // location of the class name to package mapping file
+    // File is simple file with qualifiedClassName:SchemaQName
+    protected String mappingFileLocation;
 
     //To check whether we need to generate Schema element for Exception
     protected boolean generateBaseException ;
@@ -135,6 +145,57 @@
         }
     }
 
+    //This will locad the custom scheam file and add that into the scheam map
+    private void loadCustomSchemaFile(){
+      if (customScheamLocation != null) {
+          try {
+              DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+              documentBuilderFactory.setNamespaceAware(true);
+              Document doc = documentBuilderFactory.newDocumentBuilder().parse(new File(customScheamLocation));
+              XmlSchema schema = xmlSchemaCollection.read(doc,null);
+              schemaMap.put(schema.getTargetNamespace() ,schema);
+          } catch (Exception e) {
+              log.info(e.getMessage());
+          }
+      }
+    }
+
+    /**This will load the mapping file and update the Typetable with the Class name and the Qname
+     * Mapping file look like
+     * org.foo.bar.FooException|http://www.abc.com/soaframework/common/types|ErrorMessage
+     */
+    private void loadMappingFile(){
+        if(mappingFileLocation != null){
+            File file = new File(mappingFileLocation);
+            BufferedReader input = null;
+        try {
+            input = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
+            String line;
+            while ((line = input.readLine()) != null) {
+                line = line.trim();
+                if (line.length() > 0 && line.charAt(0)!='#') {
+                    String values [] = line.split("\\|");
+                    if (values != null && values.length >2) {
+                        typeTable.addComplexSchema(values[0],new QName(values[1] , values[2]));
+                    }
+                }
+            }
+        } catch (IOException ex) {
+            ex.printStackTrace();
+        } finally {
+            try {
+                if (input != null) {
+                    input.close();
+                }
+            }
+            catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        }
+    }
+
+
     /**
      * Generates schema for all the parameters in method. First generates schema for all different
      * parameter type and later refers to them.
@@ -143,7 +204,8 @@
      * @throws Exception
      */
     public Collection generateSchema() throws Exception {
-
+        loadCustomSchemaFile();
+        loadMappingFile();
         JamServiceFactory factory = JamServiceFactory.getInstance();
         JamServiceParams jam_service_parms = factory.createServiceParams();
         //setting the classLoder
@@ -1012,5 +1074,22 @@
 
     public void setAxisService(AxisService service) {
         this.service = service;
+    }
+
+
+    public String getCustomScheamLocation() {
+        return customScheamLocation;
+    }
+
+    public void setCustomScheamLocation(String customScheamLocation) {
+        this.customScheamLocation = customScheamLocation;
+    }
+
+    public String getMappingFileLocation() {
+        return mappingFileLocation;
+    }
+
+    public void setMappingFileLocation(String mappingFileLocation) {
+        this.mappingFileLocation = mappingFileLocation;
     }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java?rev=633048&r1=633047&r2=633048&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java Mon Mar  3 03:58:15 2008
@@ -132,7 +132,11 @@
     String USE_OPTION_LONG = "use";
     String WSDL_VERSION_OPTION = "wv";
     String WSDL_VERSION_OPTION_LONG = "wsdl-version";
-    
+    String CUSTOM_SCHEMA_LOCATION = "csl";
+    String CUSTOM_SCHEMA_LOCATION_LONG = "custom-schema-location";
+    String SCHEMA_MAPPING_FILE_LOCATION = "mfl";
+    String SCHEMA_MAPPING_FILE_LOCATION_LONG = "mapping-file-location";
+
     String AXIS2_NAMESPACE_PREFIX = "ns1";
 
     public static final String SOLE_INPUT = "SOLE_INPUT";

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java Mon Mar  3 03:58:15 2008
@@ -54,4 +54,13 @@
     void setNonRpcMethods(ArrayList nonRpcMethods);
 
     void setAxisService(AxisService service);
+
+    String getCustomScheamLocation();
+
+
+    void setCustomScheamLocation(String customScheamLocation);
+
+    String getMappingFileLocation() ;
+
+    void setMappingFileLocation(String mappingFileLocation) ;
 }



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


Re: [Axis2] Re: svn commit: r633048 - in /webservices/axis2/trunk/java/modules: java2wsdl/src/org/apache/ws/java2wsdl/ java2wsdl/src/org/apache/ws/java2wsdl/utils/ jaxbri/src/org/apache/axis2/jaxbri/ kernel/src/org/apache/axis2/description/java2wsdl/

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Thank you Dims

-Deepal
> Tom,
>
> Thanks! Fixed in svn revision 
> http://svn.apache.org/viewvc?rev=633302&view=rev
>
> -- dims
>
> Tom Seelbach wrote:
> | Deepal,
> | I'm able to compile and run the tests successfully without these 3
> | imports.  Are they really needed?
> |
> | 



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


Re: [Axis2] Re: svn commit: r633048 - in /webservices/axis2/trunk/java/modules: java2wsdl/src/org/apache/ws/java2wsdl/ java2wsdl/src/org/apache/ws/java2wsdl/utils/ jaxbri/src/org/apache/axis2/jaxbri/ kernel/src/org/apache/axis2/description/java2wsdl/

Posted by Davanum Srinivas <da...@gmail.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tom,

Thanks! Fixed in svn revision http://svn.apache.org/viewvc?rev=633302&view=rev

- -- dims

Tom Seelbach wrote:
| Deepal,
| I'm able to compile and run the tests successfully without these 3
| imports.  Are they really needed?
|
| Modified:
| webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
|
| URL:
|
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff

|
|
| +import org.apache.axis2.description.AxisOperation; ...
| +import org.codehaus.jam.JMethod;
| +import org.codehaus.jam.JClass;
|
|
| Also, (sp) shouldn't customScheamLocation be customSchemaLocation
| (several occurrences)?
|
| thanks,
| Tom
|
|
| deepal@apache.org wrote:
|> Author: deepal
|> Date: Mon Mar  3 03:58:15 2008
|> New Revision: 633048
|>
|> URL: http://svn.apache.org/viewvc?rev=633048&view=rev
|> Log:
|> added a way to give a custom schema when generating java2wsdl
|>  [http://jadeepal.blogspot.com/2008/03/java2wsdl-generation-with-custom-schema.html]
|>
|>
|> Modified:
|>
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
|>
|>
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
|>
|>
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
|>
|>
|> webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
|>
|>
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
|>
|>
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
|>
|>
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
|>
|>
|> Modified:
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
|>
|> URL:
|>
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?rev=633048&r1=633047&r2=633048&view=diff

|>
|> ==============================================================================
|>
|> ---
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
|> (original)
|> +++
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
|> Mon Mar  3 03:58:15 2008
|> @@ -74,6 +74,10 @@
|>      private String schemaGenClassName = null;
|>      private boolean generateDocLitBare = false;
|>      private AxisConfiguration axisConfig;
|> +    private String customScheamLocation;
|>
|
|
|> +    // location of the class name to package mapping file
|> +    // File is simple file with qualifiedClassName:SchemaQName
|> +    private String mappingFileLocation;
|>
|>      public Java2WSDLBuilder() {
|>          try {
|> @@ -208,6 +212,8 @@
|>          schemaGenerator.setExtraClasses(getExtraClasses());
|>          schemaGenerator.setNsGen(resolveNSGen());
|>          schemaGenerator.setPkg2nsmap(getPkg2nsMap());
|> +        schemaGenerator.setMappingFileLocation(mappingFileLocation);
|> +        schemaGenerator.setCustomScheamLocation(customScheamLocation);
|>          if (getPkg2nsMap() != null && !getPkg2nsMap().isEmpty() &&
|>              (getPkg2nsMap().containsKey(ALL) ||
|> getPkg2nsMap().containsKey(ALL.toUpperCase()))) {
|>              schemaGenerator.setUseWSDLTypesNamespace(true);
|> @@ -382,6 +388,23 @@
|>
|>      public void setWSDLVersion(String wsdlVersion) {
|>          this.wsdlVersion = wsdlVersion;
|> +    }
|> +
|> +
|> +    public String getCustomScheamLocation() {
|> +        return customScheamLocation;
|> +    }
|> +
|> +    public void setCustomScheamLocation(String customScheamLocation) {
|> +        this.customScheamLocation = customScheamLocation;
|> +    }
|> +
|> +    public String getMappingFileLocation() {
|> +        return mappingFileLocation;
|> +    }
|> +
|> +    public void setMappingFileLocation(String mappingFileLocation) {
|> +        this.mappingFileLocation = mappingFileLocation;
|>      }
|>  }
|>
|>
|> Modified:
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
|>
|> URL:
|>
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java?rev=633048&r1=633047&r2=633048&view=diff

|>
|> ==============================================================================
|>
|> ---
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
|> (original)
|> +++
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
|> Mon Mar  3 03:58:15 2008
|> @@ -223,6 +223,19 @@
|>          if (option != null) {
|>              java2WsdlBuilder.setGenerateDocLitBare(true);
|>          }
|> +
|> +        option = loadOption(Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION,
|> +
|> Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION_LONG,
|> +                           optionsMap);
|> +        if (option != null) {
|> +
|> java2WsdlBuilder.setCustomScheamLocation(option.getOptionValue());
|> +        }
|> +        option =
|> loadOption(Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION,
|> +
|> Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION_LONG,
|> +                           optionsMap);
|> +        if (option != null) {
|> +
|> java2WsdlBuilder.setMappingFileLocation(option.getOptionValue());
|> +        }
|>      }
|>           private Java2WSDLCommandLineOption loadOption(String
|> shortOption, String longOption, Map options) {
|>
|> Modified:
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
|>
|> URL:
|>
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java?rev=633048&r1=633047&r2=633048&view=diff

|>
|> ==============================================================================
|>
|> ---
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
|> (original)
|> +++
|> webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
|> Mon Mar  3 03:58:15 2008
|> @@ -65,10 +65,12 @@
|>
|> Java2WSDLConstants.USE_OPTION.equalsIgnoreCase(optionType) ||
|>
|> Java2WSDLConstants.USE_OPTION_LONG.equalsIgnoreCase(optionType)||
|>
|> Java2WSDLConstants.WSDL_VERSION_OPTION.equalsIgnoreCase(optionType)||
|> +
|> Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION.equalsIgnoreCase(optionType)||
|> +
|> Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION_LONG.equalsIgnoreCase(optionType)||
|>
|> +
|> Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION.equalsIgnoreCase(optionType)||
|>
|> +
|> Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION_LONG.equalsIgnoreCase(optionType)||
|>
|>
|> Java2WSDLConstants.WSDL_VERSION_OPTION_LONG.equalsIgnoreCase(optionType)
|>          );
|> -
|> -
|>          return invalid;
|>      }
|>  }
|>
|> Modified:
|> webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
|>
|> URL:
|>
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff

|>
|> ==============================================================================
|>
|> ---
|> webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
|> (original)
|> +++
|> webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
|> Mon Mar  3 03:58:15 2008
|> @@ -19,12 +19,15 @@
|>  package org.apache.axis2.jaxbri;
|>
|>  import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
|> +import org.apache.axis2.description.AxisOperation;
|>  import org.apache.axis2.util.Loader;
|>  import org.apache.ws.commons.schema.XmlSchema;
|>  import org.w3c.dom.Document;
|>  import org.w3c.dom.Element;
|>  import org.w3c.dom.Node;
|>  import org.w3c.dom.NodeList;
|> +import org.codehaus.jam.JMethod;
|> +import org.codehaus.jam.JClass;
|>
|>  import javax.xml.bind.JAXBContext;
|>  import javax.xml.bind.JAXBException;
|> @@ -125,6 +128,7 @@
|>
|>          return itr.next();
|>      }
|> +
|>
|>      protected List<Class<?>> processMethods(Method[] declaredMethods)
|> throws Exception {
|>          List<Class<?>> list = new ArrayList<Class<?>>();
|>
|> Modified:
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
|>
|> URL:
|>
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff

|>
|> ==============================================================================
|>
|> ---
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
|> (original)
|> +++
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
|> Mon Mar  3 03:58:15 2008
|> @@ -33,9 +33,14 @@
|>  import org.apache.ws.commons.schema.utils.NamespaceMap;
|>  import org.apache.ws.commons.schema.utils.NamespacePrefixList;
|>  import org.codehaus.jam.*;
|> +import org.w3c.dom.Document;
|> +import org.xml.sax.SAXException;
|>
|>  import javax.xml.namespace.QName;
|> +import javax.xml.parsers.DocumentBuilderFactory;
|> +import javax.xml.parsers.ParserConfigurationException;
|>  import java.util.*;
|> +import java.io.*;
|>
|>  public class DefaultSchemaGenerator implements Java2WSDLConstants,
|> SchemaGenerator {
|>
|> @@ -88,6 +93,11 @@
|>
|>      protected Class serviceClass = null;
|>      protected AxisService service;
|> +    // location of the custom schema , if any
|> +    protected String customScheamLocation;
|> +    // location of the class name to package mapping file
|> +    // File is simple file with qualifiedClassName:SchemaQName
|> +    protected String mappingFileLocation;
|>
|>      //To check whether we need to generate Schema element for Exception
|>      protected boolean generateBaseException ;
|> @@ -135,6 +145,57 @@
|>          }
|>      }
|>
|> +    //This will locad the custom scheam file and add that into the
|> scheam map
|> +    private void loadCustomSchemaFile(){
|> +      if (customScheamLocation != null) {
|> +          try {
|> +              DocumentBuilderFactory documentBuilderFactory =
|> DocumentBuilderFactory.newInstance();
|> +              documentBuilderFactory.setNamespaceAware(true);
|> +              Document doc =
|> documentBuilderFactory.newDocumentBuilder().parse(new
|> File(customScheamLocation));
|> +              XmlSchema schema = xmlSchemaCollection.read(doc,null);
|> +              schemaMap.put(schema.getTargetNamespace() ,schema);
|> +          } catch (Exception e) {
|> +              log.info(e.getMessage());
|> +          }
|> +      }
|> +    }
|> +
|> +    /**This will load the mapping file and update the Typetable with
|> the Class name and the Qname
|> +     * Mapping file look like
|> +     *
|> org.foo.bar.FooException|http://www.abc.com/soaframework/common/types|ErrorMessage
|>
|> +     */
|> +    private void loadMappingFile(){
|> +        if(mappingFileLocation != null){
|> +            File file = new File(mappingFileLocation);
|> +            BufferedReader input = null;
|> +        try {
|> +            input = new BufferedReader(new InputStreamReader(new
|> FileInputStream(file)));
|> +            String line;
|> +            while ((line = input.readLine()) != null) {
|> +                line = line.trim();
|> +                if (line.length() > 0 && line.charAt(0)!='#') {
|> +                    String values [] = line.split("\\|");
|> +                    if (values != null && values.length >2) {
|> +                        typeTable.addComplexSchema(values[0],new
|> QName(values[1] , values[2]));
|> +                    }
|> +                }
|> +            }
|> +        } catch (IOException ex) {
|> +            ex.printStackTrace();
|> +        } finally {
|> +            try {
|> +                if (input != null) {
|> +                    input.close();
|> +                }
|> +            }
|> +            catch (IOException ex) {
|> +                ex.printStackTrace();
|> +            }
|> +        }
|> +        }
|> +    }
|> +
|> +
|>      /**
|>       * Generates schema for all the parameters in method. First
|> generates schema for all different
|>       * parameter type and later refers to them.
|> @@ -143,7 +204,8 @@
|>       * @throws Exception
|>       */
|>      public Collection generateSchema() throws Exception {
|> -
|> +        loadCustomSchemaFile();
|> +        loadMappingFile();
|>          JamServiceFactory factory = JamServiceFactory.getInstance();
|>          JamServiceParams jam_service_parms =
|> factory.createServiceParams();
|>          //setting the classLoder
|> @@ -1012,5 +1074,22 @@
|>
|>      public void setAxisService(AxisService service) {
|>          this.service = service;
|> +    }
|> +
|> +
|> +    public String getCustomScheamLocation() {
|> +        return customScheamLocation;
|> +    }
|> +
|> +    public void setCustomScheamLocation(String customScheamLocation) {
|> +        this.customScheamLocation = customScheamLocation;
|> +    }
|> +
|> +    public String getMappingFileLocation() {
|> +        return mappingFileLocation;
|> +    }
|> +
|> +    public void setMappingFileLocation(String mappingFileLocation) {
|> +        this.mappingFileLocation = mappingFileLocation;
|>      }
|>  }
|>
|> Modified:
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
|>
|> URL:
|>
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java?rev=633048&r1=633047&r2=633048&view=diff

|>
|> ==============================================================================
|>
|> ---
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
|> (original)
|> +++
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
|> Mon Mar  3 03:58:15 2008
|> @@ -132,7 +132,11 @@
|>      String USE_OPTION_LONG = "use";
|>      String WSDL_VERSION_OPTION = "wv";
|>      String WSDL_VERSION_OPTION_LONG = "wsdl-version";
|> -    +    String CUSTOM_SCHEMA_LOCATION = "csl";
|> +    String CUSTOM_SCHEMA_LOCATION_LONG = "custom-schema-location";
|> +    String SCHEMA_MAPPING_FILE_LOCATION = "mfl";
|> +    String SCHEMA_MAPPING_FILE_LOCATION_LONG = "mapping-file-location";
|> +
|>      String AXIS2_NAMESPACE_PREFIX = "ns1";
|>
|>      public static final String SOLE_INPUT = "SOLE_INPUT";
|>
|> Modified:
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
|>
|> URL:
|>
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff

|>
|> ==============================================================================
|>
|> ---
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
|> (original)
|> +++
|> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
|> Mon Mar  3 03:58:15 2008
|> @@ -54,4 +54,13 @@
|>      void setNonRpcMethods(ArrayList nonRpcMethods);
|>
|>      void setAxisService(AxisService service);
|> +
|> +    String getCustomScheamLocation();
|> +
|> +
|> +    void setCustomScheamLocation(String customScheamLocation);
|> +
|> +    String getMappingFileLocation() ;
|> +
|> +    void setMappingFileLocation(String mappingFileLocation) ;
|>  }
|>
|>
|>
|> ---------------------------------------------------------------------
|> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
|> For additional commands, e-mail: axis-cvs-help@ws.apache.org
|>
|>
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
| For additional commands, e-mail: axis-dev-help@ws.apache.org
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iD8DBQFHzHnigNg6eWEDv1kRAr04AJ9viedztyWuID3lNfVGjDLPPPjwaQCeONTm
lUPsvFoMWYeZ5TZeMo5amB4=
=Jsp9
-----END PGP SIGNATURE-----

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


[Axis2] Re: svn commit: r633048 - in /webservices/axis2/trunk/java/modules: java2wsdl/src/org/apache/ws/java2wsdl/ java2wsdl/src/org/apache/ws/java2wsdl/utils/ jaxbri/src/org/apache/axis2/jaxbri/ kernel/src/org/apache/axis2/description/java2wsdl/

Posted by Tom Seelbach <to...@gmail.com>.
Deepal,
I'm able to compile and run the tests successfully without these 3 
imports.  Are they really needed?

Modified: webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff

+import org.apache.axis2.description.AxisOperation; 
 ...
+import org.codehaus.jam.JMethod;
+import org.codehaus.jam.JClass;


Also, (sp) shouldn't customScheamLocation be customSchemaLocation (several occurrences)?

thanks,
Tom


deepal@apache.org wrote:
> Author: deepal
> Date: Mon Mar  3 03:58:15 2008
> New Revision: 633048
>
> URL: http://svn.apache.org/viewvc?rev=633048&view=rev
> Log:
> added a way to give a custom schema when generating java2wsdl
>  [http://jadeepal.blogspot.com/2008/03/java2wsdl-generation-with-custom-schema.html]
>
> Modified:
>     webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
>     webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
>     webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
>     webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
>
> Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?rev=633048&r1=633047&r2=633048&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java (original)
> +++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java Mon Mar  3 03:58:15 2008
> @@ -74,6 +74,10 @@
>      private String schemaGenClassName = null;
>      private boolean generateDocLitBare = false;
>      private AxisConfiguration axisConfig;
> +    private String customScheamLocation;
>   


> +    // location of the class name to package mapping file
> +    // File is simple file with qualifiedClassName:SchemaQName
> +    private String mappingFileLocation;
>  
>      public Java2WSDLBuilder() {
>          try {
> @@ -208,6 +212,8 @@
>          schemaGenerator.setExtraClasses(getExtraClasses());
>          schemaGenerator.setNsGen(resolveNSGen());
>          schemaGenerator.setPkg2nsmap(getPkg2nsMap());
> +        schemaGenerator.setMappingFileLocation(mappingFileLocation);
> +        schemaGenerator.setCustomScheamLocation(customScheamLocation);
>          if (getPkg2nsMap() != null && !getPkg2nsMap().isEmpty() &&
>              (getPkg2nsMap().containsKey(ALL) || getPkg2nsMap().containsKey(ALL.toUpperCase()))) {
>              schemaGenerator.setUseWSDLTypesNamespace(true);
> @@ -382,6 +388,23 @@
>  
>      public void setWSDLVersion(String wsdlVersion) {
>          this.wsdlVersion = wsdlVersion;
> +    }
> +
> +
> +    public String getCustomScheamLocation() {
> +        return customScheamLocation;
> +    }
> +
> +    public void setCustomScheamLocation(String customScheamLocation) {
> +        this.customScheamLocation = customScheamLocation;
> +    }
> +
> +    public String getMappingFileLocation() {
> +        return mappingFileLocation;
> +    }
> +
> +    public void setMappingFileLocation(String mappingFileLocation) {
> +        this.mappingFileLocation = mappingFileLocation;
>      }
>  }
>  
>
> Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java?rev=633048&r1=633047&r2=633048&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java (original)
> +++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java Mon Mar  3 03:58:15 2008
> @@ -223,6 +223,19 @@
>          if (option != null) {
>              java2WsdlBuilder.setGenerateDocLitBare(true);
>          }
> +
> +        option = loadOption(Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION,
> +                           Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION_LONG,
> +                           optionsMap);
> +        if (option != null) {
> +            java2WsdlBuilder.setCustomScheamLocation(option.getOptionValue());
> +        }
> +        option = loadOption(Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION,
> +                           Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION_LONG,
> +                           optionsMap);
> +        if (option != null) {
> +            java2WsdlBuilder.setMappingFileLocation(option.getOptionValue());
> +        }
>      }
>      
>      private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption, Map options) {
>
> Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java?rev=633048&r1=633047&r2=633048&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java (original)
> +++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java Mon Mar  3 03:58:15 2008
> @@ -65,10 +65,12 @@
>                  Java2WSDLConstants.USE_OPTION.equalsIgnoreCase(optionType) ||
>                  Java2WSDLConstants.USE_OPTION_LONG.equalsIgnoreCase(optionType)||
>                  Java2WSDLConstants.WSDL_VERSION_OPTION.equalsIgnoreCase(optionType)||
> +                Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION.equalsIgnoreCase(optionType)||
> +                Java2WSDLConstants.CUSTOM_SCHEMA_LOCATION_LONG.equalsIgnoreCase(optionType)||
> +                Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION.equalsIgnoreCase(optionType)||
> +                Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION_LONG.equalsIgnoreCase(optionType)||
>                  Java2WSDLConstants.WSDL_VERSION_OPTION_LONG.equalsIgnoreCase(optionType)
>          );
> -
> -
>          return invalid;
>      }
>  }
>
> Modified: webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java (original)
> +++ webservices/axis2/trunk/java/modules/jaxbri/src/org/apache/axis2/jaxbri/JaxbSchemaGenerator.java Mon Mar  3 03:58:15 2008
> @@ -19,12 +19,15 @@
>  package org.apache.axis2.jaxbri;
>  
>  import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
> +import org.apache.axis2.description.AxisOperation;
>  import org.apache.axis2.util.Loader;
>  import org.apache.ws.commons.schema.XmlSchema;
>  import org.w3c.dom.Document;
>  import org.w3c.dom.Element;
>  import org.w3c.dom.Node;
>  import org.w3c.dom.NodeList;
> +import org.codehaus.jam.JMethod;
> +import org.codehaus.jam.JClass;
>  
>  import javax.xml.bind.JAXBContext;
>  import javax.xml.bind.JAXBException;
> @@ -125,6 +128,7 @@
>  
>          return itr.next();
>      }
> +
>  
>      protected List<Class<?>> processMethods(Method[] declaredMethods) throws Exception {
>          List<Class<?>> list = new ArrayList<Class<?>>();
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Mon Mar  3 03:58:15 2008
> @@ -33,9 +33,14 @@
>  import org.apache.ws.commons.schema.utils.NamespaceMap;
>  import org.apache.ws.commons.schema.utils.NamespacePrefixList;
>  import org.codehaus.jam.*;
> +import org.w3c.dom.Document;
> +import org.xml.sax.SAXException;
>  
>  import javax.xml.namespace.QName;
> +import javax.xml.parsers.DocumentBuilderFactory;
> +import javax.xml.parsers.ParserConfigurationException;
>  import java.util.*;
> +import java.io.*;
>  
>  public class DefaultSchemaGenerator implements Java2WSDLConstants, SchemaGenerator {
>  
> @@ -88,6 +93,11 @@
>  
>      protected Class serviceClass = null;
>      protected AxisService service;
> +    // location of the custom schema , if any
> +    protected String customScheamLocation;
> +    // location of the class name to package mapping file
> +    // File is simple file with qualifiedClassName:SchemaQName
> +    protected String mappingFileLocation;
>  
>      //To check whether we need to generate Schema element for Exception
>      protected boolean generateBaseException ;
> @@ -135,6 +145,57 @@
>          }
>      }
>  
> +    //This will locad the custom scheam file and add that into the scheam map
> +    private void loadCustomSchemaFile(){
> +      if (customScheamLocation != null) {
> +          try {
> +              DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
> +              documentBuilderFactory.setNamespaceAware(true);
> +              Document doc = documentBuilderFactory.newDocumentBuilder().parse(new File(customScheamLocation));
> +              XmlSchema schema = xmlSchemaCollection.read(doc,null);
> +              schemaMap.put(schema.getTargetNamespace() ,schema);
> +          } catch (Exception e) {
> +              log.info(e.getMessage());
> +          }
> +      }
> +    }
> +
> +    /**This will load the mapping file and update the Typetable with the Class name and the Qname
> +     * Mapping file look like
> +     * org.foo.bar.FooException|http://www.abc.com/soaframework/common/types|ErrorMessage
> +     */
> +    private void loadMappingFile(){
> +        if(mappingFileLocation != null){
> +            File file = new File(mappingFileLocation);
> +            BufferedReader input = null;
> +        try {
> +            input = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
> +            String line;
> +            while ((line = input.readLine()) != null) {
> +                line = line.trim();
> +                if (line.length() > 0 && line.charAt(0)!='#') {
> +                    String values [] = line.split("\\|");
> +                    if (values != null && values.length >2) {
> +                        typeTable.addComplexSchema(values[0],new QName(values[1] , values[2]));
> +                    }
> +                }
> +            }
> +        } catch (IOException ex) {
> +            ex.printStackTrace();
> +        } finally {
> +            try {
> +                if (input != null) {
> +                    input.close();
> +                }
> +            }
> +            catch (IOException ex) {
> +                ex.printStackTrace();
> +            }
> +        }
> +        }
> +    }
> +
> +
>      /**
>       * Generates schema for all the parameters in method. First generates schema for all different
>       * parameter type and later refers to them.
> @@ -143,7 +204,8 @@
>       * @throws Exception
>       */
>      public Collection generateSchema() throws Exception {
> -
> +        loadCustomSchemaFile();
> +        loadMappingFile();
>          JamServiceFactory factory = JamServiceFactory.getInstance();
>          JamServiceParams jam_service_parms = factory.createServiceParams();
>          //setting the classLoder
> @@ -1012,5 +1074,22 @@
>  
>      public void setAxisService(AxisService service) {
>          this.service = service;
> +    }
> +
> +
> +    public String getCustomScheamLocation() {
> +        return customScheamLocation;
> +    }
> +
> +    public void setCustomScheamLocation(String customScheamLocation) {
> +        this.customScheamLocation = customScheamLocation;
> +    }
> +
> +    public String getMappingFileLocation() {
> +        return mappingFileLocation;
> +    }
> +
> +    public void setMappingFileLocation(String mappingFileLocation) {
> +        this.mappingFileLocation = mappingFileLocation;
>      }
>  }
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java?rev=633048&r1=633047&r2=633048&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java Mon Mar  3 03:58:15 2008
> @@ -132,7 +132,11 @@
>      String USE_OPTION_LONG = "use";
>      String WSDL_VERSION_OPTION = "wv";
>      String WSDL_VERSION_OPTION_LONG = "wsdl-version";
> -    
> +    String CUSTOM_SCHEMA_LOCATION = "csl";
> +    String CUSTOM_SCHEMA_LOCATION_LONG = "custom-schema-location";
> +    String SCHEMA_MAPPING_FILE_LOCATION = "mfl";
> +    String SCHEMA_MAPPING_FILE_LOCATION_LONG = "mapping-file-location";
> +
>      String AXIS2_NAMESPACE_PREFIX = "ns1";
>  
>      public static final String SOLE_INPUT = "SOLE_INPUT";
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java?rev=633048&r1=633047&r2=633048&view=diff
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java Mon Mar  3 03:58:15 2008
> @@ -54,4 +54,13 @@
>      void setNonRpcMethods(ArrayList nonRpcMethods);
>  
>      void setAxisService(AxisService service);
> +
> +    String getCustomScheamLocation();
> +
> +
> +    void setCustomScheamLocation(String customScheamLocation);
> +
> +    String getMappingFileLocation() ;
> +
> +    void setMappingFileLocation(String mappingFileLocation) ;
>  }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>
>   


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