incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eno...@apache.org
Subject svn commit: r426591 [1/2] - in /incubator/yoko/trunk/tools/src: main/java/org/apache/yoko/tools/common/ main/java/org/apache/yoko/tools/processors/wsdl/ test/java/org/apache/yoko/tools/processors/ test/resources/wsdl/
Date Fri, 28 Jul 2006 16:13:29 GMT
Author: enolan
Date: Fri Jul 28 09:13:28 2006
New Revision: 426591

URL: http://svn.apache.org/viewvc?rev=426591&view=rev
Log:
Adding basic support for Arrays and fixed some bugs with different types.

Added:
    incubator/yoko/trunk/tools/src/test/resources/wsdl/sequencetype.wsdl   (with props)
Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/CorbaPrimitiveMap.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/PrimitiveMapBase.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/W3CConstants.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLParameter.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/WSDLToProcessor.java
    incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/CorbaPrimitiveMap.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/CorbaPrimitiveMap.java?rev=426591&r1=426590&r2=426591&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/CorbaPrimitiveMap.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/CorbaPrimitiveMap.java Fri Jul 28 09:13:28 2006
@@ -20,128 +20,71 @@
 package org.apache.yoko.tools.common;
 
 import java.util.*;
+
 import javax.xml.namespace.QName;
 
 import org.apache.yoko.wsdl.CorbaTypeImpl;
 
 public class CorbaPrimitiveMap extends PrimitiveMapBase {
-
+    
     public CorbaPrimitiveMap() {
-        corbaPrimitiveMap = new HashMap<QName, CorbaTypeImpl>();
+        corbaPrimitiveMap = new HashMap<String, QName>();        
         initialiseMap();
-    }
+    }       
 
     private void initialiseMap() {
         
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_STRING, 
-                              createNewCorbaType(CORBAConstants.NT_CORBA_STRING, 
-                                                 W3CConstants.NT_SCHEMA_STRING));
-
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_BOOLEAN,
-            createNewCorbaType(CORBAConstants.NT_CORBA_BOOLEAN,
-                                          W3CConstants.NT_SCHEMA_BOOLEAN));
+        corbaPrimitiveMap.put("string", CORBAConstants.NT_CORBA_STRING); 
+        corbaPrimitiveMap.put("boolean", CORBAConstants.NT_CORBA_BOOLEAN);
+        corbaPrimitiveMap.put("float", CORBAConstants.NT_CORBA_FLOAT);
+        corbaPrimitiveMap.put("double", CORBAConstants.NT_CORBA_DOUBLE);       
+        corbaPrimitiveMap.put("dateTime", CORBAConstants.NT_CORBA_DATETIME);
+        corbaPrimitiveMap.put("date", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("time", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("gYearMonth", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("gYear", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("gMonthDay", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("gMonth", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("gDay", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("duration", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("anyURI", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("QName", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("normalizedString", CORBAConstants.NT_CORBA_STRING);                
+        corbaPrimitiveMap.put("token", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("language", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("NMTOKEN", CORBAConstants.NT_CORBA_STRING);                   
+        corbaPrimitiveMap.put("Name", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("NCName", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("ID", CORBAConstants.NT_CORBA_STRING);
+        corbaPrimitiveMap.put("integer", CORBAConstants.NT_CORBA_LONGLONG);        
+        corbaPrimitiveMap.put("short", CORBAConstants.NT_CORBA_SHORT);
+        corbaPrimitiveMap.put("byte", CORBAConstants.NT_CORBA_CHAR);
+        corbaPrimitiveMap.put("int", CORBAConstants.NT_CORBA_LONG);
+        corbaPrimitiveMap.put("long", CORBAConstants.NT_CORBA_LONGLONG);
+        corbaPrimitiveMap.put("nonPositiveInteger", CORBAConstants.NT_CORBA_LONGLONG);
+        corbaPrimitiveMap.put("negativeInteger", CORBAConstants.NT_CORBA_LONGLONG);
+        corbaPrimitiveMap.put("nonNegativeInteger", CORBAConstants.NT_CORBA_ULONGLONG);                
+        corbaPrimitiveMap.put("positiveInteger", CORBAConstants.NT_CORBA_ULONGLONG);                
+        corbaPrimitiveMap.put("unsignedInt", CORBAConstants.NT_CORBA_ULONG);
+        corbaPrimitiveMap.put("unsignedLong", CORBAConstants.NT_CORBA_ULONGLONG);                
+        corbaPrimitiveMap.put("unsignedShort", CORBAConstants.NT_CORBA_USHORT);
+        corbaPrimitiveMap.put("unsignedByte", CORBAConstants.NT_CORBA_OCTET);
+        corbaPrimitiveMap.put("anyType", CORBAConstants.NT_CORBA_ANY);
         
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_FLOAT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_FLOAT, W3CConstants.NT_SCHEMA_FLOAT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_DOUBLE,
-            createNewCorbaType(CORBAConstants.NT_CORBA_DOUBLE, W3CConstants.NT_SCHEMA_DOUBLE));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_DECIMAL, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_DUR, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_DATETIME,
-            createNewCorbaType(CORBAConstants.NT_CORBA_DATETIME,
-                                                 W3CConstants.NT_SCHEMA_DATETIME));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_DATE,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_DATE));
-
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_TIME,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_TIME));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_GYMON,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_GYMON));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_GYEAR,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_GYEAR));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_GMDAY,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_GMDAY));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_GMONTH,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_GMONTH));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_GDAY,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_GDAY));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_DUR,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_DUR));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_HBIN, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_BASE64, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_AURI,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_AURI));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NOTATION, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_QNAME,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_QNAME));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NSTRING,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING,
-                W3CConstants.NT_SCHEMA_NSTRING));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_TOKEN,
-             createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_TOKEN));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_LANG,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_LANG));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NMTOKEN,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING,
-                W3CConstants.NT_SCHEMA_NMTOKEN));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NMTOKENS, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NAME,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_NAME));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NCNAME,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_NCNAME));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_ID,
-            createNewCorbaType(CORBAConstants.NT_CORBA_STRING, W3CConstants.NT_SCHEMA_ID));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_IDREF, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_IDREFS, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_ENTITY, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_ENTITIES, null);
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_INTEGER,
-            createNewCorbaType(CORBAConstants.NT_CORBA_LONGLONG,
-                W3CConstants.NT_SCHEMA_INTEGER));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_SHORT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_SHORT, W3CConstants.NT_SCHEMA_SHORT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_BYTE,
-            createNewCorbaType(CORBAConstants.NT_CORBA_CHAR, W3CConstants.NT_SCHEMA_BYTE));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_INT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_LONG, W3CConstants.NT_SCHEMA_INT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_LONG,
-            createNewCorbaType(CORBAConstants.NT_CORBA_LONGLONG, W3CConstants.NT_SCHEMA_LONG));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NPINT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_LONGLONG, W3CConstants.NT_SCHEMA_PINT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NINT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_LONGLONG, W3CConstants.NT_SCHEMA_NINT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_NNINT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_ULONGLONG,
-                W3CConstants.NT_SCHEMA_NNINT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_PINT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_ULONGLONG,
-                W3CConstants.NT_SCHEMA_PINT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_UINT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_ULONG, W3CConstants.NT_SCHEMA_UINT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_ULONG,
-            createNewCorbaType(CORBAConstants.NT_CORBA_ULONGLONG,
-                W3CConstants.NT_SCHEMA_ULONG));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_USHORT,
-            createNewCorbaType(CORBAConstants.NT_CORBA_USHORT, W3CConstants.NT_SCHEMA_USHORT));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_UBYTE,
-            createNewCorbaType(CORBAConstants.NT_CORBA_OCTET, W3CConstants.NT_SCHEMA_UBYTE));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_ANYTYPE,
-            createNewCorbaType(CORBAConstants.NT_CORBA_ANY, W3CConstants.NT_SCHEMA_ANYTYPE));
-        corbaPrimitiveMap.put(W3CConstants.NT_SCHEMA_ANY, null);   
-
     }
     
-    public static CorbaTypeImpl createNewCorbaType(QName corbaName, QName typeName) {
-        CorbaTypeImpl corbaTypeImpl = new CorbaTypeImpl();    
+    public Object get(QName key) {
+        CorbaTypeImpl corbaTypeImpl = null; new CorbaTypeImpl();    
 
-        corbaTypeImpl.setQName(corbaName);
-        corbaTypeImpl.setType(typeName);
-        corbaTypeImpl.setName(corbaName.getLocalPart());
-        return corbaTypeImpl;
-    }
-    
-    public Object get(Object key) {
-        return corbaPrimitiveMap.get(key);        
+        QName type = corbaPrimitiveMap.get(key.getLocalPart());
+        if (type != null) {
+            corbaTypeImpl = new CorbaTypeImpl();
+            corbaTypeImpl.setQName(type);
+            corbaTypeImpl.setType(key);
+            corbaTypeImpl.setName(key.getLocalPart());
+        }
+        
+        return corbaTypeImpl;        
     }
 
 

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/PrimitiveMapBase.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/PrimitiveMapBase.java?rev=426591&r1=426590&r2=426591&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/PrimitiveMapBase.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/PrimitiveMapBase.java Fri Jul 28 09:13:28 2006
@@ -21,10 +21,11 @@
 
 import java.util.*;
 import javax.xml.namespace.QName;
-import org.apache.yoko.wsdl.CorbaTypeImpl;
+//import org.apache.yoko.wsdl.CorbaTypeImpl;
 
 public abstract class PrimitiveMapBase {
-    protected Map<QName, CorbaTypeImpl> corbaPrimitiveMap;
+   // protected Map<String, CorbaTypeImpl> corbaPrimitiveMap;
+    protected Map<String, QName> corbaPrimitiveMap;
 
     public Object get(Object key) {
         return corbaPrimitiveMap.get(key);

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/W3CConstants.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/W3CConstants.java?rev=426591&r1=426590&r2=426591&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/W3CConstants.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/common/W3CConstants.java Fri Jul 28 09:13:28 2006
@@ -49,88 +49,88 @@
     QName NA_XSI_TYPE = new QName(NU_SCHEMA_XSI, A_XSI_TYPE);
 
     // XML Schema element names
-    QName NE_SCHEMA_LIST = new QName(NU_SCHEMA_XSD, "list");
-    QName NE_SCHEMA_UNION = new QName(NU_SCHEMA_XSD, "union");
-    QName NE_SCHEMA_SCHEMA = new QName(NU_SCHEMA_XSD, "schema");
-    QName NE_SCHEMA_ELEMENT = new QName(NU_SCHEMA_XSD, "element");
-    QName NE_SCHEMA_COMPLEXTYPE = new QName(NU_SCHEMA_XSD, "complexType");
-    QName NE_SCHEMA_SIMPLETYPE = new QName(NU_SCHEMA_XSD, "simpleType");
-    QName NE_SCHEMA_ANY = new QName(NU_SCHEMA_XSD, "any");
-
-    QName NE_SCHEMA_SEQUENCE = new QName(NU_SCHEMA_XSD, "sequence");
-    QName NE_SCHEMA_ALL = new QName(NU_SCHEMA_XSD, "all");
-    QName NE_SCHEMA_CHOICE = new QName(NU_SCHEMA_XSD, "choice");
-
-    QName NE_SCHEMA_IMPORT = new QName(NU_SCHEMA_XSD, "import");
-    QName NE_SCHEMA_INCLUDE = new QName(NU_SCHEMA_XSD, "include");
-
-    QName NE_SCHEMA_ANNOTATION = new QName(NU_SCHEMA_XSD, "annotation");
-    QName NE_SCHEMA_DOCUMENTATION = new QName(NU_SCHEMA_XSD, "documentation");
-    QName NE_SCHEMA_APPINFO = new QName(NU_SCHEMA_XSD, "appinfo");
-
-    QName NE_SCHEMA_COMPLEX_CONTENT = new QName(NU_SCHEMA_XSD, "complexContent");
-    QName NE_SCHEMA_SIMPLE_CONTENT = new QName(NU_SCHEMA_XSD, "simpleContent");
-    QName NE_SCHEMA_RESTRICTION = new QName(NU_SCHEMA_XSD, "restriction");
-    QName NE_SCHEMA_ENUMERATION = new QName(NU_SCHEMA_XSD, "enumeration");
-    QName NE_SCHEMA_EXTENSION = new QName(NU_SCHEMA_XSD, "extension");
-    QName NE_SCHEMA_ATTRIBUTE = new QName(NU_SCHEMA_XSD, "attribute");
-    QName NE_SCHEMA_ANY_ATTRIBUTE = new QName(NU_SCHEMA_XSD, "anyAttribute");
-    QName NE_SCHEMA_ATTRIBUTEGROUP = new QName(NU_SCHEMA_XSD, "attributeGroup");
+    QName NE_SCHEMA_LIST = new QName(NU_SCHEMA_XSD, "list", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_UNION = new QName(NU_SCHEMA_XSD, "union", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_SCHEMA = new QName(NU_SCHEMA_XSD, "schema", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_ELEMENT = new QName(NU_SCHEMA_XSD, "element", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_COMPLEXTYPE = new QName(NU_SCHEMA_XSD, "complexType", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_SIMPLETYPE = new QName(NU_SCHEMA_XSD, "simpleType", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_ANY = new QName(NU_SCHEMA_XSD, "any", NP_SCHEMA_XSD);
+
+    QName NE_SCHEMA_SEQUENCE = new QName(NU_SCHEMA_XSD, "sequence", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_ALL = new QName(NU_SCHEMA_XSD, "all", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_CHOICE = new QName(NU_SCHEMA_XSD, "choice", NP_SCHEMA_XSD);
+
+    QName NE_SCHEMA_IMPORT = new QName(NU_SCHEMA_XSD, "import", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_INCLUDE = new QName(NU_SCHEMA_XSD, "include", NP_SCHEMA_XSD);
+
+    QName NE_SCHEMA_ANNOTATION = new QName(NU_SCHEMA_XSD, "annotation", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_DOCUMENTATION = new QName(NU_SCHEMA_XSD, "documentation", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_APPINFO = new QName(NU_SCHEMA_XSD, "appinfo", NP_SCHEMA_XSD);
+
+    QName NE_SCHEMA_COMPLEX_CONTENT = new QName(NU_SCHEMA_XSD, "complexContent", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_SIMPLE_CONTENT = new QName(NU_SCHEMA_XSD, "simpleContent", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_RESTRICTION = new QName(NU_SCHEMA_XSD, "restriction", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_ENUMERATION = new QName(NU_SCHEMA_XSD, "enumeration", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_EXTENSION = new QName(NU_SCHEMA_XSD, "extension", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_ATTRIBUTE = new QName(NU_SCHEMA_XSD, "attribute", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_ANY_ATTRIBUTE = new QName(NU_SCHEMA_XSD, "anyAttribute", NP_SCHEMA_XSD);
+    QName NE_SCHEMA_ATTRIBUTEGROUP = new QName(NU_SCHEMA_XSD, "attributeGroup", NP_SCHEMA_XSD);
 
-    QName NE_SCHEMA_GROUP = new QName(NU_SCHEMA_XSD, "group");
+    QName NE_SCHEMA_GROUP = new QName(NU_SCHEMA_XSD, "group", NP_SCHEMA_XSD);
     
 //  XML Schema primitive and derived built-in types
     // Primitives
-    QName NT_SCHEMA_STRING = new QName(NU_SCHEMA_XSD, "string");
-    QName NT_SCHEMA_BOOLEAN = new QName(NU_SCHEMA_XSD, "boolean");
-    QName NT_SCHEMA_FLOAT = new QName(NU_SCHEMA_XSD, "float");
-    QName NT_SCHEMA_DOUBLE = new QName(NU_SCHEMA_XSD, "double");
-    QName NT_SCHEMA_DECIMAL = new QName(NU_SCHEMA_XSD, "decimal");
-    QName NT_SCHEMA_DUR = new QName(NU_SCHEMA_XSD, "duration");
-    QName NT_SCHEMA_DATETIME = new QName(NU_SCHEMA_XSD, "dateTime");
-    QName NT_SCHEMA_TIME = new QName(NU_SCHEMA_XSD, "time");
-    QName NT_SCHEMA_DATE = new QName(NU_SCHEMA_XSD, "date");
-    QName NT_SCHEMA_GYMON = new QName(NU_SCHEMA_XSD, "gYearMonth");
-    QName NT_SCHEMA_GYEAR = new QName(NU_SCHEMA_XSD, "gYear");
-    QName NT_SCHEMA_GMDAY = new QName(NU_SCHEMA_XSD, "gMonthDay");
-    QName NT_SCHEMA_GDAY = new QName(NU_SCHEMA_XSD, "gDay");
-    QName NT_SCHEMA_GMONTH = new QName(NU_SCHEMA_XSD, "gMonth");
-    QName NT_SCHEMA_HBIN = new QName(NU_SCHEMA_XSD, "hexBinary");
-    QName NT_SCHEMA_BASE64 = new QName(NU_SCHEMA_XSD, "base64Binary");
-    QName NT_SCHEMA_AURI = new QName(NU_SCHEMA_XSD, "anyURI");
-    QName NT_SCHEMA_QNAME = new QName(NU_SCHEMA_XSD, "QName");
-    QName NT_SCHEMA_NOTATION = new QName(NU_SCHEMA_XSD, "NOTATION");
+    QName NT_SCHEMA_STRING = new QName(NU_SCHEMA_XSD, "string", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_BOOLEAN = new QName(NU_SCHEMA_XSD, "boolean", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_FLOAT = new QName(NU_SCHEMA_XSD, "float", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_DOUBLE = new QName(NU_SCHEMA_XSD, "double", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_DECIMAL = new QName(NU_SCHEMA_XSD, "decimal", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_DUR = new QName(NU_SCHEMA_XSD, "duration", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_DATETIME = new QName(NU_SCHEMA_XSD, "dateTime", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_TIME = new QName(NU_SCHEMA_XSD, "time", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_DATE = new QName(NU_SCHEMA_XSD, "date", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_GYMON = new QName(NU_SCHEMA_XSD, "gYearMonth", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_GYEAR = new QName(NU_SCHEMA_XSD, "gYear", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_GMDAY = new QName(NU_SCHEMA_XSD, "gMonthDay", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_GDAY = new QName(NU_SCHEMA_XSD, "gDay", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_GMONTH = new QName(NU_SCHEMA_XSD, "gMonth", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_HBIN = new QName(NU_SCHEMA_XSD, "hexBinary", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_BASE64 = new QName(NU_SCHEMA_XSD, "base64Binary", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_AURI = new QName(NU_SCHEMA_XSD, "anyURI", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_QNAME = new QName(NU_SCHEMA_XSD, "QName", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_NOTATION = new QName(NU_SCHEMA_XSD, "NOTATION", NP_SCHEMA_XSD);
 
     // DerivedTypes
-    QName NT_SCHEMA_NSTRING = new QName(NU_SCHEMA_XSD, "normalizedString");
-    QName NT_SCHEMA_TOKEN = new QName(NU_SCHEMA_XSD, "token");
-    QName NT_SCHEMA_LANG = new QName(NU_SCHEMA_XSD, "language");
-    QName NT_SCHEMA_NMTOKEN = new QName(NU_SCHEMA_XSD, "NMTOKEN");
-    QName NT_SCHEMA_NMTOKENS = new QName(NU_SCHEMA_XSD, "NMTOKENS");
-    QName NT_SCHEMA_NAME = new QName(NU_SCHEMA_XSD, "Name");
-    QName NT_SCHEMA_NCNAME = new QName(NU_SCHEMA_XSD, "NCName");
-    QName NT_SCHEMA_ID = new QName(NU_SCHEMA_XSD, "ID");
-    QName NT_SCHEMA_IDREF = new QName(NU_SCHEMA_XSD, "IDREF");
-    QName NT_SCHEMA_IDREFS = new QName(NU_SCHEMA_XSD, "IDREFS");
-    QName NT_SCHEMA_ENTITY = new QName(NU_SCHEMA_XSD, "ENTITY");
-    QName NT_SCHEMA_ENTITIES = new QName(NU_SCHEMA_XSD, "ENTITIES");
-    QName NT_SCHEMA_INTEGER = new QName(NU_SCHEMA_XSD, "integer");
-    QName NT_SCHEMA_NPINT = new QName(NU_SCHEMA_XSD, "nonPositiveInteger");
-    QName NT_SCHEMA_NINT = new QName(NU_SCHEMA_XSD, "negativeInteger");
-    QName NT_SCHEMA_LONG = new QName(NU_SCHEMA_XSD, "long");
-    QName NT_SCHEMA_INT = new QName(NU_SCHEMA_XSD, "int");
-    QName NT_SCHEMA_SHORT = new QName(NU_SCHEMA_XSD, "short");
-    QName NT_SCHEMA_BYTE = new QName(NU_SCHEMA_XSD, "byte");
-    QName NT_SCHEMA_NNINT = new QName(NU_SCHEMA_XSD, "nonNegativeInteger");
-    QName NT_SCHEMA_ULONG = new QName(NU_SCHEMA_XSD, "unsignedLong");
-    QName NT_SCHEMA_UINT = new QName(NU_SCHEMA_XSD, "unsignedInt");
-    QName NT_SCHEMA_USHORT = new QName(NU_SCHEMA_XSD, "unsignedShort");
-    QName NT_SCHEMA_UBYTE = new QName(NU_SCHEMA_XSD, "unsignedByte");
-    QName NT_SCHEMA_PINT = new QName(NU_SCHEMA_XSD, "positiveInteger");
-
-    QName NT_SCHEMA_ANYTYPE = new QName(NU_SCHEMA_XSD, "anyType");
-    QName NT_SCHEMA_ANYSIMPLETYPE = new QName(NU_SCHEMA_XSD, "anySimpleType");
-    QName NT_SCHEMA_ANY = new QName(NU_SCHEMA_XSD, "any"); 
+    QName NT_SCHEMA_NSTRING = new QName(NU_SCHEMA_XSD, "normalizedString", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_TOKEN = new QName(NU_SCHEMA_XSD, "token", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_LANG = new QName(NU_SCHEMA_XSD, "language", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_NMTOKEN = new QName(NU_SCHEMA_XSD, "NMTOKEN", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_NMTOKENS = new QName(NU_SCHEMA_XSD, "NMTOKENS", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_NAME = new QName(NU_SCHEMA_XSD, "Name", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_NCNAME = new QName(NU_SCHEMA_XSD, "NCName", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_ID = new QName(NU_SCHEMA_XSD, "ID", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_IDREF = new QName(NU_SCHEMA_XSD, "IDREF", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_IDREFS = new QName(NU_SCHEMA_XSD, "IDREFS", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_ENTITY = new QName(NU_SCHEMA_XSD, "ENTITY", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_ENTITIES = new QName(NU_SCHEMA_XSD, "ENTITIES", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_INTEGER = new QName(NU_SCHEMA_XSD, "integer", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_NPINT = new QName(NU_SCHEMA_XSD, "nonPositiveInteger", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_NINT = new QName(NU_SCHEMA_XSD, "negativeInteger", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_LONG = new QName(NU_SCHEMA_XSD, "long", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_INT = new QName(NU_SCHEMA_XSD, "int", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_SHORT = new QName(NU_SCHEMA_XSD, "short", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_BYTE = new QName(NU_SCHEMA_XSD, "byte", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_NNINT = new QName(NU_SCHEMA_XSD, "nonNegativeInteger", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_ULONG = new QName(NU_SCHEMA_XSD, "unsignedLong", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_UINT = new QName(NU_SCHEMA_XSD, "unsignedInt", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_USHORT = new QName(NU_SCHEMA_XSD, "unsignedShort", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_UBYTE = new QName(NU_SCHEMA_XSD, "unsignedByte", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_PINT = new QName(NU_SCHEMA_XSD, "positiveInteger", NP_SCHEMA_XSD);
+
+    QName NT_SCHEMA_ANYTYPE = new QName(NU_SCHEMA_XSD, "anyType", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_ANYSIMPLETYPE = new QName(NU_SCHEMA_XSD, "anySimpleType", NP_SCHEMA_XSD);
+    QName NT_SCHEMA_ANY = new QName(NU_SCHEMA_XSD, "any", NP_SCHEMA_XSD); 
 
     String getValue(String value);
 }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLParameter.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLParameter.java?rev=426591&r1=426590&r2=426591&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLParameter.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLParameter.java Fri Jul 28 09:13:28 2006
@@ -30,18 +30,21 @@
 import javax.wsdl.Operation;
 import javax.wsdl.Output;
 import javax.wsdl.Part;
+import javax.xml.namespace.QName;
 
 import org.apache.schemas.yoko.bindings.corba.ArgType;
 import org.apache.schemas.yoko.bindings.corba.ModeType;
 import org.apache.schemas.yoko.bindings.corba.ParamType;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaParticle;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaType;
-import org.apache.yoko.tools.common.CorbaPrimitiveMap;
+//import org.apache.yoko.tools.common.CorbaPrimitiveMap;
 import org.apache.yoko.wsdl.CorbaTypeImpl;
 
-public final class WSDLParameter {
-    static CorbaPrimitiveMap corbaPrimitiveMap = new CorbaPrimitiveMap();
+public final class WSDLParameter {    
 
     public void processParameters(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, Definition def,
                                   List<XmlSchema> xmlSchemaList, List<ParamType> params,
@@ -51,9 +54,17 @@
         List<ParamType> inputs = new ArrayList<ParamType>();
         List<ParamType> outputs = new ArrayList<ParamType>();
         List<ArgType> returnOutputs = new ArrayList<ArgType>();
-        
-        processInputParams(wsdlToCorbaBinding, operation, xmlSchemaList, inputs);
-        processOutputParams(wsdlToCorbaBinding, operation, xmlSchemaList, inputs, outputs);
+                
+        if (inputPartsHaveNoDocWrapper(operation.getName(), operation, xmlSchemaList)) {
+            processWrappedInputParams(wsdlToCorbaBinding, operation, xmlSchemaList, inputs);
+        } else {
+            processInputParams(wsdlToCorbaBinding, operation, xmlSchemaList, inputs);
+        }
+        if (outputPartsHaveNoDocWrapper(operation.getName(), operation, xmlSchemaList)) {
+            processWrappedOutputParams(wsdlToCorbaBinding, operation, xmlSchemaList, inputs, outputs);
+        } else {
+            processOutputParams(wsdlToCorbaBinding, operation, xmlSchemaList, inputs, outputs);
+        }
         processReturnParams(outputs, returnOutputs);
         orderParameters(inputs, outputs, simpleOrdering);
         returns.addAll(returnOutputs);
@@ -61,6 +72,54 @@
 
     }
 
+    private void processWrappedInputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation,
+                                           List<XmlSchema> xmlSchemaList, List<ParamType> inputs)
+        throws Exception {
+
+        Input input = operation.getInput();
+
+        if (input != null) {
+            Message msg = input.getMessage();
+            Iterator i = msg.getOrderedParts(null).iterator();
+            while (i.hasNext()) {
+                Part part = (Part)i.next();
+                XmlSchemaType schemaType = null;
+                schemaType = lookUpType(part, xmlSchemaList);
+                ParamType paramtype = null;
+                if (part.getElementName() != null) {
+                    if (schemaType instanceof XmlSchemaComplexType) {
+                        Iterator it = getSchemaIterator(schemaType);
+                        Iterator iter = getSchemaIterator(schemaType);
+                        while (it.hasNext()) {
+                            if (it.next() instanceof XmlSchemaElement) {
+                                XmlSchemaElement el = (XmlSchemaElement)iter.next();
+                                paramtype = createParam(wsdlToCorbaBinding, "in", el.getSchemaType(), el
+                                    .getQName().getLocalPart(), el.getSchemaTypeName());
+                                //if (paramtype != null) {
+                                inputs.add(paramtype);
+                                //}
+                            }                        
+                        }
+                    } else {
+                        paramtype = createParam(wsdlToCorbaBinding, "in", schemaType, part.getName(), part
+                            .getElementName());
+                        if (paramtype != null) {
+                            inputs.add(paramtype);
+                        }
+                    }
+                } else {
+                    if (part.getTypeName() != null) {
+                        paramtype = createParam(wsdlToCorbaBinding, "in", schemaType, part.getName(), part
+                            .getTypeName());
+                        if (paramtype != null) {
+                            inputs.add(paramtype);
+                        }
+                    }
+                }                
+            }
+        }
+    }
+
     private void processInputParams(WSDLToCorbaBinding wsdlToCorbaBinding, 
                                      Operation operation, List<XmlSchema> xmlSchemaList, 
                                      List<ParamType> inputs) throws Exception {
@@ -74,14 +133,125 @@
                 Part part = (Part)i.next();
                 XmlSchemaType schemaType = null;
                 schemaType = lookUpType(part, xmlSchemaList);
-                if ((part.getTypeName() != null) || (part.getElementName() != null)) {
-                    ParamType paramtype = createParamType(wsdlToCorbaBinding, part, "in", schemaType);
-                    inputs.add(paramtype);
+                ParamType paramtype = null;
+                if (part.getElementName() != null) {
+                    paramtype = createParam(wsdlToCorbaBinding, "in", schemaType, 
+                                            part.getName(), part.getElementName());
+                } else {
+                    if (part.getTypeName() != null) {                         
+                        paramtype = createParam(wsdlToCorbaBinding, "in", schemaType, 
+                                                part.getName(), part.getTypeName());
+                    }
+                }
+                if (paramtype != null) {
+                    inputs.add(paramtype);                               
+                }
+            }
+        }
+    }
+    
+    private boolean checkContent(XmlSchemaType schemaType) {
+        if (schemaType instanceof XmlSchemaComplexType) {
+            XmlSchemaComplexType complex = (XmlSchemaComplexType)schemaType;
+            XmlSchemaParticle particle = complex.getParticle();
+            if (particle instanceof XmlSchemaSequence) {
+                XmlSchemaSequence seq = (XmlSchemaSequence)particle;
+                if (seq.getItems().getCount() == 0) {
+                    return false;
+                }
+            }                        
+        }
+        return true;
+    }
+
+    private void processWrappedOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation,
+                                            List<XmlSchema> xmlSchemaList, List<ParamType> inputs, 
+                                            List<ParamType> outputs) throws Exception {
+
+        Output output = operation.getOutput();
+
+        if (output != null) {
+            Message msg = output.getMessage();
+            Iterator i = msg.getOrderedParts(null).iterator();
+            while (i.hasNext()) {
+                Part part = (Part)i.next();
+                XmlSchemaType schemaType = null;
+                schemaType = lookUpType(part, xmlSchemaList);
+                
+                // check if in input list
+                String mode = "out";
+                //ParamType paramtype = null;
+                if (part.getElementName() != null) {
+                    if (schemaType instanceof XmlSchemaComplexType) {
+                        Iterator it = getSchemaIterator(schemaType);
+                        Iterator iter = getSchemaIterator(schemaType);
+                        while (it.hasNext()) {
+                            if (it.next() instanceof XmlSchemaElement) {
+                                XmlSchemaElement el = (XmlSchemaElement)iter.next();
+                                updateList(wsdlToCorbaBinding, el.getSchemaType(), 
+                                           el.getQName().getLocalPart(), 
+                                           el.getQName().getLocalPart(),
+                                           el.getSchemaTypeName(), inputs, outputs);
+                            }                            
+                        }
+                    } else {
+                        updateList(wsdlToCorbaBinding, schemaType, part.getName(), part.getName(), 
+                                   part.getElementName(), inputs, outputs);                                
+                    }
+                } else {
+                    if (part.getTypeName() != null) {
+                        updateList(wsdlToCorbaBinding, schemaType, part.getName(), part.getName(), 
+                                   part.getTypeName(), inputs, outputs);                        
+                    }
                 }
             }
         }
     }
 
+    
+    private Iterator getSchemaIterator(XmlSchemaType schemaType) {
+        
+    
+        if (schemaType instanceof XmlSchemaComplexType) {
+            XmlSchemaComplexType cpt = (XmlSchemaComplexType)schemaType;
+            XmlSchemaParticle particle = (XmlSchemaParticle)cpt.getParticle();
+            if (particle instanceof XmlSchemaSequence) {
+                XmlSchemaSequence seq = (XmlSchemaSequence)particle;
+                return seq.getItems().getIterator();                
+            }
+        }
+        return null;
+    }
+    
+    private void updateList(WSDLToCorbaBinding wsdlToCorbaBinding, XmlSchemaType schemaType,
+                            String componentName, String name, QName typeName, 
+                            List<ParamType> inputs, List<ParamType> outputs) throws Exception {
+        
+        ParamType paramtype = null;
+        
+        for (int x = 0; x < inputs.size(); x++) {
+            paramtype = null;
+            ParamType d2 = (ParamType)inputs.get(x);
+             
+            if (d2.getName().equals(componentName)) {
+                inputs.remove(x);                                            
+                paramtype = createParam(wsdlToCorbaBinding, "inout", schemaType, 
+                                        name, typeName);
+                if (paramtype != null) {
+                    inputs.add(paramtype);
+                }
+            }
+        }
+        if (paramtype == null) {                                        
+            paramtype = createParam(wsdlToCorbaBinding, "out", schemaType, 
+                                                name, typeName);
+            if (paramtype != null) {
+                outputs.add(paramtype);
+            }                                        
+        }                                                                  
+
+    }
+    
     private void processOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation,
                                       List<XmlSchema> xmlSchemaList, List<ParamType> inputs,
                                       List<ParamType> outputs) throws Exception  {
@@ -106,13 +276,27 @@
                     if (part.getName() != null 
                         && d2.getName().equals(part.getName())) {
                         inputs.remove(x);
-                        paramtype = createParamType(wsdlToCorbaBinding, part, "inout", schemaType);
+                        if (part.getElementName() != null) {
+                            paramtype = createParam(wsdlToCorbaBinding, "inout", schemaType, 
+                                                    part.getName(), part.getElementName());
+                        } else {
+                            paramtype = createParam(wsdlToCorbaBinding, "inout", schemaType, 
+                                                    part.getName(), part.getTypeName());
+                        }
                         inputs.add(paramtype);                             
                     }
                 }
-                if (paramtype == null) {
-                    paramtype = createParamType(wsdlToCorbaBinding, part, mode, schemaType);
-                    outputs.add(paramtype);            
+                if (paramtype == null) {                    
+                    if (part.getElementName() != null) {
+                        paramtype = createParam(wsdlToCorbaBinding, mode, schemaType, 
+                                                part.getName(), part.getElementName());
+                    } else {
+                        paramtype = createParam(wsdlToCorbaBinding, mode, schemaType, 
+                                                part.getName(), part.getTypeName());
+                    }
+                    if (paramtype != null) {
+                        outputs.add(paramtype);
+                    }                    
                 }                                                
             }
         }
@@ -122,7 +306,7 @@
 
         if (outputs.size() > 0) {
             ParamType d2 = (ParamType)outputs.get(0);
-
+ 
             if (d2.getMode().value().equals("out")) {
                 ArgType argType = new ArgType();
                 argType.setName(d2.getName());
@@ -168,7 +352,7 @@
         }        
     }
 
-    private XmlSchemaType lookUpType(Part part, List<XmlSchema> xmlSchemaList) {
+    private static XmlSchemaType lookUpType(Part part, List<XmlSchema> xmlSchemaList) throws Exception {
         XmlSchemaType schemaType = null;
         
         Iterator i = xmlSchemaList.iterator();
@@ -195,26 +379,172 @@
     
     
     private static ParamType createParamType(WSDLToCorbaBinding wsdlToCorbaBinding, Part part, String mode,
-                                             XmlSchemaType schemaType) throws Exception {
+                                             XmlSchemaType schemaType, QName name) throws Exception {
 
         CorbaTypeImpl corbaTypeImpl = null;
         ParamType paramtype = new ParamType();
 
-        if ((part.getTypeName() != null) || part.getElementName() != null) {            
+        if ((part.getTypeName() != null) || part.getElementName() != null) {
             ModeType modeType = ModeType.fromValue(mode);
-            paramtype.setName(part.getName());
+            //paramtype.setName(part.getName());
+            paramtype.setName(name.getLocalPart());
             paramtype.setMode(modeType);            
             
-            if (schemaType == null) {
-                corbaTypeImpl = (CorbaTypeImpl)corbaPrimitiveMap.get(part.getTypeName());
+            if (schemaType == null) {               
+                corbaTypeImpl = (CorbaTypeImpl)wsdlToCorbaBinding.CORBAPRIMITIVEMAP.get(part.getTypeName());
                 paramtype.setIdltype(corbaTypeImpl.getQName());
             } else {
-                corbaTypeImpl = wsdlToCorbaBinding.convertSchemaToCorbaType(schemaType, part.getTypeName(),
-                                                                            null, false);
-                paramtype.setIdltype(corbaTypeImpl.getQName());
+                if (part.getTypeName() != null) {
+                    corbaTypeImpl = wsdlToCorbaBinding.convertSchemaToCorbaType(schemaType, 
+                                                          part.getTypeName(), null, false);
+                } else {
+                    corbaTypeImpl = wsdlToCorbaBinding.convertSchemaToCorbaType(schemaType, 
+                                                          part.getElementName(), null, false);
+                }
+                if (corbaTypeImpl == null) {
+                    return null;
+                } else {
+                    paramtype.setIdltype(corbaTypeImpl.getQName());
+                   
+                }
             }
             return paramtype;
         }
         return paramtype;
     }
-}
+
+    private static ParamType createParam(WSDLToCorbaBinding wsdlToCorbaBinding, 
+                                         String mode, XmlSchemaType schemaType, 
+                                         String name, QName typeName) throws Exception {
+
+        CorbaTypeImpl corbaTypeImpl = null;
+        ParamType paramtype = new ParamType();
+
+        ModeType modeType = ModeType.fromValue(mode);
+        paramtype.setName(name);
+        paramtype.setMode(modeType);            
+            
+        if (schemaType == null) {
+            corbaTypeImpl = (CorbaTypeImpl)wsdlToCorbaBinding.CORBAPRIMITIVEMAP.get(typeName);
+            paramtype.setIdltype(corbaTypeImpl.getQName());
+        } else {
+            corbaTypeImpl = wsdlToCorbaBinding.convertSchemaToCorbaType(schemaType, 
+                                                   typeName, null, false);
+            if (corbaTypeImpl == null) {
+                return null;
+            } else {
+                paramtype.setIdltype(corbaTypeImpl.getQName());                  
+            }           
+            return paramtype;
+        }
+        return paramtype;
+    }
+
+    
+    private static boolean inputPartsHaveNoDocWrapper(String opName, Operation operation, 
+                                                      List<XmlSchema> xmlSchemaList)
+        throws Exception {
+
+        XmlSchemaType schemaType = null;        
+        Iterator i = null;
+        Input input = operation.getInput();
+
+        if (input != null) {
+            Message msg = input.getMessage();
+            i = msg.getParts().values().iterator();            
+
+            if (msg.getParts().size() == 0) {
+                return false;
+            }
+            
+            Part part = (Part)i.next();
+            
+            if (i.hasNext()) {
+                return true;
+            }
+
+            schemaType = lookUpType(part, xmlSchemaList);
+            if (!part.getName().equals(opName)) {
+                return true;
+            }
+
+            if (!(schemaType instanceof XmlSchemaComplexType)) {
+                return true;
+            }
+
+            XmlSchemaComplexType cpt = (XmlSchemaComplexType)schemaType;
+            return checkComplex(cpt);
+        }
+
+        return false;
+        
+    }
+
+
+    private static boolean outputPartsHaveNoDocWrapper(String opName, Operation operation,
+                                                       List<XmlSchema> xmlSchemaList) throws Exception {
+
+        XmlSchemaType schemaType = null;
+        Iterator i = null;
+        Output output = operation.getOutput();
+
+        if (output != null) {
+            Message msg = output.getMessage();
+            i = msg.getParts().values().iterator();
+
+            if (msg.getParts().size() == 0) {
+                return false;
+            }
+
+            Part part = (Part)i.next();
+
+            if (i.hasNext()) {
+                return true;
+            }
+
+            schemaType = lookUpType(part, xmlSchemaList);
+
+            if (!part.getName().equals(opName)) {
+                return true;
+            }
+
+            if (!(schemaType instanceof XmlSchemaComplexType)) {
+                return true;
+            }
+
+            XmlSchemaComplexType cpt = (XmlSchemaComplexType)schemaType;
+            return checkComplex(cpt);
+        }
+
+        return false;
+
+    }
+
+    private static boolean checkComplex(XmlSchemaComplexType cpt) throws Exception {
+                
+        XmlSchemaParticle particle = (XmlSchemaParticle)cpt.getParticle();
+        if (particle == null) {
+            return true;
+        }
+
+        if (!(particle instanceof XmlSchemaSequence)) {
+            return true;
+        }
+
+        if (cpt.getAttributes().getCount() != 0) {
+            return true;
+        }
+
+        if (particle instanceof XmlSchemaSequence) {
+            XmlSchemaSequence seq = (XmlSchemaSequence)particle;
+            Iterator it = seq.getItems().getIterator();
+            while (it.hasNext()) {
+                if (!(it.next() instanceof XmlSchemaElement)) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }    
+}
\ No newline at end of file

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=426591&r1=426590&r2=426591&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 Fri Jul 28 09:13:28 2006
@@ -98,18 +98,18 @@
     protected static final String DISCRIMINATORTYPES[] 
         = new String[] {"long", "short", "boolean", "char"};
     protected static final Set<String> SUPPORTEDDISTYPES = 
-        new TreeSet<String>(Arrays.asList(DISCRIMINATORTYPES));
-
-    static XmlSchema xmlSchemaType;    
-    static CorbaPrimitiveMap corbaPrimitiveMap;        
-    static String idlNamespace;
+        new TreeSet<String>(Arrays.asList(DISCRIMINATORTYPES));    
+    static final CorbaPrimitiveMap CORBAPRIMITIVEMAP = new CorbaPrimitiveMap();
+    
+    static XmlSchema xmlSchemaType;                   
     static String wsdlFileName;
     static String idlversion = ":1.0";
     static String outputFile;
     static String namespace;
     static String repoString = "IDL:";     
-    static boolean verboseOn;        
-    TypeMappingType typeMappingType;
+    static boolean verboseOn;    
+    String idlNamespace;
+    TypeMappingType typeMappingType;    
     ExtensionRegistry extReg;
     Definition def;
     
@@ -156,9 +156,11 @@
         }
         typeProcessor.setWSDLDefinition(def);
         wsdlParameter = new WSDLParameter();
-        setIdlNamespace(def);
+        if (idlNamespace == null) {
+            setIdlNamespace(def);
+        }
         generateNSPrefix(def, getIdlNamespace(), "ns");
-        corbaPrimitiveMap = new CorbaPrimitiveMap();
+        //corbaPrimitiveMap = new CorbaPrimitiveMap();
 
         typeProcessor.process();
 
@@ -379,6 +381,7 @@
             operationType = (OperationType)extReg.createExtension(BindingOperation.class,
                                                                   CORBAConstants.NE_CORBA_OPERATION);
         } catch (WSDLException wse) {
+            System.out.println("ERROR**************8");
             // Message msg = new Message("FAIL_TO_CREATE_BINDINGOPERATION", LOG);
             // throw new ToolException(msg, wse);
         }
@@ -420,18 +423,39 @@
             CorbaTypeImpl corbaTypeImpl = null;
             typeMappingType.setTargetNamespace(getIdlNamespace());
             Iterator s = xmlSchemaList.iterator();
+            
             while (s.hasNext()) {
                 XmlSchema xmlSchemaTypes = (XmlSchema)s.next();            
-                XmlSchemaObjectTable objs = xmlSchemaTypes.getSchemaTypes();
-                        
-                Iterator i = objs.getValues();
+                XmlSchemaObjectTable objs = xmlSchemaTypes.getSchemaTypes(); 
+                Iterator i = objs.getValues();                
                 while (i.hasNext()) {                
                     XmlSchemaType type = (XmlSchemaType)i.next();
                     corbaTypeImpl = convertSchemaToCorbaType(type, null, null, false);               
-                    if (corbaTypeImpl != null 
-                        && (getLocalType(corbaTypeImpl.getQName()) == null)) {
-                        corbaTypeImpl.setQName(null);
-                        typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
+                    if (corbaTypeImpl != null) { 
+                        //&& (getLocalType(corbaTypeImpl.getQName()) == null)) {
+                        if (corbaTypeImpl.getQName() != null) {
+                            corbaTypeImpl.setQName(null);
+                        }
+                        if (!isDuplicate(corbaTypeImpl)) {
+                            typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
+                        }
+                    }                   
+                }
+                
+                XmlSchemaObjectTable elements = xmlSchemaTypes.getElements();                            
+                Iterator i2 = elements.getValues();                
+                while (i2.hasNext()) {                
+                    XmlSchemaElement el = (XmlSchemaElement)i2.next();                    
+                    corbaTypeImpl = 
+                        convertSchemaToCorbaType(el.getSchemaType(),
+                                                 el.getQName(), el.getSchemaType(), false);               
+                    if (corbaTypeImpl != null) { 
+                        if (corbaTypeImpl.getQName() != null) {
+                            corbaTypeImpl.setQName(null);        
+                        }
+                        if (!isDuplicate(corbaTypeImpl)) {
+                            typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
+                        }
                     }                   
                 }
             }
@@ -455,8 +479,8 @@
 
     public CorbaTypeImpl convertSchemaToCorbaType(XmlSchemaType stype, 
         QName defaultName, XmlSchemaType parent, boolean anonymous) throws Exception {
-        CorbaTypeImpl corbaTypeImpl = null;
-
+        CorbaTypeImpl corbaTypeImpl = null;        
+        
         // need to determine if its a primitive type.
         if (stype.getBaseSchemaType() != null) {
             corbaTypeImpl = processPrimitiveType(stype.getQName());
@@ -533,13 +557,15 @@
             String repoId = repoString + corbaex.getName().replace('.', '/') + idlversion;
             corbaex.setRepositoryID(repoId);
             CorbaTypeImpl corbaTypeImpl = (CorbaTypeImpl)corbaex;
-            corbaTypeImpl.setQName(null);
-            typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
+            corbaTypeImpl.setQName(null);            
+            if (!isDuplicate(corbaTypeImpl)) {
+                typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
+            }
         }
 
         return corbaex;
     }
-
+    
     private org.apache.schemas.yoko.bindings.corba.Exception createCorbaException(QName name,
                                                                                   QName schemaTypeName,
                                                                                   XmlSchemaType stype,
@@ -571,7 +597,7 @@
         }        
         return corbaex;
     }
-    
+                
     protected List processContainerAsMembers(XmlSchemaParticle particle, QName defaultName,
                                              QName schemaTypeName) throws Exception {
         List<MemberType> members = new ArrayList<MemberType>();
@@ -637,13 +663,14 @@
         } else {
             choicename = createQNameTargetNamespace(schemaTypeName.getLocalPart());
         }
+        choicename = checkPrefix(choicename);
 
         CorbaTypeImpl corbatype = createUnion(choicename, choice, defaultName, schemaTypeName);
         String repoId = repoString + corbatype.getQName().getLocalPart().replace('.', '/') 
             + idlversion;
         ((Union)corbatype).setRepositoryID(repoId);                                
 
-        if (!"1".equals(choice.getMaxOccurs()) || !"1".equals(choice.getMinOccurs())) {
+        if (!(choice.getMaxOccurs() == 1) || !(choice.getMinOccurs() == 1)) {
             QName name = createQNameTargetNamespace(corbatype.getQName().getLocalPart() + "Array");
             CorbaTypeImpl arrayType = 
                 createArray(name, corbatype.getQName(), corbatype.getQName(), 
@@ -651,7 +678,9 @@
             
             if (arrayType != null) {
                 arrayType.setQName(null);
-                typeMappingType.getStructOrExceptionOrUnion().add(corbatype);
+                if (!isDuplicate(arrayType)) {
+                    typeMappingType.getStructOrExceptionOrUnion().add(corbatype);
+                }
             }
         }
         return corbatype;
@@ -668,10 +697,10 @@
             membertype = createNillableUnion(name, element.getQName(), elemtype.getQName());
         } else {
             XmlSchemaType st = element.getSchemaType();
-            membertype = convertSchemaToCorbaType(st, element.getQName(), element.getSchemaType(), false);
+            membertype = convertSchemaToCorbaType(st, element.getQName(), st, false);
         }
 
-        if (!"1".equals(element.getMaxOccurs()) || !"1".equals(element.getMinOccurs())) {
+        if (!(element.getMaxOccurs() == 1) || !(element.getMinOccurs() == 1)) {
             QName name = createQNameTargetNamespace(getModulePrefix(membertype) 
                                                     + element.getQName().getLocalPart() + "Array");
 
@@ -681,7 +710,9 @@
 
             if (arraytype != null) {
                 arraytype.setQName(null);
-                typeMappingType.getStructOrExceptionOrUnion().add(arraytype);               
+                if (!isDuplicate(arraytype)) {
+                    typeMappingType.getStructOrExceptionOrUnion().add(arraytype);               
+                }
             }                       
         }
 
@@ -700,6 +731,7 @@
         throws Exception {        
         CorbaTypeImpl type = null;
 
+        schemaTypeName = checkPrefix(schemaTypeName);  
         Struct struct = new Struct();
         struct.setName(schemaTypeName.getLocalPart());
         struct.setQName(schemaTypeName);
@@ -720,27 +752,27 @@
             CorbaTypeImpl atype = createArray(name, type.getQName(), type.getQName(),
                                            seq.getMaxOccurs(), seq.getMinOccurs(), false);
             if (atype != null) {
-                atype.setQName(null);
-                typeMappingType.getStructOrExceptionOrUnion().add(atype);               
+                atype.setQName(null);               
+                if (!isDuplicate(atype)) {
+                    typeMappingType.getStructOrExceptionOrUnion().add(atype);               
+                }
             }
         }
         
-        if (type instanceof Struct) {
-            if (struct.getMember().size() == 0) {               
-                String msgStr =  "Cannot create CORBA Struct" +  struct.getName() 
-                    + "from container with no members";
-                org.objectweb.celtix.common.i18n.Message msg = 
-                    new org.objectweb.celtix.common.i18n.Message(msgStr, LOG);
-                throw new Exception(msg.toString());
-            }
-        }
+        if ((type instanceof Struct) && (struct.getMember().size() == 0)) {
+            String msgStr = "Cannot create CORBA Struct" + struct.getName()
+                            + "from container with no members";
+            org.objectweb.celtix.common.i18n.Message msg = new org.objectweb.celtix.common.i18n.Message(
+                                      msgStr, LOG);
+            throw new Exception(msg.toString());
+        }        
                 
         return type;
     }
     
     private CorbaTypeImpl processPrimitiveType(QName typeName) {
         QName qName = createQNameXmlSchemaNamespace(typeName.getLocalPart());
-        return (CorbaTypeImpl)corbaPrimitiveMap.get(qName);
+        return (CorbaTypeImpl)CORBAPRIMITIVEMAP.get(qName);
     }
 
     private CorbaTypeImpl processElementType(XmlSchemaElement stype, QName defaultName) 
@@ -784,7 +816,7 @@
                     corbaTypeImpl = convertSchemaToCorbaType(restrictionType.getBaseType(), schematypeName,
                                                              stype, false);
                 } else {
-                    corbaTypeImpl = (CorbaTypeImpl)corbaPrimitiveMap.get(restrictionType.getBaseTypeName());
+                    corbaTypeImpl = (CorbaTypeImpl)CORBAPRIMITIVEMAP.get(restrictionType.getBaseTypeName());
                 }
 
                 String maxLength = null;
@@ -841,7 +873,7 @@
                 return itemType;
             }
             QName ltypeName = createQNameXmlSchemaNamespace(ltype.getItemTypeName().getLocalPart());
-            itemType = (CorbaTypeImpl)corbaPrimitiveMap.get(ltypeName);
+            itemType = (CorbaTypeImpl)CORBAPRIMITIVEMAP.get(ltypeName);
             return mapToSequence(name, schematypeName, itemType.getQName(), 0, false);
         } else if (stype.getContent() == null) {
             // elements primitive type
@@ -853,7 +885,7 @@
         return corbaTypeImpl;
 
     }
-
+ 
     private CorbaTypeImpl getLocalType(QName qname) {
         return processPrimitiveType(qname);
     }
@@ -927,8 +959,9 @@
         if (stype instanceof XmlSchemaComplexType) {           
             complex = (XmlSchemaComplexType)stype;
 
-            if (!isLiteralArray(complex))  { 
-                //|| !complex.isOMGUnion()) {
+            if (!isLiteralArray(complex)   
+                && !isOMGUnion(complex) 
+                && !isUnion(complex)) {
                 exception = true;
             }
         }         
@@ -943,35 +976,33 @@
             && (type.getParticle() instanceof XmlSchemaSequence)) {
             XmlSchemaSequence stype = (XmlSchemaSequence)type.getParticle();
                     
-            if (stype.getItems().getCount() == 1) {
-                if (stype.getItems().getIterator().next() 
-                    instanceof XmlSchemaElement) {   
-                    XmlSchemaElement el = (XmlSchemaElement)stype.getItems().getIterator().next();
-                    if (!"1".equals(el.getMaxOccurs())) {
-                        //it's a literal array
-                        array = true;
-                    }
-                }                
+            if ((stype.getItems().getCount() == 1)
+                && (stype.getItems().getIterator().next() instanceof XmlSchemaElement)) {
+                XmlSchemaElement el = (XmlSchemaElement)stype.getItems().getIterator().next();
+                if (!(el.getMaxOccurs() == 1)) {
+                    // it's a literal array
+                    array = true;
+                }
             }
         }
         return array;
     }
     
     /**
-     * Create a CORBA Array or Sequence based on min and max Occurs
-     * If minOccurs == maxOccurs == 1 then log warning and return null.
-     * Else if minOccurs is equal to maxOccurs then create an Array.
-     * Else create a Sequence
+     * Create a CORBA Array or Sequence based on min and max Occurs If minOccurs ==
+     * maxOccurs == 1 then log warning and return null. Else if minOccurs is
+     * equal to maxOccurs then create an Array. Else create a Sequence
      */
     protected CorbaTypeImpl createArray(QName name, QName schematypeName, QName arrayType,
                                         Long maxOccurs, Long minOccurs, boolean anonymous) {
-        if ("unbounded".equals(maxOccurs)) {
+        
+        int max = maxOccurs.intValue();
+        if (max == -1) {
             return mapToSequence(name, schematypeName, arrayType, 0, anonymous);
         }
         
-        int min = minOccurs.intValue();
-        int max = maxOccurs.intValue();
-
+        int min = minOccurs.intValue();        
+        
         if (min == max) {
             if (max == 1) {
                 String msg = "Couldn't Map to Array:" + name + ":minOccurs=" 
@@ -1018,6 +1049,7 @@
                                         boolean anonymous) {
         CorbaTypeImpl corbaTypeImpl = null;
 
+        schematypeName = checkPrefix(schematypeName);
         if (!anonymous) {
             // Create a Sequence
             Sequence corbaSeq = new Sequence();
@@ -1053,7 +1085,7 @@
         } else if (isUnion(complex)) {
             corbatype = processRegularUnion(complex, defaultName);                                           
         } else if (complex.getQName() != null && isIDLObjectType(complex.getQName())) {
-            // process it.
+            // process it.        
         } else {
             // Deal the ComplexType as Struct
             corbatype = processStruct(complex, defaultName);
@@ -1069,10 +1101,10 @@
         QName schematypeName = checkPrefix(complex.getQName());               
 
         if (schematypeName == null) {
-            schematypeName = defaultName;
-            name = createQNameCorbaNamespace(defaultName.getLocalPart() + "Type");
+            schematypeName = checkPrefix(defaultName);
+            name = checkPrefix(createQNameCorbaNamespace(defaultName.getLocalPart()));            
         } else {
-            name = createQNameCorbaNamespace(schematypeName.getLocalPart());
+            name = checkPrefix(createQNameCorbaNamespace(schematypeName.getLocalPart()));            
         }
 
         corbaStruct = new Struct();
@@ -1112,8 +1144,7 @@
     protected Struct processSimpleContentStruct(XmlSchemaSimpleContent simpleContent, 
                                                 QName defaultName, Struct corbaStruct, QName schematypeName)
         throws Exception {        
-        XmlSchemaType base = null;
-        QName baseName = null;
+        XmlSchemaType base = null;        
         List attrMembers = null;
         CorbaTypeImpl basetype = null;
 
@@ -1175,8 +1206,8 @@
     }
     
             
-    protected List processAttributesAsMembers(Iterator attrs) throws Exception {
-        List members = new ArrayList();
+    protected List<MemberType> processAttributesAsMembers(Iterator attrs) throws Exception {
+        List <MemberType>members = new ArrayList<MemberType>();
 
         while (attrs.hasNext()) {
             XmlSchemaAttribute attribute = (XmlSchemaAttribute)attrs.next();
@@ -1233,8 +1264,10 @@
         nilUnion.getUnionbranch().add(branch);       
         
         if (nilUnion != null) {
-            nilUnion.setQName(null);
-            typeMappingType.getStructOrExceptionOrUnion().add(nilUnion);
+            nilUnion.setQName(null);           
+            if (!isDuplicate(nilUnion)) {
+                typeMappingType.getStructOrExceptionOrUnion().add(nilUnion);
+            }
         }        
 
         return nilUnion;
@@ -1242,8 +1275,51 @@
     
     private CorbaTypeImpl processLiteralArray(XmlSchemaComplexType complex, QName defaultName, 
                                               boolean anonymous) throws Exception {
-        // NEED TO DO        
-        return new CorbaTypeImpl();
+        // NEED TO DO    
+        QName name;
+        QName schematypeName = checkPrefix(complex.getQName());
+
+        if (schematypeName == null) {
+            schematypeName = defaultName;
+            name = createQNameCorbaNamespace(defaultName.getLocalPart() + "Type");
+            schematypeName = checkPrefix(schematypeName);
+            name = checkPrefix(name);
+        } else {
+            name = createQNameCorbaNamespace(schematypeName.getLocalPart());
+            name = checkPrefix(name);
+        }
+
+        CorbaTypeImpl arrayType = null;
+        XmlSchemaElement arrayEl = null;
+        if (complex.getParticle() instanceof XmlSchemaSequence) {
+            XmlSchemaSequence seq = (XmlSchemaSequence)complex.getParticle();
+            
+            Iterator iterator = seq.getItems().getIterator();
+            Iterator iter = seq.getItems().getIterator();
+            while (iterator.hasNext()) {
+                if (iter.next() instanceof XmlSchemaElement) {
+                    arrayEl = (XmlSchemaElement)iterator.next();
+                    arrayType = convertSchemaToCorbaType(arrayEl.getSchemaType(), 
+                                                           arrayEl.getQName(), 
+                                                           arrayEl.getSchemaType(), true);
+                }
+            }
+        }
+
+        if (arrayEl.isNillable()) {
+            QName nilunionname = createQNameTargetNamespace(arrayType.getQName().getLocalPart() + "_nil");
+            arrayType = createNillableUnion(nilunionname, arrayEl.getQName(), arrayType.getQName());
+
+        }
+
+        Long maxOccurs = null;
+        Long minOccurs = null;
+        if (arrayEl != null) {
+            maxOccurs = arrayEl.getMaxOccurs();
+            minOccurs = arrayEl.getMinOccurs();
+        }
+
+        return createArray(name, schematypeName, arrayType.getQName(), maxOccurs, minOccurs, anonymous);     
     }
     
     private CorbaTypeImpl processOMGUnion(XmlSchemaComplexType complex, QName defaultName) throws Exception {
@@ -1429,21 +1505,40 @@
 
         return isUnion;
     }
-
+    
+    private boolean isDuplicate(CorbaTypeImpl corbaTypeImpl) {
+        String corbaName = corbaTypeImpl.getName();
+        String corbaType = corbaTypeImpl.getType().getLocalPart();
+        if (!typeMappingType.getStructOrExceptionOrUnion().isEmpty()) {
+            Iterator i = typeMappingType.getStructOrExceptionOrUnion().iterator();
+            while (i.hasNext()) {
+                CorbaTypeImpl type = (CorbaTypeImpl)i.next();
+                if (corbaName.equals(type.getName())
+                                     && corbaType.equals(type.getType().getLocalPart())) {                    
+                    if (corbaTypeImpl.getClass().getName()
+                        .equals(type.getClass().getName())) {                        
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
     
     private QName checkPrefix(QName schematypeName) {
         
         QName name = schematypeName;
         
-        if (name.getPrefix() == null || name.getPrefix().equals("")) {
-            String prefix =  def.getPrefix(name.getNamespaceURI());
+        if ((name != null) && (name.getPrefix() == null || name.getPrefix().equals(""))) {
+            String prefix = def.getPrefix(name.getNamespaceURI());
             if (prefix != null) {
-                return new QName(name.getNamespaceURI(), name.getLocalPart(), 
-                             def.getPrefix(name.getNamespaceURI()));
+                return new QName(name.getNamespaceURI(), name.getLocalPart(), def.getPrefix(name
+                    .getNamespaceURI()));
             } else {
                 return null;
             }
         }
+     
         return name;
     }
     
@@ -1456,12 +1551,15 @@
     }
 
     public void setIdlNamespace(Definition definition) {
-        String tns = definition.getTargetNamespace();
-        if (!tns.endsWith("/")) {
-            tns += "/";
-        }
+            
+        if (idlNamespace == null) {
+            String tns = definition.getTargetNamespace();
+            if (!tns.endsWith("/")) {
+                tns += "/";
+            }
 
-        idlNamespace = tns + "corba/typemap/";
+            idlNamespace = tns + "corba/typemap/";
+        }
     }
 
     public String getIdlNamespace() {
@@ -1580,8 +1678,8 @@
         outputFile = new String(file);
     }
 
-    public void setNamespace(String namespaceName) {
-        namespace = new String(namespaceName);
+    public void setNamespace(String nameSpaceName) {
+        idlNamespace = new String(nameSpaceName);
     }
 
     public void addInterfaceName(String interfaceName) {

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToProcessor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToProcessor.java?rev=426591&r1=426590&r2=426591&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToProcessor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToProcessor.java Fri Jul 28 09:13:28 2006
@@ -149,7 +149,7 @@
                     }
                 }
                 if (schemaElem != null) {
-                    schematype = schemaCol.read(schemaElem);
+                    schematype = schemaCol.read(schemaElem);                      
                     schematypeList.add(schematype);
                 }
             }
@@ -207,7 +207,7 @@
             }
         }
         if (!isSchemaImported(schema)) {
-            schemaList.add(schema);
+            schemaList.add(schema);            
         }
     }
 
@@ -226,7 +226,7 @@
     public List<XmlSchema> getXmlSchemaTypes() {
         return this.schematypeList;
     }
-
+        
     public void setEnvironment(ProcessorEnvironment environement) {
         this.env = environement;
     }

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=426591&r1=426590&r2=426591&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 Fri Jul 28 09:13:28 2006
@@ -19,10 +19,7 @@
 
 package org.apache.yoko.tools.processors;
 
-//import java.io.BufferedReader;
-//import java.io.ByteArrayInputStream;
 import java.io.File;
-//import java.io.InputStreamReader;
 import java.util.Iterator;
 import java.util.List;
 
@@ -64,7 +61,32 @@
     public static void main(String args[]) {
         junit.textui.TestRunner.run(WSDLToCorbaBindingTest.class);
     }
+ 
+    
+    public void testSequenceType() throws Exception {
+        WSDLToCorbaBinding generator = new WSDLToCorbaBinding();
+        String fileName = getClass().getResource("/wsdl/sequencetype.wsdl").toString();
+        generator.setWsdlFile(fileName);
+        generator.addInterfaceName("IACC.Server");
+
+        Definition model = generator.generateCORBABinding();
+        WSDLCorbaFactory wsdlfactory = WSDLCorbaFactory
+            .newInstance("org.apache.yoko.tools.common.WSDLCorbaFactoryImpl");
+        WSDLWriter writer = wsdlfactory.newWSDLWriter();
+        Document document = writer.getDocument(model);
 
+        Element typemap = null;
+        Element root = document.getDocumentElement();
+        for (Node nd = root.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
+            if (Node.ELEMENT_NODE == nd.getNodeType() && ("corba:typeMapping".equals(nd.getNodeName()))) {
+                typemap = (Element)nd;
+            }
+        }
+        assertNotNull(typemap);
+        assertEquals(2, typemap.getElementsByTagName("corba:sequence").getLength());
+        assertEquals(5, typemap.getElementsByTagName("corba:exception").getLength());
+        assertEquals(75, typemap.getElementsByTagName("corba:struct").getLength());
+    }
     
     public void testUnionType() throws Exception {
         WSDLToCorbaBinding generator = new WSDLToCorbaBinding();
@@ -287,7 +309,7 @@
         } finally {
             new File("multipart.idl").deleteOnExit();            
         }
-    }     
+    }
     
     public void testMultipartCORBABindingGeneration() throws Exception {
         WSDLToCorbaBinding generator = new WSDLToCorbaBinding();



Mime
View raw message