axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r799446 - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/description/java2wsdl/ test/org/apache/axis2/description/java2wsdl/
Date Thu, 30 Jul 2009 21:24:01 GMT
Author: veithen
Date: Thu Jul 30 21:23:55 2009
New Revision: 799446

URL: http://svn.apache.org/viewvc?rev=799446&view=rev
Log:
AXIS2-4443: Applied patch submitted by Detelin Yordanov to fix the mapping between Java class
names and schema types for inner classes. Also changed the test case for extra classes to
make it orthogonal to the inner class issue.

Added:
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/ExtraClass.java
  (with props)
Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/DefaultSchemaGeneratorTest.java

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=799446&r1=799445&r2=799446&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
Thu Jul 30 21:23:55 2009
@@ -442,7 +442,7 @@
                 if (AxisFault.class.getName().equals(extype.getName())) {
                     continue;
                 }
-                String partQname = extype.getSimpleName();
+                String partQname = getSimpleClassName(extype);
                 methodSchemaType = createSchemaTypeForFault(partQname);
                 QName elementName =
                         new QName(this.schemaTargetNameSpace, partQname, this.schema_namespace_prefix);
@@ -459,7 +459,7 @@
                     resolveSchemaNamespace(Exception.class.getPackage().getName());
                     addImport(getXmlSchema(schemaTargetNameSpace), schemaTypeName);
                 } else {
-                    generateSchemaForType(sequence, extype, extype.getSimpleName());
+                    generateSchemaForType(sequence, extype, getSimpleClassName(extype));
                     methodSchemaType.setParticle(sequence);
                 }
 
@@ -469,7 +469,7 @@
                     continue;
                 }
                 AxisMessage faultMessage = new AxisMessage();
-                faultMessage.setName(extype.getSimpleName());
+                faultMessage.setName(getSimpleClassName(extype));
                 faultMessage.setElementQName(typeTable.getQNamefortheType(partQname));
                 axisOperation.setFaultMessages(faultMessage);
             }
@@ -486,7 +486,7 @@
         String name = getClassName(javaType);
         QName schemaTypeName = typeTable.getComplexSchemaType(name);
         if (schemaTypeName == null) {
-            String simpleName = javaType.getSimpleName();
+            String simpleName = getSimpleClassName(javaType);
 
             String packageName = getQualifiedName(javaType.getPackage());
             String targetNameSpace = resolveSchemaNamespace(packageName);
@@ -514,7 +514,7 @@
                     && !(getQualifiedName(sup.getPackage()).indexOf("java.util")
> 0))
             {
                 String superClassName = sup.getName();
-                String superclassname = sup.getSimpleName();
+                String superclassname = getSimpleClassName(sup);
                 String tgtNamespace;
                 String tgtNamespacepfx;
                 QName qName = typeTable.getSimpleSchemaTypeName(superClassName);
@@ -636,7 +636,7 @@
                     simpleTypeName += "ArrayOf";
                     simpleType = simpleType.getComponentType();
                 }
-                simpleTypeName += simpleType.getSimpleName();
+                simpleTypeName += getSimpleClassName(simpleType);
 
                 if (xmlSchema.getTypeByName(simpleTypeName) == null) {
                     XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType(xmlSchema);
@@ -952,7 +952,7 @@
                     simpleTypeName += "ArrayOf";
                     simpleType = simpleType.getComponentType();
                 }
-                simpleTypeName += simpleType.getSimpleName();
+                simpleTypeName += getSimpleClassName(simpleType);
 
                 return processParameterArrayTypes(sequence, type, partName, simpleTypeName);
 
@@ -1454,6 +1454,16 @@
         }
         return name;
     }
+    
+    protected String getSimpleClassName(Class type) {
+        String simpleClassName = type.getName();
+        int idx = simpleClassName.lastIndexOf('.');
+        if (idx != -1 && idx < (simpleClassName.length() - 1)) {
+            simpleClassName = simpleClassName.substring(idx + 1);
+        }
+        
+        return simpleClassName.replace('$', '_');
+    }
 
     protected String getQualifiedName(Package packagez) {
         if (packagez != null) {

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/DefaultSchemaGeneratorTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/DefaultSchemaGeneratorTest.java?rev=799446&r1=799445&r2=799446&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/DefaultSchemaGeneratorTest.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/DefaultSchemaGeneratorTest.java
Thu Jul 30 21:23:55 2009
@@ -36,10 +36,6 @@
         
     }
     
-    public static class ExtraClass {
-        
-    }
-    
     public void testGeneratesExtraClass() throws Exception {
         
         AxisService axisService = new AxisService();

Added: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/ExtraClass.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/ExtraClass.java?rev=799446&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/ExtraClass.java
(added)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/ExtraClass.java
Thu Jul 30 21:23:55 2009
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.description.java2wsdl;
+
+public class ExtraClass {
+    
+}
\ No newline at end of file

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/java2wsdl/ExtraClass.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message