axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r635458 - in /webservices/axis2/trunk/java/modules: java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
Date Mon, 10 Mar 2008 07:40:14 GMT
Author: deepal
Date: Mon Mar 10 00:40:13 2008
New Revision: 635458

URL: http://svn.apache.org/viewvc?rev=635458&view=rev
Log:
fixing some of the issues with custom schema feeding and Exception generation 

Modified:
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.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=635458&r1=635457&r2=635458&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 10 00:40:13 2008
@@ -213,7 +213,9 @@
 		schemaGenerator.setExtraClasses(getExtraClasses());
 		schemaGenerator.setNsGen(resolveNSGen());
 		schemaGenerator.setPkg2nsmap(getPkg2nsMap());
-		if (getPkg2nsMap() != null
+        schemaGenerator.setMappingFileLocation(getMappingFileLocation());
+        schemaGenerator.setCustomSchemaLocation(getCustomSchemaLocation());
+        if (getPkg2nsMap() != null
 				&& !getPkg2nsMap().isEmpty()
 				&& (getPkg2nsMap().containsKey(ALL) || getPkg2nsMap()
 						.containsKey(ALL.toUpperCase()))) {

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=635458&r1=635457&r2=635458&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 10 00:40:13 2008
@@ -392,28 +392,32 @@
      *  - No matter what it will generate Schema element for java.lang.Exception so that
for other
      *    exception which extend java.lang.Excetion can use as the base class type
      */
-    protected void processException(JMethod jMethod, 
-                                                 AxisOperation axisOperation) throws Exception
{
+    protected void processException(JMethod jMethod,
+                                    AxisOperation axisOperation) throws Exception {
         XmlSchemaComplexType methodSchemaType;
         XmlSchemaSequence sequence;
         if (jMethod.getExceptionTypes().length > 0) {
             if (!generateBaseException) {
-                sequence = new XmlSchemaSequence();
-                XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace);
-                QName elementName = new QName(schemaTargetNameSpace,
-                        "Exception",
-                        schema_namespace_prefix);
-                XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
-                complexType.setName("Exception");
-                xmlSchema.getItems().add(complexType);
-                xmlSchema.getElements().add(elementName, complexType);
-                typeTable.addComplexSchema(Exception.class.getName(), elementName);
-                QName schemaTypeName = TypeTable.ANY_TYPE;
-                addContentToMethodSchemaType(sequence,
-                        schemaTypeName,
-                        "Exception",
-                        false);
-                complexType.setParticle(sequence);
+                if (typeTable.getComplexSchemaType(Exception.class.getName()) !=null) {
+
+                } else {
+                    sequence = new XmlSchemaSequence();
+                    XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace);
+                    QName elementName = new QName(schemaTargetNameSpace,
+                            "Exception",
+                            schema_namespace_prefix);
+                    XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
+                    complexType.setName("Exception");
+                    xmlSchema.getItems().add(complexType);
+                    xmlSchema.getElements().add(elementName, complexType);
+                    typeTable.addComplexSchema(Exception.class.getName(), elementName);
+                    QName schemaTypeName = TypeTable.ANY_TYPE;
+                    addContentToMethodSchemaType(sequence,
+                            schemaTypeName,
+                            "Exception",
+                            false);
+                    complexType.setParticle(sequence);
+                }
                 generateBaseException = true;
             }
             JClass[] extypes = jMethod.getExceptionTypes();
@@ -428,13 +432,16 @@
                         new QName(this.schemaTargetNameSpace, partQname, this.schema_namespace_prefix);
                 sequence = new XmlSchemaSequence();
                 if (Exception.class.getName().equals(extype.getQualifiedName())) {
+                    QName schemaTypeName = typeTable.getComplexSchemaType(Exception.class.getName());
                     addContentToMethodSchemaType(sequence,
-                            typeTable.getComplexSchemaType(Exception.class.getName()),
+                            schemaTypeName,
                             partQname,
                             false);
                     methodSchemaType.setParticle(sequence);
                     typeTable.addComplexSchema(Exception.class.getPackage().getName(),
                             methodSchemaType.getQName());
+                    String schemaNamespace = resolveSchemaNamespace(Exception.class.getPackage().getName());
+                    addImport(getXmlSchema(schemaTargetNameSpace),schemaTypeName );
                 } else {
                     generateSchemaForType(sequence, extype, extype.getSimpleName());
                     methodSchemaType.setParticle(sequence);



---------------------------------------------------------------------
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