You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by en...@apache.org on 2006/08/03 13:07:57 UTC

svn commit: r428399 [1/3] - in /incubator/yoko/trunk/tools/src: main/java/org/apache/yoko/tools/common/idltypes/ main/java/org/apache/yoko/tools/processors/wsdl/ test/java/org/apache/yoko/tools/processors/ test/resources/idlgen/

Author: enolan
Date: Thu Aug  3 06:07:55 2006
New Revision: 428399

URL: http://svn.apache.org/viewvc?rev=428399&view=rev
Log:
Yoko-119 Support for anonymous types in the idlgeneration of wsdltoidl - Adding AnonString support.

Added:
    incubator/yoko/trunk/tools/src/test/resources/idlgen/enum.wsdl   (with props)
    incubator/yoko/trunk/tools/src/test/resources/idlgen/expected_enum.idl
Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/idltypes/IdlString.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java
    incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java
    incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToIDLGenerationTest.java

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/idltypes/IdlString.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/idltypes/IdlString.java?rev=428399&r1=428398&r2=428399&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/idltypes/IdlString.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/idltypes/IdlString.java Thu Aug  3 06:07:55 2006
@@ -39,7 +39,7 @@
     }
 
 
-    static IdlString create(int bound) {
+    public static IdlString create(int bound) {
         IdlString result;
 
         if (bound == 0) {

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java?rev=428399&r1=428398&r2=428399&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java Thu Aug  3 06:07:55 2006
@@ -65,6 +65,7 @@
 import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
 import org.apache.schemas.yoko.bindings.corba.Union;
 import org.apache.schemas.yoko.bindings.corba.Unionbranch;
+
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaAttribute;
 import org.apache.ws.commons.schema.XmlSchemaChoice;
@@ -821,8 +822,8 @@
         } else {
             schematypeName = checkPrefix(stype.getQName());
             name = createQNameCorbaNamespace(schematypeName.getLocalPart());
-        }
-
+        }        
+        
         if (stype.getContent() instanceof XmlSchemaSimpleTypeRestriction) {
             // checks if enumeration
             XmlSchemaSimpleTypeRestriction restrictionType = (XmlSchemaSimpleTypeRestriction)stype

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java?rev=428399&r1=428398&r2=428399&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java Thu Aug  3 06:07:55 2006
@@ -37,6 +37,7 @@
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 
+import org.apache.schemas.yoko.bindings.corba.Anonstring;
 import org.apache.schemas.yoko.bindings.corba.ArgType;
 import org.apache.schemas.yoko.bindings.corba.Array;
 import org.apache.schemas.yoko.bindings.corba.BindingType;
@@ -51,7 +52,6 @@
 import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
 import org.apache.schemas.yoko.bindings.corba.Union;
 import org.apache.schemas.yoko.bindings.corba.Unionbranch;
-
 import org.apache.yoko.tools.common.CORBAConstants;
 import org.apache.yoko.tools.common.idltypes.CorbaUtils;
 import org.apache.yoko.tools.common.idltypes.IdlArray;
@@ -68,6 +68,7 @@
 import org.apache.yoko.tools.common.idltypes.IdlRoot;
 import org.apache.yoko.tools.common.idltypes.IdlScopeBase;
 import org.apache.yoko.tools.common.idltypes.IdlSequence;
+import org.apache.yoko.tools.common.idltypes.IdlString;
 import org.apache.yoko.tools.common.idltypes.IdlStruct;
 import org.apache.yoko.tools.common.idltypes.IdlType;
 import org.apache.yoko.tools.common.idltypes.IdlUnion;
@@ -75,7 +76,6 @@
 import org.apache.yoko.tools.utils.FileOutputStreamFactory;
 import org.apache.yoko.tools.utils.OutputStreamFactory;
 import org.apache.yoko.wsdl.CorbaTypeImpl;
-
 import org.objectweb.celtix.common.logging.LogUtils;
 import org.objectweb.celtix.wsdl.JAXBExtensionHelper;
 
@@ -332,7 +332,8 @@
             Iterator i = typeMappingType.getStructOrExceptionOrUnion().iterator();
             while (i.hasNext()) {
                 CorbaTypeImpl corbaType = (CorbaTypeImpl)i.next();                
-                if (corbaType.getType().getLocalPart().equals(qname.getLocalPart())) {                
+                //if (corbaType.getType().getLocalPart().equals(qname.getLocalPart())) {                
+                if (corbaType.getName().equals(qname.getLocalPart())) {                    
                     return corbaType;
                 }
             }
@@ -478,10 +479,24 @@
             result = createUnion(corbaTypeImpl, scope, local);
         } else if (corbaTypeImpl instanceof Array) {
             result = createArray(corbaTypeImpl, scope, local);
+        } else {
+            result = checkAnon(corbaTypeImpl, scope, local);                            
         }
         return result;
     }
 
+    private IdlType checkAnon(CorbaTypeImpl corbaTypeImpl, IdlScopeBase scope, 
+                              String local) throws Exception {
+        IdlType result = null;
+        
+        if (corbaTypeImpl instanceof Anonstring) {
+            Anonstring as = (Anonstring)corbaTypeImpl;   
+            Long lbound = as.getBound();
+            int bound = lbound.intValue();  
+            result = IdlString.create(bound);        
+        }
+        return result;
+    }
 
     private IdlType createIdlException(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
         IdlType result = null;

Modified: incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java?rev=428399&r1=428398&r2=428399&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java (original)
+++ incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java Thu Aug  3 06:07:55 2006
@@ -476,7 +476,8 @@
             generator.addInterfaceName("X");
 
             Definition model = generator.generateCORBABinding();
-            QName bName = new QName("http://schemas.apache.org/idl/anon.idl", "XCORBABinding", "tns");           
+            QName bName = new QName("http://schemas.apache.org/idl/anon.idl", 
+                                    "XCORBABinding", "tns");           
 
             Binding binding = model.getBinding(bName);
             assertNotNull(binding);

Modified: incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToIDLGenerationTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToIDLGenerationTest.java?rev=428399&r1=428398&r2=428399&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToIDLGenerationTest.java (original)
+++ incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToIDLGenerationTest.java Thu Aug  3 06:07:55 2006
@@ -280,7 +280,7 @@
     }
 
 
-    /*public void testEnumIdlgen() throws Exception {
+    public void testEnumIdlgen() throws Exception {
         
         try {
             WSDLToIDLAction idlgen = new WSDLToIDLAction();
@@ -300,6 +300,6 @@
         } finally {
             new File("stringtypes.idl").deleteOnExit();
         }
-    }*/
+    }
     
 }