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 2007/05/22 10:21:35 UTC

svn commit: r540520 - in /incubator/yoko/trunk/tools/src: main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java test/resources/idl/Octet.idl test/resources/idl/expected_Octet.wsdl

Author: enolan
Date: Tue May 22 03:21:35 2007
New Revision: 540520

URL: http://svn.apache.org/viewvc?view=rev&rev=540520
Log:
Update to last merge. 

Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java
    incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java?view=diff&rev=540520&r1=540519&r2=540520
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java Tue May 22 03:21:35 2007
@@ -23,7 +23,7 @@
 
 import antlr.collections.AST;
 
-import org.apache.schemas.yoko.bindings.corba.Alias;
+//import org.apache.schemas.yoko.bindings.corba.Alias;
 import org.apache.schemas.yoko.bindings.corba.Anonsequence;
 import org.apache.schemas.yoko.bindings.corba.Sequence;
 
@@ -31,6 +31,7 @@
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.ws.commons.schema.constants.Constants;
 
 import org.apache.yoko.tools.common.ReferenceConstants;
 import org.apache.yoko.wsdl.CorbaTypeImpl;
@@ -86,23 +87,9 @@
         } else {
             scopedName = new Scope(getScope(), identifierNode);
         }
-
-        XmlSchemaType schemaType = null;        
-        QName basetype = null;
-        if (ctype instanceof Alias) {
-            Alias alias = (Alias) ctype;
-            basetype = alias.getBasetype();
-        }
-        // Needs to check if its a typedef of basetype octet.
-        if (simpleTypeSpecNode.getType() != IDLTokenTypes.LITERAL_octet) {
-            if (basetype != null) {
-                if (!(basetype.getLocalPart().equals("octet"))) {
-                    schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
-                }
-            } else {
-                schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
-            }
-        } 
+              
+        XmlSchemaType schemaType = null;                
+        
         // According to CORBA Binding for WSDL specification,
         // idl:sequence<octet> maps to xs:base64Binary by default.
         // 
@@ -110,9 +97,14 @@
         // that idl:sequence<octet> should map to, as specified by the 
         // -s command line option or the default type xsd:base64Binary.
         //
-        if ((simpleTypeSpecNode.getType() == IDLTokenTypes.LITERAL_octet)
-            || (basetype != null && basetype.getLocalPart().equals("octet"))) {
-            schemaType = wsdlVisitor.getSequenceOctetType();
+        if (stype != null) {
+            if (!stype.getQName().equals(Constants.XSD_UNSIGNEDBYTE)) {
+                schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
+            } else {
+                schemaType = wsdlVisitor.getSequenceOctetType();
+            }
+        } else {
+            schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
         }
         
         CorbaTypeImpl corbaType = null;

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl?view=diff&rev=540520&r1=540519&r2=540520
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/Octet.idl Tue May 22 03:21:35 2007
@@ -18,4 +18,13 @@
 */ 
 
 typedef octet TpOctet; 
+typedef TpOctet myOctet;
+
+// sequences of octets
 typedef sequence <TpOctet> TpOctetSet; 
+typedef sequence <myOctet> TpOctetSet2; 
+
+// arrays of octets
+typedef TpOctet TpArrayOctet[6]; 
+typedef myOctet TpArrayOctet2[6];
+

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl?view=diff&rev=540520&r1=540519&r2=540520
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Octet.wsdl Tue May 22 03:21:35 2007
@@ -20,10 +20,26 @@
 <wsdl:definitions targetNamespace="http://schemas.apache.org/yoko/idl/Octet" xmlns:tns="http://schemas.apache.org/yoko/idl/Octet" xmlns:corba="http://schemas.apache.org/yoko/bindings/corba" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <corba:typeMapping targetNamespace="http://schemas.apache.org/yoko/idl/Octet/typemap">
     <corba:alias xmlns="http://schemas.apache.org/yoko/idl/Octet/typemap" basetype="corba:octet" repositoryID="IDL:TpOctet:1.0" name="TpOctet" />
+    <corba:alias xmlns="http://schemas.apache.org/yoko/idl/Octet/typemap" basetype="TpOctet" repositoryID="IDL:myOctet:1.0" name="myOctet" />
     <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/Octet/typemap" elemtype="TpOctet" bound="0" repositoryID="IDL:TpOctetSet:1.0" name="TpOctetSet" type="xs:base64Binary" />
+    <corba:sequence xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.apache.org/yoko/idl/Octet/typemap" elemtype="myOctet" bound="0" repositoryID="IDL:TpOctetSet2:1.0" name="TpOctetSet2" type="xs:base64Binary" />
+    <corba:array xmlns="http://schemas.apache.org/yoko/idl/Octet/typemap" bound="6" repositoryID="IDL:TpArrayOctet:1.0" name="TpArrayOctet" type="TpOctet" />
+    <corba:array xmlns="http://schemas.apache.org/yoko/idl/Octet/typemap" bound="6" repositoryID="IDL:TpArrayOctet2:1.0" name="TpArrayOctet2" type="myOctet" />
   </corba:typeMapping>
   <wsdl:types>
     <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://schemas.apache.org/yoko/idl/Octet" xmlns="http://schemas.apache.org/yoko/idl/Octet" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+      <xs:complexType name="TpArrayOctet">
+        <xs:sequence>
+          <xs:element maxOccurs="6" minOccurs="6" name="item" type="xs:unsignedByte">
+          </xs:element>
+        </xs:sequence>
+      </xs:complexType>
+      <xs:complexType name="TpArrayOctet2">
+        <xs:sequence>
+          <xs:element maxOccurs="6" minOccurs="6" name="item" type="xs:unsignedByte">
+          </xs:element>
+        </xs:sequence>
+      </xs:complexType>
     </xs:schema>
   </wsdl:types>
 </wsdl:definitions>