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 br...@apache.org on 2006/10/19 14:31:56 UTC

svn commit: r465642 [3/5] - in /incubator/yoko/branches/cxf_port: ./ api/ bindings/ bindings/src/main/java/org/apache/yoko/bindings/corba2/ bindings/src/main/java/org/apache/yoko/bindings/corba2/interceptors/ tools/ tools/src/main/java/org/apache/yoko/...

Modified: incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java?view=diff&rev=465642&r1=465641&r2=465642
==============================================================================
--- incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java (original)
+++ incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaBinding.java Thu Oct 19 07:31:44 2006
@@ -27,7 +27,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.StringTokenizer;
 import java.util.TreeSet;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -51,10 +50,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.wsdl.JAXBExtensionHelper;
 
-import org.apache.schemas.yoko.bindings.corba.Anonarray;
-import org.apache.schemas.yoko.bindings.corba.Anonsequence;
 import org.apache.schemas.yoko.bindings.corba.ArgType;
-import org.apache.schemas.yoko.bindings.corba.Array;
 import org.apache.schemas.yoko.bindings.corba.BindingType;
 import org.apache.schemas.yoko.bindings.corba.CaseType;
 import org.apache.schemas.yoko.bindings.corba.Enum;
@@ -63,14 +59,13 @@
 import org.apache.schemas.yoko.bindings.corba.OperationType;
 import org.apache.schemas.yoko.bindings.corba.ParamType;
 import org.apache.schemas.yoko.bindings.corba.RaisesType;
-import org.apache.schemas.yoko.bindings.corba.Sequence;
 import org.apache.schemas.yoko.bindings.corba.Struct;
 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.XmlSchemaAll;
+import org.apache.ws.commons.schema.XmlSchemaAnnotation;
 import org.apache.ws.commons.schema.XmlSchemaAttribute;
 import org.apache.ws.commons.schema.XmlSchemaChoice;
 import org.apache.ws.commons.schema.XmlSchemaComplexContent;
@@ -91,13 +86,14 @@
 import org.apache.ws.commons.schema.XmlSchemaSimpleTypeList;
 import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
 import org.apache.ws.commons.schema.XmlSchemaType;
-import org.apache.yoko.tools.common.CORBAConstants;
 import org.apache.yoko.tools.common.CorbaPrimitiveMap;
 import org.apache.yoko.tools.common.ReferenceConstants;
 import org.apache.yoko.tools.common.W3CConstants;
+import org.apache.yoko.wsdl.CorbaConstants;
 import org.apache.yoko.wsdl.CorbaTypeImpl;
 
 public class WSDLToCorbaBinding {
+    
     protected static final Logger LOG = LogUtils.getL7dLogger(WSDLToCorbaBinding.class);
         
     protected static final String DISCRIMINATORTYPES[] 
@@ -113,21 +109,24 @@
     static String namespace;
     static String repoString = "IDL:";     
     static boolean verboseOn;    
-    String idlNamespace;
-    TypeMappingType typeMappingType = new TypeMappingType();    
-    ExtensionRegistry extReg;
-    Definition def;
+    protected Definition def;
+    protected String idlNamespace;
+        
+    TypeMappingType typeMappingType;    
+    ExtensionRegistry extReg;   
     
     List<Object> interfaceNames = new ArrayList<Object>();
     Map<Object, Object> bindingNameMap = new HashMap<Object, Object>();
-    String bindingName;
+    String bindingName;    
     WSDLParameter wsdlParameter;
     WSDLTypes wsdltypes;
-    List<Object> bindingNames;
+    List<Object> bindingNames;    
     List<XmlSchema> xmlSchemaList; 
 
     WSDLToTypeProcessor typeProcessor = new WSDLToTypeProcessor();
     
+ 
+    
     public WSDLToCorbaBinding() {            
     }
 
@@ -144,7 +143,7 @@
             extReg = new ExtensionRegistry(); 
             addExtensions(extReg);
             typeProcessor.setExtensionRegistry(extReg);            
-            typeProcessor.parseWSDL(getWsdlFileName());
+            typeProcessor.parseWSDL(getWsdlFileName());           
             def = typeProcessor.getWSDLDefinition();
             generateCORBABinding(def);
         } catch (Exception ex) {
@@ -284,10 +283,10 @@
         }
 
         // jwsdl model should have all other bindings in it.
-        String pfx = definition.getPrefix(CORBAConstants.NU_WSDL_CORBA);
+        String pfx = definition.getPrefix(CorbaConstants.NU_WSDL_CORBA);
         if (pfx == null) {
             pfx = new String("corba");
-            def.addNamespace(pfx, CORBAConstants.NU_WSDL_CORBA);
+            def.addNamespace(pfx, CorbaConstants.NU_WSDL_CORBA);
         }
 
         Binding binding = null;
@@ -299,11 +298,11 @@
         mapBindingToInterface(portType.getQName().getLocalPart(), bname);
         BindingType bindingType = null;
         
-        addCorbaTypes(def);
+        addCorbaTypeMap(def);
         
         try {
             bindingType = (BindingType)extReg
-                .createExtension(Binding.class, CORBAConstants.NE_CORBA_BINDING);
+                .createExtension(Binding.class, CorbaConstants.NE_CORBA_BINDING);
             bindingType.setRepositoryID(repoString
                                         + binding.getPortType().getQName().getLocalPart().replace('.', '/')
                                         + idlversion);
@@ -367,12 +366,12 @@
             JAXBExtensionHelper.addExtensions(extReg, Port.class,
                                               org.apache.schemas.yoko.bindings.corba.AddressType.class);
 
-            extReg.mapExtensionTypes(Binding.class, CORBAConstants.NE_CORBA_BINDING, BindingType.class);
-            extReg.mapExtensionTypes(BindingOperation.class, CORBAConstants.NE_CORBA_OPERATION,
+            extReg.mapExtensionTypes(Binding.class, CorbaConstants.NE_CORBA_BINDING, BindingType.class);
+            extReg.mapExtensionTypes(BindingOperation.class, CorbaConstants.NE_CORBA_OPERATION,
                                      org.apache.schemas.yoko.bindings.corba.OperationType.class);
-            extReg.mapExtensionTypes(Definition.class, CORBAConstants.NE_CORBA_TYPEMAPPING,
+            extReg.mapExtensionTypes(Definition.class, CorbaConstants.NE_CORBA_TYPEMAPPING,
                                      TypeMappingType.class);
-            extReg.mapExtensionTypes(Port.class, CORBAConstants.NE_CORBA_ADDRESS,
+            extReg.mapExtensionTypes(Port.class, CorbaConstants.NE_CORBA_ADDRESS,
                                      org.apache.schemas.yoko.bindings.corba.AddressType.class);
         } catch (javax.xml.bind.JAXBException ex) {
             LOG.log(Level.SEVERE, "Failing to serialize/deserialize extensions", ex);
@@ -386,7 +385,7 @@
         OperationType operationType = null;
         try {
             operationType = (OperationType)extReg.createExtension(BindingOperation.class,
-                                                                  CORBAConstants.NE_CORBA_OPERATION);
+                                                                  CorbaConstants.NE_CORBA_OPERATION);
         } catch (WSDLException wse) {            
             LOG.log(Level.SEVERE, "Failed to create a Binding Operation extension", wse);
             throw new Exception(LOG.toString(), wse);
@@ -421,13 +420,34 @@
         bo.addExtensibilityElement(operationType);
     }
 
-    private void addCorbaTypes(Definition definition) throws Exception {        
-        try {
-            typeMappingType = (TypeMappingType)extReg
-                .createExtension(Definition.class, CORBAConstants.NE_CORBA_TYPEMAPPING);
+    
+    private void addCorbaTypeMap(Definition definition) throws Exception {
+
+        Iterator t = definition.getExtensibilityElements().iterator();
+        Iterator j = definition.getExtensibilityElements().iterator();
+        while (t.hasNext()) {
+            if (j.next() instanceof TypeMappingType) {
+                typeMappingType = (TypeMappingType)t.next();
+                break;
+            }
+        }
 
-            CorbaTypeImpl corbaTypeImpl = null;
+        if (typeMappingType == null) {
+            typeMappingType = (TypeMappingType)extReg.createExtension(Definition.class,
+                                                                      CorbaConstants.NE_CORBA_TYPEMAPPING);
             typeMappingType.setTargetNamespace(getIdlNamespace());
+            addCorbaTypes(definition);
+            definition.addExtensibilityElement(typeMappingType);
+
+        } else {
+            addCorbaTypes(definition);
+        }
+    }
+    
+    private void addCorbaTypes(Definition definition) throws Exception {        
+
+        try {
+            CorbaTypeImpl corbaTypeImpl = null;            
             Iterator s = xmlSchemaList.iterator();
             
             while (s.hasNext()) {
@@ -436,72 +456,68 @@
                 Iterator i = objs.getValues();                
                 while (i.hasNext()) {                
                     XmlSchemaType type = (XmlSchemaType)i.next();
-                    boolean anonymous = isAnonymous(type.getName());
-                    corbaTypeImpl = convertSchemaToCorbaType(type, null, null, anonymous);               
+                    boolean anonymous = wsdltypes.isAnonymous(type.getName());
+                    corbaTypeImpl = convertSchemaToCorbaType(type, type.getQName(), null, 
+                                                             null, anonymous);                    
                     if (corbaTypeImpl != 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();
-                    boolean anonymous = false;
-                    if (el.getSchemaType() == null) {
-                        anonymous = true;
-                    } else {
-                        anonymous = isAnonymous(el.getSchemaType().getName());
-                    }
-                    
-                    if (el.getSchemaType() != null) {
-                        corbaTypeImpl = 
-                            convertSchemaToCorbaType(el.getSchemaType(),
-                                                 el.getQName(), el.getSchemaType(), anonymous);
-                        if (corbaTypeImpl != null) { 
-                            if (corbaTypeImpl.getQName() != null) {
-                                corbaTypeImpl.setQName(null);        
-                            }
-                            if (!isDuplicate(corbaTypeImpl)) {
-                                typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
-                            }
-                        }
+                        } 
                     }                   
                 }
+                addCorbaElements(corbaTypeImpl, xmlSchemaTypes);                
             }
-            definition.addExtensibilityElement(typeMappingType);
+            //definition.addExtensibilityElement(typeMappingType);
         } catch (WSDLException ex) {
             ex.printStackTrace();
         }
     }          
 
-    // checks if the type is an anonymous type.
-    private boolean isAnonymous(String typeName) {
-        boolean anonymous = false;
-        
-        if (typeName == null) {
-            anonymous = true;
-        } else {                                                  
-            StringTokenizer strtok = new StringTokenizer(typeName, ".");
-            for (int i = 0; strtok.hasMoreTokens(); ++i) {
-                String token = strtok.nextToken();
-                if (token.startsWith("_")) {                    
-                    if (Character.isDigit(token.charAt(1))) {
-                        anonymous = true;
-                        break;
-                    }                    
-                }
+    
+    private void addCorbaElements(CorbaTypeImpl corbaTypeImpl, 
+                                  XmlSchema xmlSchemaTypes) throws Exception {
+        XmlSchemaObjectTable elements = xmlSchemaTypes.getElements();                            
+        Iterator i2 = elements.getValues();                
+        while (i2.hasNext()) {                
+            XmlSchemaElement el = (XmlSchemaElement)i2.next();
+            boolean anonymous = false;
+            if (el.getSchemaType() == null) {
+                anonymous = true;
+            } else {
+                anonymous = wsdltypes.isAnonymous(el.getSchemaType().getName());
             }
+            
+            if (el.getSchemaType() != null) {
+                XmlSchemaAnnotation annotation = null;
+                if (el.getAnnotation() != null) {
+                    annotation = el.getAnnotation();
+                }
+                corbaTypeImpl = 
+                    convertSchemaToCorbaType(el.getSchemaType(),
+                                         el.getQName(), el.getSchemaType(), 
+                                         annotation, anonymous);
+                if (el.isNillable()) {                            
+                    QName uname =  
+                        createQNameCorbaNamespace(corbaTypeImpl.getQName().getLocalPart() + "_nil");
+                    corbaTypeImpl = createNillableUnion(uname, 
+                        checkPrefix(el.getQName()), checkPrefix(corbaTypeImpl.getQName()));
+                } 
+                if (corbaTypeImpl != null) { 
+                    if (corbaTypeImpl.getQName() != null) {
+                        corbaTypeImpl.setQName(null);        
+                    }
+                    if (!isDuplicate(corbaTypeImpl)) {
+                        typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
+                    }
+                }
+            }                   
         }
-        return anonymous;
-    }
+    }       
     
-    private boolean queryBinding(Definition definition, QName bqname) {
+    protected boolean queryBinding(Definition definition, QName bqname) {
         Map bindings = definition.getBindings();
         Iterator i = bindings.values().iterator();
         while (i.hasNext()) {
@@ -514,7 +530,8 @@
     }
 
     public CorbaTypeImpl convertSchemaToCorbaType(XmlSchemaType stype, 
-        QName defaultName, XmlSchemaType parent, boolean anonymous) throws Exception {
+        QName defaultName, XmlSchemaType parent, XmlSchemaAnnotation annotation, 
+        boolean anonymous) throws Exception {
         CorbaTypeImpl corbaTypeImpl = null;        
         
         // need to determine if its a primitive type.
@@ -523,9 +540,11 @@
         }
 
         if (stype instanceof XmlSchemaComplexType) {            
-            return corbaTypeImpl = processComplexType((XmlSchemaComplexType)stype, defaultName, anonymous);
+            return corbaTypeImpl = processComplexType((XmlSchemaComplexType)stype, 
+                                                      defaultName, annotation, anonymous);
         } else if (stype instanceof XmlSchemaSimpleType) {            
-            return corbaTypeImpl = processSimpleType((XmlSchemaSimpleType)stype, defaultName, anonymous);
+            return corbaTypeImpl = processSimpleType((XmlSchemaSimpleType)stype, 
+                                                     defaultName, anonymous);
         }  else if (xmlSchemaType.getElementByName(stype.getQName()) != null) {
             XmlSchemaElement el = xmlSchemaType.getElementByName(stype.getQName());
             return corbaTypeImpl = processElementType(el, defaultName);
@@ -561,7 +580,7 @@
                 corbaex.setName(schemaType.getName());
                 corbaex.setQName(schemaType.getQName());
                 CorbaTypeImpl corbaTypeImpl = 
-                    convertSchemaToCorbaType(schemaType, part.getTypeName(), null, false);
+                    convertSchemaToCorbaType(schemaType, part.getTypeName(), null, null, false);
                 if (corbaTypeImpl != null) {
                     MemberType member = new MemberType();
                     member.setName(corbaTypeImpl.getQName().getLocalPart());
@@ -595,8 +614,8 @@
             CorbaTypeImpl corbaTypeImpl = (CorbaTypeImpl)corbaex;
             corbaTypeImpl.setQName(null);            
             if (!isDuplicate(corbaTypeImpl)) {
-                CorbaTypeImpl dup = isDuplicateException(corbaTypeImpl);
-                if (dup != null) {
+                CorbaTypeImpl dup = isDuplicateException(corbaTypeImpl);               
+                if (dup != null) {                    
                     typeMappingType.getStructOrExceptionOrUnion().remove(dup);
                     typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
                 } else {
@@ -664,8 +683,8 @@
                 CorbaTypeImpl memberType = processSequenceType(sequence, defaultName, schemaTypeName);
                 QName typeName = memberType.getQName();
                 if (memberType instanceof Struct) {
-                    memberType.setQName(null);           
-                    if (!isDuplicate(memberType)) {
+                    memberType.setQName(null);                  
+                    if (memberType != null && !isDuplicate(memberType)) {
                         typeMappingType.getStructOrExceptionOrUnion().add(memberType);
                     }                    
                 }
@@ -734,7 +753,7 @@
                     choice.getMaxOccurs(), choice.getMinOccurs(), false);
             
             if (arrayType != null) {
-                arrayType.setQName(null);
+                arrayType.setQName(null);                
                 if (!isDuplicate(arrayType)) {
                     typeMappingType.getStructOrExceptionOrUnion().add(arrayType);
                 }
@@ -745,34 +764,44 @@
     
     private CorbaTypeImpl processLocalElement(XmlSchemaElement element) throws Exception {
         CorbaTypeImpl membertype = new CorbaTypeImpl();
+        CorbaTypeImpl memtype = new CorbaTypeImpl();
 
         QName memName = null;
         if (element.isNillable()) {
 
             CorbaTypeImpl elemtype = convertSchemaToCorbaType(element.getSchemaType(), element.getQName(),
-                                                              element.getSchemaType(), true);
-            QName name = createQNameTargetNamespace(elemtype.getQName().getLocalPart() + "_nil");            
-            membertype = createNillableUnion(name, element.getQName(), 
+                                                              element.getSchemaType(), null, true);
+            QName name = createQNameTargetNamespace(elemtype.getQName().getLocalPart() + "_nil");
+            QName elName = checkPrefix(element.getQName());
+            if (elName ==  null) {
+                elName = createQNameTargetNamespace(element.getQName().getLocalPart());
+            }
+            memtype = createNillableUnion(name, elName, 
                                              elemtype.getQName());
-            memName = createQNameCorbaNamespace(membertype.getQName().getLocalPart());            
-            if (membertype != null) {
-                membertype.setQName(null);           
-                if (!isDuplicate(membertype)) {
-                    typeMappingType.getStructOrExceptionOrUnion().add(membertype);
+            memName = createQNameCorbaNamespace(memtype.getQName().getLocalPart());
+                                    
+            if (memtype != null) {                          
+                memtype.setQName(null);
+                if (!isDuplicate(memtype)) {
+                    typeMappingType.getStructOrExceptionOrUnion().add(memtype);
                 }
             }
+            membertype.setQName(memName);
+            membertype.setName(memtype.getName());
+            membertype.setType(memtype.getType());
+            
         } else {
             // Need TO DO
             // Need to check if its referencing a type first refname=""
             //if (element.getRefName()
             if (element.getSchemaType() != null) {
                 XmlSchemaType st = element.getSchemaType();
-                boolean anonymous = isAnonymous(st.getName());            
-                membertype = convertSchemaToCorbaType(st, element.getQName(), st, anonymous);
-            } else {
+                boolean anonymous = wsdltypes.isAnonymous(st.getName());            
+                membertype = convertSchemaToCorbaType(st, element.getQName(), st, null, anonymous);
+            } else {                
                 if (element.getSchemaTypeName() != null) {
-                    QName elName = checkPrefix(element.getSchemaTypeName());
-                    membertype = getLocalType(elName);
+                    QName name = checkPrefix(element.getSchemaTypeName());
+                    membertype = getLocalType(name);                    
                 }
             }
         }
@@ -801,7 +830,7 @@
             membertype.setName(arraytype.getName());
             membertype.setQName(arraytype.getQName());
             membertype.setType(arraytype.getType());
-            
+                        
             if (arraytype != null) {                
                 arraytype.setQName(null);
                 if (!isDuplicate(arraytype)) {
@@ -813,6 +842,22 @@
         return membertype;
     }
 
+    
+    public XmlSchemaType getSchemaType(QName name) throws Exception {                
+        XmlSchemaType type = null;
+        Iterator i = xmlSchemaList.iterator();
+        while (i.hasNext()) {
+            XmlSchema xmlSchema = (XmlSchema)i.next();      
+            String nspace = xmlSchema.getTargetNamespace();
+            QName tname = createQName(nspace, name.getLocalPart(), "xsd");
+            type = findSchemaType(tname);                            
+            if (type != null) {
+                break;
+            }
+        }       
+        return type;
+    }
+          
     private String getModulePrefix(CorbaTypeImpl type) {
         String name = type.getQName().getLocalPart();
         int dotPos = name.lastIndexOf(".");
@@ -853,6 +898,7 @@
             QName name = createQNameTargetNamespace(type.getQName().getLocalPart() + "Array");            
             CorbaTypeImpl atype = createArray(name, type.getQName(), type.getQName(),
                                            seq.getMaxOccurs(), seq.getMinOccurs(), false);
+            
             if (atype != null) {
                 atype.setQName(null);               
                 if (!isDuplicate(atype)) {
@@ -933,7 +979,7 @@
                 if (attribute.getSchemaType() != null) {                    
                     attType = convertSchemaToCorbaType(attribute.getSchemaType(), 
                                                        attribute.getQName(), 
-                                              attribute.getSchemaType(), true);
+                                              attribute.getSchemaType(), null, true);                   
                     if (attType != null) {
                         QName typeName = attType.getQName();
                         attType.setQName(null);           
@@ -961,7 +1007,7 @@
             } else {
                 if (attribute.getSchemaType() != null) {
                     membertype = convertSchemaToCorbaType(attribute.getSchemaType(), attribute.getQName(), 
-                                                      attribute.getSchemaType(), false);
+                                                      attribute.getSchemaType(), null, false);
                 } else {
                     membertype = processPrimitiveType(attribute.getSchemaTypeName());
                 }
@@ -1001,11 +1047,13 @@
             schematypeName = createQNameTargetNamespace(stype.getName());
         }
 
-        return convertSchemaToCorbaType(stype.getSchemaType(), schematypeName, stype.getSchemaType(), false);
+        return convertSchemaToCorbaType(stype.getSchemaType(), schematypeName, 
+                                        stype.getSchemaType(), null, false);
 
     }
 
-    private CorbaTypeImpl processSimpleType(XmlSchemaSimpleType stype, QName defaultName, boolean anonymous)
+    private CorbaTypeImpl processSimpleType(XmlSchemaSimpleType stype, QName defaultName, 
+                                            boolean anonymous)
         throws Exception {
 
         CorbaTypeImpl corbaTypeImpl = null;
@@ -1026,19 +1074,20 @@
             XmlSchemaSimpleTypeList ltype = (XmlSchemaSimpleTypeList)stype.getContent();
             CorbaTypeImpl itemType = null;
             if (ltype.getItemType() != null) {
-                itemType = convertSchemaToCorbaType(ltype.getItemType(), name, stype, false);
+                itemType = convertSchemaToCorbaType(ltype.getItemType(), name, stype, null, false);
                 if (itemType != null) {
-                    return mapToSequence(name, schematypeName, itemType.getQName(), 0, false);
+                    return wsdltypes.mapToSequence(name, checkPrefix(schematypeName), 
+                                                   itemType.getQName(), 0, false);
                 }
                 return itemType;
             }
             QName ltypeName = createQNameXmlSchemaNamespace(ltype.getItemTypeName().getLocalPart());
             itemType = processPrimitiveType(ltypeName);
-            return mapToSequence(name, schematypeName, itemType.getQName(), 0, false);
+            return wsdltypes.mapToSequence(name, checkPrefix(schematypeName), itemType.getQName(), 0, false);
         } else if (stype.getContent() == null) {
             // elements primitive type
             QName stypeName = createQNameXmlSchemaNamespace(stype.getName());
-            corbaTypeImpl = getLocalType(stypeName);
+            corbaTypeImpl = getLocalType(stypeName);            
         } else {
             System.out.println("SimpleType Union Not Supported in CORBA Binding");
         }
@@ -1058,35 +1107,35 @@
         
         QName baseName = checkPrefix(restrictionType.getBaseTypeName());
         
+        String maxLength = null;
+        String length = null;
+
+        Iterator i = restrictionType.getFacets().getIterator();
+        while (i.hasNext()) {
+            XmlSchemaFacet val = (XmlSchemaFacet)i.next();
+            if (val instanceof XmlSchemaMaxLengthFacet) {                
+                maxLength = val.getValue().toString();
+            }
+            if (val instanceof XmlSchemaLengthFacet) {
+                length = val.getValue().toString();
+            }
+        }
+        
         if (isEnumeration(restrictionType)) {
             corbaTypeImpl = createCorbaEnum(restrictionType, name, schematypeName);
         } else {
             if (restrictionType.getBaseType() != null) {
                 corbaTypeImpl = convertSchemaToCorbaType(restrictionType.getBaseType(), schematypeName,
-                                                         stype, false);
+                                                         stype, null, false);
             } else {                
                 corbaTypeImpl = processPrimitiveType(baseName);                
                 if (corbaTypeImpl == null) {
                     XmlSchemaType schematype = findSchemaType(baseName);
                     corbaTypeImpl = convertSchemaToCorbaType(schematype, schematypeName,
-                                                             schematype, false);                    
+                                                             schematype, null, false); 
                 }
             }
 
-            String maxLength = null;
-            String length = null;
-
-            Iterator i = restrictionType.getFacets().getIterator();
-            while (i.hasNext()) {
-                XmlSchemaFacet val = (XmlSchemaFacet)i.next();
-                if (val instanceof XmlSchemaMaxLengthFacet) {                
-                    maxLength = val.getValue().toString();
-                }
-                if (val instanceof XmlSchemaLengthFacet) {
-                    length = val.getValue().toString();
-                }
-            }
-            
             if (corbaTypeImpl != null) {
                 if (corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_STRING)
                     || (baseName.equals(W3CConstants.NT_SCHEMA_STRING))) {                
@@ -1095,19 +1144,19 @@
                 } else if (corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_DECIMAL)
                     || (baseName.equals(W3CConstants.NT_SCHEMA_DECIMAL))) {                
                     corbaTypeImpl = wsdltypes.processDecimalType(restrictionType, name, 
-                                                                 corbaTypeImpl, anonymous);
+                                                             corbaTypeImpl, anonymous);
                 } else if ((corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_BASE64))
                     || (baseName.equals(W3CConstants.NT_SCHEMA_BASE64))
                     || (corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_HBIN))
                     || (corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_HBIN))) {                
-                    corbaTypeImpl = wsdltypes.processBase64Type(corbaTypeImpl, name, maxLength, length);
-                }
+                    corbaTypeImpl = wsdltypes.processBase64Type(corbaTypeImpl, 
+                                                                name, maxLength, length);          
+                }            
             }
         }
         
         return corbaTypeImpl;
-    }
-        
+    }               
  
     private CorbaTypeImpl getLocalType(QName qname) {
         return processPrimitiveType(qname);
@@ -1189,7 +1238,7 @@
             }
             if (schemaType != null) {
                 return schemaType;
-            }
+            } 
         }            
         return schemaType;
     }
@@ -1224,9 +1273,9 @@
                 if (!(el.getMaxOccurs() == 1)) {
                     // it's a literal array
                     array = true;
-                }
+                }                
                 if (el.getMaxOccurs() == 1 && el.getMinOccurs() == 1) {
-                    if (type.getName() != null &&  isAnonymous(type.getName())) {                
+                    if (type.getName() != null &&  wsdltypes.isAnonymous(type.getName())) {                
                         array = true;
                     }
                 }
@@ -1245,7 +1294,7 @@
         
         int max = maxOccurs.intValue();
         if (max == -1) {
-            return mapToSequence(name, schematypeName, arrayType, 0, anonymous);
+            return wsdltypes.mapToSequence(name, schematypeName, arrayType, 0, anonymous);
         }
         
         int min = minOccurs.intValue();        
@@ -1258,77 +1307,19 @@
                     LOG.log(Level.WARNING, msg.toString());
                     return null;
                 } else {
-                    return mapToArray(name, schematypeName, arrayType, max, anonymous);
+                    return wsdltypes.mapToArray(name, checkPrefix(schematypeName), arrayType, max, anonymous);
                 }
             } else {
-                return mapToArray(name, schematypeName, arrayType, max, anonymous);
+                return wsdltypes.mapToArray(name, checkPrefix(schematypeName), arrayType, max, anonymous);
             }
         } else {
-            return mapToSequence(name, schematypeName, arrayType, max, anonymous);
-        }
-    }
-
-    private CorbaTypeImpl mapToArray(QName name, QName schematypeName, QName arrayType, int bound,
-                                 boolean anonymous) {
-        CorbaTypeImpl corbatype = null;
-        
-        schematypeName = checkPrefix(schematypeName);
-
-        if (!anonymous) {
-            //Create an Array
-            Array corbaArray = new Array();
-            corbaArray.setName(name.getLocalPart());
-            corbaArray.setType(schematypeName);
-            corbaArray.setElemtype(arrayType);
-            corbaArray.setBound(bound);
-            corbaArray.setRepositoryID(repoString + name.getLocalPart().replace('.', '/') + idlversion);
-            corbaArray.setQName(name);            
-            corbatype = corbaArray;
-        } else {
-            //Create an Anonymous Array
-            Anonarray corbaArray = new Anonarray();
-            corbaArray.setName(name.getLocalPart());
-            corbaArray.setType(schematypeName);            
-            corbaArray.setElemtype(arrayType);
-            corbaArray.setBound(bound);
-            corbaArray.setQName(name);                        
-            corbatype = corbaArray;
-        }
-        
-        return corbatype;
-    }
-
-
-    private CorbaTypeImpl mapToSequence(QName name, QName schematypeName, QName arrayType, int bound,
-                                        boolean anonymous) {
-        CorbaTypeImpl corbaTypeImpl = null;
-
-        schematypeName = checkPrefix(schematypeName);
-        if (!anonymous) {
-            // Create a Sequence
-            Sequence corbaSeq = new Sequence();
-            corbaSeq.setName(name.getLocalPart());
-            corbaSeq.setQName(name);
-            corbaSeq.setType(schematypeName);
-            corbaSeq.setElemtype(arrayType);
-            corbaSeq.setBound(bound);
-            corbaSeq.setRepositoryID(repoString + name.getLocalPart().replace('.', '/') + idlversion);
-            corbaTypeImpl = corbaSeq;
-        } else {
-            // Create a Anonymous Sequence
-            Anonsequence corbaSeq = new Anonsequence();
-            corbaSeq.setName(name.getLocalPart());
-            corbaSeq.setQName(name);
-            corbaSeq.setType(schematypeName);
-            corbaSeq.setElemtype(arrayType);
-            corbaSeq.setBound(bound);
-
-            corbaTypeImpl = corbaSeq;
+            return wsdltypes.mapToSequence(name, checkPrefix(schematypeName), arrayType, max, anonymous);
         }
-        return corbaTypeImpl;
     }
 
+    
     private CorbaTypeImpl processComplexType(XmlSchemaComplexType complex, QName defaultName, 
+                                             XmlSchemaAnnotation annotation, 
                                              boolean anonymous) throws Exception {
         CorbaTypeImpl corbatype = new CorbaTypeImpl();
 
@@ -1339,7 +1330,9 @@
         } else if (wsdltypes.isUnion(complex)) {
             corbatype = processRegularUnion(complex, defaultName);                                           
         } else if (complex.getQName() != null && isIDLObjectType(complex.getQName())) {
-            // process it.                
+            // process it.
+            corbatype = wsdltypes.processObject(def, complex, annotation, checkPrefix(complex.getQName()), 
+                                                defaultName, idlNamespace);
         } else {
             // Deal the ComplexType as Struct
             corbatype = processStruct(complex, defaultName);
@@ -1348,8 +1341,7 @@
         return corbatype;
     }
     
-      
-
+        
     private CorbaTypeImpl processStruct(XmlSchemaComplexType complex, QName defaultName)
         throws Exception {
         QName name;
@@ -1425,9 +1417,9 @@
         } else if (simpleContent.getContent() instanceof XmlSchemaSimpleContentRestriction) {
             XmlSchemaSimpleContentRestriction restrict 
                 = (XmlSchemaSimpleContentRestriction)simpleContent.getContent();
-            basetype = convertSchemaToCorbaType(base, base.getQName(), base, false);
+            basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
             base = restrict.getBaseType();
-            basetype = convertSchemaToCorbaType(base, base.getQName(), base, false);
+            basetype = convertSchemaToCorbaType(base, base.getQName(), base, null, false);
             MemberType basemember = new MemberType();
             basemember.setName("_simpleTypeValue");
             basemember.setIdltype(basetype.getType());
@@ -1448,7 +1440,7 @@
 
         return corbaStruct;
     }
-
+    
     protected Struct processComplexContentStruct(XmlSchemaComplexContent complex, QName defaultName,
                                                  Struct corbaStruct, QName schematypeName)
         throws Exception {        
@@ -1559,7 +1551,7 @@
         nilUnion.setName(name.getLocalPart());
         nilUnion.setType(schemaType);
         nilUnion.setQName(name);
-        nilUnion.setDiscriminator(CORBAConstants.NT_CORBA_BOOLEAN);
+        nilUnion.setDiscriminator(CorbaConstants.NT_CORBA_BOOLEAN);
         String id = repoString + nilUnion.getQName().getLocalPart().replace('.', '/') + idlversion;
         nilUnion.setRepositoryID(id);
 
@@ -1601,10 +1593,13 @@
             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);
+                    arrayEl = (XmlSchemaElement)iterator.next();
+                    XmlSchemaType atype = arrayEl.getSchemaType();
+                    if (atype == null) {
+                        atype = getSchemaType(arrayEl.getSchemaTypeName());
+                    }
+                    arrayType = convertSchemaToCorbaType(atype, arrayEl.getQName(), 
+                                                         atype, null, true);
                     typeName = arrayType.getQName();
                 }
             }
@@ -1670,7 +1665,7 @@
         }
 
         CorbaTypeImpl disctype = convertSchemaToCorbaType(discEl.getSchemaType(), discEl.getQName(), discEl
-            .getSchemaType(), false);
+            .getSchemaType(), null, false);
         corbaUnion.setDiscriminator(disctype.getQName());
 
         List fields = processContainerAsMembers(choice, defaultName, schematypeName);
@@ -1745,7 +1740,7 @@
         corbaUnion.setRepositoryID(id); 
 
         //Set Integer as Discriminator
-        corbaUnion.setDiscriminator(CORBAConstants.NT_CORBA_LONG);
+        corbaUnion.setDiscriminator(CorbaConstants.NT_CORBA_LONG);
 
         List fields = processContainerAsMembers(choice, defaultName, schematypeName);
 
@@ -1763,15 +1758,20 @@
         
     
         
-    private boolean isDuplicate(CorbaTypeImpl corbaTypeImpl) {
+    private boolean isDuplicate(CorbaTypeImpl corbaTypeImpl) {        
         String corbaName = corbaTypeImpl.getName();
-        String corbaType = corbaTypeImpl.getType().getLocalPart();
+        QName corbaType = corbaTypeImpl.getType();
+        
+        QName primName = createQNameXmlSchemaNamespace(corbaName);
+        if ((CorbaTypeImpl)CORBAPRIMITIVEMAP.get(primName) != null) {              
+            return true;
+        }        
         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())) {                    
+                    && corbaType.getLocalPart().equals(type.getType().getLocalPart())) {
                     if (corbaTypeImpl.getClass().getName()
                         .equals(type.getClass().getName())) {                        
                         return true;
@@ -1782,6 +1782,7 @@
         return false;
     }
     
+    
     private CorbaTypeImpl isDuplicateException(CorbaTypeImpl corbaTypeImpl) {
         CorbaTypeImpl duplicate = null;
         String corbaName = corbaTypeImpl.getName();
@@ -1801,7 +1802,7 @@
         return duplicate;
     }
     
-    private QName checkPrefix(QName schematypeName) {
+    protected QName checkPrefix(QName schematypeName) {
         
         QName name = schematypeName;
         

Modified: incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java?view=diff&rev=465642&r1=465641&r2=465642
==============================================================================
--- incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java (original)
+++ incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToIDLAction.java Thu Oct 19 07:31:44 2006
@@ -40,6 +40,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.wsdl.JAXBExtensionHelper;
 
+import org.apache.schemas.yoko.bindings.corba.Alias;
 import org.apache.schemas.yoko.bindings.corba.Anonarray;
 import org.apache.schemas.yoko.bindings.corba.Anonfixed;
 import org.apache.schemas.yoko.bindings.corba.Anonsequence;
@@ -48,6 +49,7 @@
 import org.apache.schemas.yoko.bindings.corba.Array;
 import org.apache.schemas.yoko.bindings.corba.BindingType;
 import org.apache.schemas.yoko.bindings.corba.CaseType;
+import org.apache.schemas.yoko.bindings.corba.Const;
 import org.apache.schemas.yoko.bindings.corba.Enum;
 import org.apache.schemas.yoko.bindings.corba.Enumerator;
 import org.apache.schemas.yoko.bindings.corba.Fixed;
@@ -59,13 +61,13 @@
 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.IdlAnonArray;
 import org.apache.yoko.tools.common.idltypes.IdlAnonFixed;
 import org.apache.yoko.tools.common.idltypes.IdlAnonSequence;
 import org.apache.yoko.tools.common.idltypes.IdlArray;
 import org.apache.yoko.tools.common.idltypes.IdlAttribute;
+import org.apache.yoko.tools.common.idltypes.IdlConst;
 import org.apache.yoko.tools.common.idltypes.IdlDefn;
 import org.apache.yoko.tools.common.idltypes.IdlEnum;
 import org.apache.yoko.tools.common.idltypes.IdlEnumerator;
@@ -82,10 +84,12 @@
 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.IdlTypedef;
 import org.apache.yoko.tools.common.idltypes.IdlUnion;
 import org.apache.yoko.tools.common.idltypes.IdlUnionBranch;
 import org.apache.yoko.tools.utils.FileOutputStreamFactory;
 import org.apache.yoko.tools.utils.OutputStreamFactory;
+import org.apache.yoko.wsdl.CorbaConstants;
 import org.apache.yoko.wsdl.CorbaTypeImpl;
 
 public class WSDLToIDLAction {
@@ -129,6 +133,7 @@
             throw new Exception(msg.toString());
         }
         generateIDL(def, binding);
+        
     }
 
     
@@ -143,12 +148,12 @@
             JAXBExtensionHelper.addExtensions(extReg, Port.class,
                                               org.apache.schemas.yoko.bindings.corba.AddressType.class);
 
-            extReg.mapExtensionTypes(Binding.class, CORBAConstants.NE_CORBA_BINDING, BindingType.class);
-            extReg.mapExtensionTypes(BindingOperation.class, CORBAConstants.NE_CORBA_OPERATION,
+            extReg.mapExtensionTypes(Binding.class, CorbaConstants.NE_CORBA_BINDING, BindingType.class);
+            extReg.mapExtensionTypes(BindingOperation.class, CorbaConstants.NE_CORBA_OPERATION,
                                      org.apache.schemas.yoko.bindings.corba.OperationType.class);
-            extReg.mapExtensionTypes(Definition.class, CORBAConstants.NE_CORBA_TYPEMAPPING,
+            extReg.mapExtensionTypes(Definition.class, CorbaConstants.NE_CORBA_TYPEMAPPING,
                                      TypeMappingType.class);
-            extReg.mapExtensionTypes(Port.class, CORBAConstants.NE_CORBA_ADDRESS,
+            extReg.mapExtensionTypes(Port.class, CorbaConstants.NE_CORBA_ADDRESS,
                                      org.apache.schemas.yoko.bindings.corba.AddressType.class);
 
         } catch (javax.xml.bind.JAXBException ex) {
@@ -157,7 +162,6 @@
         }
     }    
 
-    
     public void generateIDL(Definition definition, Binding binding) {
         List ext = binding.getExtensibilityElements();
         if (!(ext.get(0) instanceof BindingType)) {
@@ -202,7 +206,7 @@
         root.write(printWriter);
         printWriter.close();
     }
-
+    
     private void collectIdlDefns(Binding binding) throws Exception {
         boolean isOneway = false;
         Iterator iterator = binding.getBindingOperations().iterator();
@@ -216,8 +220,8 @@
         }
     }
 
-    private void addOperation(BindingOperation bindingOperation, boolean isOneway) 
-        throws Exception {
+    private void addOperation(BindingOperation bindingOperation, 
+                              boolean isOneway) throws Exception {
 
         String name = null;
         Iterator i = bindingOperation.getExtensibilityElements().iterator();
@@ -236,7 +240,8 @@
         }
     }
 
-    public void createIdlAttribute(org.apache.schemas.yoko.bindings.corba.OperationType opType, String name) {
+    public void createIdlAttribute(org.apache.schemas.yoko.bindings.corba.OperationType 
+                                   opType, String name) throws Exception {          
         String attrNm = name.substring(5, name.length());
         IdlAttribute attr;
         IdlDefn idlDef = intf.lookup(attrNm);
@@ -340,8 +345,7 @@
             }
             Iterator i = typeMappingType.getStructOrExceptionOrUnion().iterator();
             while (i.hasNext()) {
-                CorbaTypeImpl corbaType = (CorbaTypeImpl)i.next();                
-                //if (corbaType.getType().getLocalPart().equals(qname.getLocalPart())) {                
+                CorbaTypeImpl corbaType = (CorbaTypeImpl)i.next();                               
                 if (corbaType.getName().equals(qname.getLocalPart())) {                    
                     return corbaType;
                 }
@@ -353,21 +357,21 @@
         return corbaTypeImpl;         
     }
 
-    private IdlType findType(QName qname) {        
+    private IdlType findType(QName qname) throws Exception {        
         String local = qname.getLocalPart();        
         return findIdlType(local, qname, null);                
     }
 
-    private IdlType findCorbaIdlType(CorbaTypeImpl corbaTypeImpl) {        
+    private IdlType findCorbaIdlType(CorbaTypeImpl corbaTypeImpl) throws Exception {        
         String local = corbaTypeImpl.getName();        
         return findIdlType(local, corbaTypeImpl.getType(), corbaTypeImpl);                
     }
     
     private IdlType findIdlType(String local, QName ntype, 
-                                  CorbaTypeImpl corbatypeImpl) {
+                                  CorbaTypeImpl corbatypeImpl) throws Exception {
         IdlType idlType = null;
         
-        if (ntype.getNamespaceURI().equals(CORBAConstants.NU_WSDL_CORBA)) {
+        if (ntype.getNamespaceURI().equals(CorbaConstants.NU_WSDL_CORBA)) {
             try {
                 idlType = createPrimitiveType(ntype, local);
             } catch (Exception ex) {
@@ -385,9 +389,10 @@
                 if (defn instanceof IdlType) {
                     return (IdlType)defn;
                 } else {
-                    // MessageDef msg = WSDLToCorbaMessages.INCORRECT_IDL_TYPE;
-                    // throw new Exception(msg.getLocalMessage(new Object[] {
-                    // qname.toString()}));
+                    String msgStr = name + " is an incorrect idltype.";
+                    org.apache.cxf.common.i18n.Message msg = 
+                        new org.apache.cxf.common.i18n.Message(msgStr, LOG);
+                    throw new Exception(msg.toString());
                 }
             } else {
                 try {
@@ -403,19 +408,19 @@
     protected IdlType createPrimitiveType(QName idlType, String name) throws Exception {
         IdlDefn result = root.lookup(name);
 
-        if (result == null) {
-            // MessageDef msg = WSDLToCorbaMessages.IDL_TYPE_NOT_FOUND;
-            // throw new Exception(msg.getLocalMessage(new Object[]{idlType}));
-        } else if (!(result instanceof IdlType)) {
-            // MessageDef msg = WSDLToCorbaMessages.INCORRECT_IDL_TYPE;
-            // throw new Exception(msg.getLocalMessage(new Object[]{name}));
+        if (result != null          
+            &&  (!(result instanceof IdlType))) {
+            String msgStr = idlType.getLocalPart() + " is an incorrect idltype.";
+            org.apache.cxf.common.i18n.Message msg = 
+                new org.apache.cxf.common.i18n.Message(msgStr, LOG);
+            throw new Exception(msg.toString());   
         }
 
         /**
          * If we find a corba:dateTime then add the TimeBase.idl to the include
          * list for the root.
          */
-        if (idlType.equals(CORBAConstants.NT_CORBA_DATETIME)) {
+        if (idlType.equals(CorbaConstants.NT_CORBA_DATETIME)) {
             root.addInclude("<omg/TimeBase.idl>");
         }
         return (IdlType)result;
@@ -432,9 +437,10 @@
         }
         
         if (corbaTypeImpl == null) {
-            // MessageDef msg = WSDLToCorbaMessages.IDL_TYPE_NOT_FOUND;
-            // throw new Exception(msg.getLocalMessage(new Object[] { idlType
-            // }));
+            String msgStr = "Type " + idlType.getLocalPart() + " not found.";
+            org.apache.cxf.common.i18n.Message msg = 
+                new org.apache.cxf.common.i18n.Message(msgStr, LOG);
+            throw new Exception(msg.toString());                
         }
         
         IdlScopeBase scope = root;
@@ -488,6 +494,8 @@
             result = createStruct(corbaTypeImpl, scope, local);            
         } else if (corbaTypeImpl instanceof Union) {
             result = createUnion(corbaTypeImpl, scope, local);
+        } else if (corbaTypeImpl instanceof Alias) {
+            result = createTypedef(corbaTypeImpl, scope, local);        
         } else if (corbaTypeImpl instanceof Array) {
             result = createArray(corbaTypeImpl, scope, local);
         } else if (corbaTypeImpl instanceof Anonarray) {
@@ -496,10 +504,19 @@
             result = createFixed(corbaTypeImpl, scope, local);
         } else if (corbaTypeImpl instanceof Anonfixed) {
             result = createAnonFixed(corbaTypeImpl, scope, local);
+        } else if (corbaTypeImpl instanceof Const) {
+            result = createConst(corbaTypeImpl, scope, local);      
         } else {
             result = checkAnon(corbaTypeImpl, scope, local);                                    
+        } 
+        
+        if (result == null) {
+            if (corbaTypeImpl instanceof Object) {
+                result = createInterface(corbaTypeImpl, scope, local);            
+            }
         }
-        return result;
+        
+        return result; 
     }
 
     private IdlType checkAnon(CorbaTypeImpl corbaTypeImpl, IdlScopeBase scope, 
@@ -515,7 +532,43 @@
         return result;
     }
 
-    private IdlType createIdlException(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
+    private IdlType createInterface(CorbaTypeImpl ctype, IdlScopeBase scope, String local) 
+        throws Exception {
+    
+        IdlType result = null;
+        
+        org.apache.schemas.yoko.bindings.corba.Object obj = 
+            (org.apache.schemas.yoko.bindings.corba.Object)ctype;
+        QName bqname = obj.getBinding();        
+
+        Binding binding = def.getBinding(bqname);
+        if (binding != null) {
+            IdlDefn defn = scope.lookup(local);
+
+            if (defn != null && defn instanceof IdlInterface) {
+                return (IdlInterface)defn;
+            } else if (defn == null) {
+                try {
+                    IdlInterface storedIntf = intf;
+                    intf = IdlInterface.create(scope, local);
+                    scope.holdForScope(intf);
+                    collectIdlDefns(binding);
+                    scope.promoteHeldToScope();
+                    result = intf;
+                    intf = storedIntf;
+                } catch (Exception ex) {
+                    String msgStr = "Interface type " + intf.fullName() + " not found.";
+                    org.apache.cxf.common.i18n.Message msg = 
+                        new org.apache.cxf.common.i18n.Message(msgStr, LOG);
+                    throw new Exception(msg.toString());
+                }                
+            }
+        }
+        return result;
+    }
+    
+    private IdlType createIdlException(CorbaTypeImpl ctype, IdlScopeBase scope, 
+                                       String local) throws Exception {
         IdlType result = null;
         org.apache.schemas.yoko.bindings.corba.Exception e = 
             (org.apache.schemas.yoko.bindings.corba.Exception)ctype;
@@ -544,7 +597,8 @@
         return result;        
     }
     
-    private IdlType createUnion(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
+    private IdlType createUnion(CorbaTypeImpl ctype, IdlScopeBase scope, 
+                                String local) throws Exception {
         Union u = (Union)ctype;
         boolean undefinedCircular = false;
         IdlType disc = findType(u.getDiscriminator());
@@ -555,8 +609,12 @@
         while (it.hasNext()) {
             Unionbranch ub = (Unionbranch)it.next();
             QName qname = ub.getIdltype();
-            IdlType bt = findType(qname);            
-            IdlUnionBranch b = IdlUnionBranch.create(union, ub.getName(), bt, false);
+            IdlType bt = findType(qname);
+            boolean isDefault = false;
+            if (ub.isSetDefault()) {
+                isDefault = ub.isDefault();
+            }
+            IdlUnionBranch b = IdlUnionBranch.create(union, ub.getName(), bt, isDefault);
 
             Iterator it2 = ub.getCase().iterator();
             while (it2.hasNext()) {                
@@ -587,7 +645,8 @@
         return union;
     }
     
-    private IdlType createStruct(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
+    private IdlType createStruct(CorbaTypeImpl ctype, IdlScopeBase scope, 
+                                 String local) throws Exception {
         Struct s = (Struct)ctype;
         boolean undefinedCircular = false;
         IdlStruct struct = IdlStruct.create(scope, local);
@@ -625,7 +684,30 @@
         return struct;        
     }
     
-    private IdlType createSequence(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
+    private IdlType createTypedef(CorbaTypeImpl ctype, IdlScopeBase scope, 
+                                  String local) throws Exception {
+        IdlType idlType = null;
+        Alias a = (Alias)ctype;
+        IdlType base = findType(a.getBasetype());                               
+        idlType = IdlTypedef.create(scope, local, base);
+        scope.addToScope(idlType);
+        return idlType;
+    }
+
+    private IdlType createConst(CorbaTypeImpl ctype, IdlScopeBase scope, 
+                                String local) throws Exception {
+        IdlType idlType = null;
+        Const c = (Const)ctype;
+        IdlType base = findType(c.getIdltype());
+        String value = c.getValue(); 
+        idlType = IdlConst.create(scope, local, base, value);
+        scope.addToScope(idlType);
+        return idlType;
+    }
+
+    
+    private IdlType createSequence(CorbaTypeImpl ctype, IdlScopeBase scope, 
+                                   String local) throws Exception {
         IdlType idlType = null;
         Sequence s = (Sequence)ctype;
         IdlType base = findType(s.getElemtype());        
@@ -635,7 +717,8 @@
         return idlType;
     }
     
-    private IdlType createAnonSequence(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
+    private IdlType createAnonSequence(CorbaTypeImpl ctype, IdlScopeBase scope, 
+                                       String local)  throws Exception {
         IdlType idlType = null;
         Anonsequence s = (Anonsequence)ctype;
         IdlType base = findType(s.getElemtype());        
@@ -645,7 +728,8 @@
         return idlType;
     }
     
-    private IdlType createArray(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
+    private IdlType createArray(CorbaTypeImpl ctype, IdlScopeBase scope, String local) 
+        throws Exception {
         IdlType idlType = null;
         Array s = (Array)ctype;
         IdlType base = findType(s.getElemtype());        
@@ -655,7 +739,8 @@
         return idlType;
     }
     
-    private IdlType createAnonArray(CorbaTypeImpl ctype, IdlScopeBase scope, String local) {
+    private IdlType createAnonArray(CorbaTypeImpl ctype, IdlScopeBase scope, String local) 
+        throws Exception {
         IdlType idlType = null;
         Anonarray s = (Anonarray)ctype;
         IdlType base = findType(s.getElemtype());        

Modified: incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToProcessor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToProcessor.java?view=diff&rev=465642&r1=465641&r2=465642
==============================================================================
--- incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToProcessor.java (original)
+++ incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToProcessor.java Thu Oct 19 07:31:44 2006
@@ -50,12 +50,13 @@
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 
 public class WSDLToProcessor implements Processor {
-
+    
     protected static final Logger LOG = 
-        LogUtils.getL7dLogger(WSDLToProcessor.class);    
+        LogUtils.getL7dLogger(WSDLToProcessor.class);
     protected Definition wsdlDefinition;    
     protected WSDLFactory wsdlFactory;
-    protected WSDLReader wsdlReader;    
+    protected WSDLReader wsdlReader;
+    
     private XmlSchema schematype;
     private ToolContext env;
     private ExtensionRegistry extReg;        
@@ -65,6 +66,8 @@
     private List<Schema> schemaList;  
     private List<String> schemaTargetNamespaces = new ArrayList<String>();
     
+    
+    
     public WSDLToProcessor() {
         schemaList = new ArrayList<Schema>();
     }
@@ -82,7 +85,7 @@
 
             //bravi, Why are we doing this?
             parseImports(wsdlDefinition);
-            buildWSDLDefinition();
+            buildWSDLDefinition();    
         } catch (WSDLException we) {
             org.apache.cxf.common.i18n.Message msg = 
                     new org.apache.cxf.common.i18n.Message(
@@ -90,7 +93,7 @@
             throw new ToolException(msg, we);
         } 
     }
-    
+            
     private void buildWSDLDefinition() {
         for (Definition def : importedDefinitions) {
             this.wsdlDefinition.addNamespace(def.getPrefix(def.getTargetNamespace()), def

Modified: incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLTypes.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLTypes.java?view=diff&rev=465642&r1=465641&r2=465642
==============================================================================
--- incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLTypes.java (original)
+++ incubator/yoko/branches/cxf_port/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLTypes.java Thu Oct 19 07:31:44 2006
@@ -21,21 +21,34 @@
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
 import org.apache.cxf.common.logging.LogUtils;
 
+import org.apache.schemas.yoko.bindings.corba.Anonarray;
 import org.apache.schemas.yoko.bindings.corba.Anonfixed;
+import org.apache.schemas.yoko.bindings.corba.Anonsequence;
 import org.apache.schemas.yoko.bindings.corba.Anonstring;
+import org.apache.schemas.yoko.bindings.corba.Array;
+import org.apache.schemas.yoko.bindings.corba.BindingType;
 import org.apache.schemas.yoko.bindings.corba.CaseType;
 import org.apache.schemas.yoko.bindings.corba.Fixed;
 import org.apache.schemas.yoko.bindings.corba.MemberType;
 import org.apache.schemas.yoko.bindings.corba.Sequence;
 import org.apache.schemas.yoko.bindings.corba.Union;
 import org.apache.schemas.yoko.bindings.corba.Unionbranch;
+import org.apache.ws.commons.schema.XmlSchemaAnnotation;
+import org.apache.ws.commons.schema.XmlSchemaAppInfo;
 import org.apache.ws.commons.schema.XmlSchemaChoice;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
@@ -45,15 +58,179 @@
 import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction;
 import org.apache.ws.commons.schema.XmlSchemaTotalDigitsFacet;
-import org.apache.yoko.tools.common.CORBAConstants;
 import org.apache.yoko.tools.common.W3CConstants;
+import org.apache.yoko.wsdl.CorbaConstants;
 import org.apache.yoko.wsdl.CorbaTypeImpl;
 
-public final class WSDLTypes {
+public class WSDLTypes extends WSDLToCorbaBinding {
     
     protected static final Logger LOG = LogUtils.getL7dLogger(WSDLTypes.class);
+    static String idlversion = ":1.0";    
+    static String repoString = "IDL:";     
 
-    public WSDLTypes() {        
+    public WSDLTypes() {            
+    }
+    
+    public CorbaTypeImpl processObject(Definition definition, XmlSchemaComplexType complex,  
+                                       XmlSchemaAnnotation annotation, QName typeName,
+                                       QName defaultName, String idlNamespace) 
+        throws Exception {
+        CorbaTypeImpl corbaTypeImpl = null;
+                
+        if (annotation != null) {
+            Iterator i = annotation.getItems().getIterator();
+            while (i.hasNext()) {
+                XmlSchemaAppInfo appInfo = (XmlSchemaAppInfo)i.next();
+                if (appInfo != null) {
+                    NodeList nlist = appInfo.getMarkup();
+                    Node node = nlist.item(0);
+                    String info = node.getNodeValue();
+                    
+                    info.trim();                
+        
+                    if ("corba:binding=".equals(info.substring(0, 14))) {
+                        String bindingName = info.substring(14);
+                        QName bqname = new QName(definition.getTargetNamespace(), bindingName);
+
+                        //Check if the Binding with name already exists
+                        Binding binding = null;
+                        if (queryBinding(definition, bqname)) {
+                            binding = definition.getBinding(bqname);
+                        }
+
+                        if (binding != null) {    
+                            org.apache.schemas.yoko.bindings.corba.Object obj = 
+                                new org.apache.schemas.yoko.bindings.corba.Object();
+                            PortType portT = binding.getPortType();
+                            QName name = new QName(idlNamespace, portT.getQName().getLocalPart(), 
+                                                   definition.getPrefix(idlNamespace));
+                            obj.setName(name.getLocalPart());
+                            obj.setQName(name);  
+                            QName bName = binding.getQName();                           
+                            obj.setBinding(bName);
+                            // get the repository id of the binding.
+                            String repId = null;
+                            Iterator bindIter = binding.getExtensibilityElements().iterator();
+                            while (bindIter.hasNext()) {
+                                BindingType type = (BindingType)bindIter.next();
+                                repId = type.getRepositoryID();                               
+                            }
+                            obj.setRepositoryID(repId);
+                            obj.setType(typeName);
+                            corbaTypeImpl = obj;
+                        } else {
+                            //if (isVerboseOn()) {
+                            System.out.println("Could not find binding for: " + bqname);
+                            //}
+                        }
+                    }
+                }
+            }
+        }
+
+        if (corbaTypeImpl == null) {
+            org.apache.schemas.yoko.bindings.corba.Object obj = 
+                new org.apache.schemas.yoko.bindings.corba.Object();
+            QName name = new QName(idlNamespace, "Object", definition.getPrefix(idlNamespace));
+            obj.setName(name.getLocalPart());
+            obj.setQName(name);  
+            obj.setRepositoryID("IDL:omg.org/CORBA/Object/1.0");
+            obj.setType(typeName);                       
+            corbaTypeImpl = obj;
+        }
+        
+        return corbaTypeImpl;
+
+    }         
+
+    
+    public CorbaTypeImpl processStringType(CorbaTypeImpl corbaTypeImpl, QName name, 
+                                           String maxLength, String length) throws Exception {
+        boolean boundedString = true;             
+        int bound = 0;
+
+        try {
+            if (maxLength != null) {
+                bound = Integer.parseInt(maxLength);
+            } else if (length != null) {
+                bound = Integer.parseInt(length);
+            } else {
+                boundedString = false;
+            }
+        } catch (NumberFormatException ex) {
+            throw new Exception("illegal number" , ex);
+        } catch (Exception e) {
+            throw new Exception("illegal number" , e);
+        }
+
+        if (boundedString) {
+            // bounded string 
+            Anonstring anonString = new Anonstring();
+            anonString.setBound(bound);
+            anonString.setName(name.getLocalPart());
+            anonString.setQName(name);
+            anonString.setType(corbaTypeImpl.getQName());            
+            corbaTypeImpl = anonString;           
+        } 
+        return corbaTypeImpl;
+    }
+    
+    public CorbaTypeImpl mapToArray(QName name, QName schematypeName, QName arrayType, int bound,
+                                     boolean anonymous) {
+        CorbaTypeImpl corbatype = null;
+            
+        //schematypeName = checkPrefix(schematypeName);
+
+        if (!anonymous) {
+            //Create an Array
+            Array corbaArray = new Array();
+            corbaArray.setName(name.getLocalPart());
+            corbaArray.setType(schematypeName);
+            corbaArray.setElemtype(arrayType);
+            corbaArray.setBound(bound);
+            corbaArray.setRepositoryID(repoString + name.getLocalPart().replace('.', '/') + idlversion);
+            corbaArray.setQName(name);            
+            corbatype = corbaArray;
+        } else {
+            //Create an Anonymous Array
+            Anonarray corbaArray = new Anonarray();
+            corbaArray.setName(name.getLocalPart());
+            corbaArray.setType(schematypeName);            
+            corbaArray.setElemtype(arrayType);
+            corbaArray.setBound(bound);
+            corbaArray.setQName(name);                        
+            corbatype = corbaArray;
+        }           
+        return corbatype;
+    }
+
+    public CorbaTypeImpl mapToSequence(QName name, QName schematypeName, QName arrayType, int bound,
+                                        boolean anonymous) {
+        CorbaTypeImpl corbaTypeImpl = null;
+
+        //schematypeName = checkPrefix(schematypeName);
+        if (!anonymous) {
+            // Create a Sequence
+            Sequence corbaSeq = new Sequence();
+            corbaSeq.setName(name.getLocalPart());
+            corbaSeq.setQName(name);
+            corbaSeq.setType(schematypeName);
+            corbaSeq.setElemtype(arrayType);
+            corbaSeq.setBound(bound);
+            corbaSeq.setRepositoryID(repoString + name.getLocalPart().replace('.', '/') + idlversion);
+            corbaTypeImpl = corbaSeq;
+        } else {
+            // Create a Anonymous Sequence
+            Anonsequence corbaSeq = new Anonsequence();
+            corbaSeq.setName(name.getLocalPart());
+            corbaSeq.setQName(name);
+            corbaSeq.setType(schematypeName);
+            corbaSeq.setElemtype(arrayType);
+            corbaSeq.setBound(bound);
+
+            corbaTypeImpl = corbaSeq;
+        }
+        return corbaTypeImpl;
     }
     
     public Union processUnionBranches(Union corbaUnion, List fields, List<String> caselist) {
@@ -116,36 +293,6 @@
     }
 
     
-    public CorbaTypeImpl processStringType(CorbaTypeImpl corbaTypeImpl, QName name, 
-                                           String maxLength, String length) throws Exception {
-        boolean boundedString = true;        
-        int bound = 0;
-
-        try {
-            if (maxLength != null) {
-                bound = Integer.parseInt(maxLength);
-            } else if (length != null) {
-                bound = Integer.parseInt(length);
-            } else {
-                boundedString = false;
-            }
-        } catch (NumberFormatException ex) {
-            throw new Exception("illegal number" , ex);
-        } catch (Exception e) {
-            throw new Exception("illegal number" , e);
-        }
-
-        if (boundedString) {
-            Anonstring anonString = new Anonstring();
-            anonString.setBound(bound);
-            anonString.setName(name.getLocalPart());
-            anonString.setQName(name);
-            anonString.setType(CORBAConstants.NT_CORBA_STRING);
-            corbaTypeImpl = anonString;
-        }
-        return corbaTypeImpl;
-    }
-    
     public CorbaTypeImpl processDecimalType(XmlSchemaSimpleTypeRestriction restrictionType, 
                                              QName name, CorbaTypeImpl corbaTypeImpl,
                                              boolean anonymous) throws Exception {
@@ -268,6 +415,27 @@
         return corbaTypeImpl;
     }
     
+    //  checks if the type is an anonymous type.
+    public boolean isAnonymous(String typeName) {
+        boolean anonymous = false;
+        
+        if (typeName == null) {
+            anonymous = true;
+        } else {                                                  
+            StringTokenizer strtok = new StringTokenizer(typeName, ".");
+            for (int i = 0; strtok.hasMoreTokens(); ++i) {
+                String token = strtok.nextToken();
+                if (token.startsWith("_")) {                    
+                    if (Character.isDigit(token.charAt(1))) {
+                        anonymous = true;
+                        break;
+                    }                    
+                }
+            }
+        }
+        return anonymous;
+    }
+    
     public CorbaTypeImpl getFixedCorbaType(QName name, QName stype, int digits, int scale) {        
         Fixed fixed = new Fixed();
         fixed.setName(name.getLocalPart());
@@ -293,9 +461,10 @@
         seq.setName(name.getLocalPart());
         seq.setQName(name);
         seq.setType(stype);        
-        seq.setElemtype(CORBAConstants.NT_CORBA_OCTET);
+        seq.setElemtype(CorbaConstants.NT_CORBA_OCTET);
         seq.setBound(bound);
         return seq;
     }
+        
     
-}
\ No newline at end of file
+}

Modified: incubator/yoko/branches/cxf_port/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java?view=diff&rev=465642&r1=465641&r2=465642
==============================================================================
--- incubator/yoko/branches/cxf_port/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java (original)
+++ incubator/yoko/branches/cxf_port/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java Thu Oct 19 07:31:44 2006
@@ -163,4 +163,16 @@
         testWSDLGeneration("/idl/Fixed.idl", "/idl/expected_Fixed.wsdl");
     }
 
+    public void testTypedefGeneration() throws Exception {
+        testWSDLGeneration("/idl/Typedef.idl", "/idl/expected_Typedef.wsdl");
+    }
+
+    public void testStringGeneration() throws Exception {
+        testWSDLGeneration("/idl/String.idl", "/idl/expected_String.wsdl");
+    }
+
+    public void testAttributesGeneration() throws Exception {
+        testWSDLGeneration("/idl/Attributes.idl", "/idl/expected_Attributes.wsdl");
+    }
+
 }

Modified: incubator/yoko/branches/cxf_port/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java?view=diff&rev=465642&r1=465641&r2=465642
==============================================================================
--- incubator/yoko/branches/cxf_port/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java (original)
+++ incubator/yoko/branches/cxf_port/tools/src/test/java/org/apache/yoko/tools/processors/WSDLToCorbaBindingTest.java Thu Oct 19 07:31:44 2006
@@ -43,10 +43,10 @@
 import org.apache.schemas.yoko.bindings.corba.ParamType;
 import org.apache.schemas.yoko.bindings.corba.Sequence;
 import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
-import org.apache.yoko.tools.common.CORBAConstants;
 import org.apache.yoko.tools.common.WSDLCorbaFactory;
 import org.apache.yoko.tools.processors.wsdl.WSDLToCorbaBinding;
 import org.apache.yoko.tools.processors.wsdl.WSDLToIDLAction;
+import org.apache.yoko.wsdl.CorbaConstants;
 
 public class WSDLToCorbaBindingTest extends TestCase {
     WSDLToCorbaBinding generator;
@@ -88,6 +88,34 @@
     }    
     
     
+    public void testSequenceType() throws Exception {
+        try {
+            String fileName = getClass().getResource("/wsdl/sequencetype.wsdl").toString();
+            generator.setWsdlFile(fileName);
+            generator.addInterfaceName("IACC.Server");
+
+            Definition model = generator.generateCORBABinding();
+            Document document = writer.getDocument(model);
+
+            Element typemap = getElementNode(document, "corba:typeMapping");
+            //assertNotNull(typemap);
+            assertEquals(2, typemap.getElementsByTagName("corba:sequence").getLength());
+            assertEquals(5, typemap.getElementsByTagName("corba:exception").getLength());
+            assertEquals(70, typemap.getElementsByTagName("corba:struct").getLength());
+
+            WSDLToIDLAction idlgen = new WSDLToIDLAction();
+            idlgen.setBindingName("IACC.ServerCORBABinding");
+            idlgen.setOutputFile("sequencetype.idl");
+            idlgen.generateIDL(model);
+
+            File f = new File("sequencetype.idl");
+            assertTrue("sequencetype.idl should be generated", f.exists());
+        } finally {
+            new File("sequencetype.idl").deleteOnExit();
+        }
+    }
+
+    
     public void testFixedBindingGeneration() throws Exception {
         String fileName = getClass().getResource("/wsdl/fixed.wsdl").toString();
         generator.setWsdlFile(fileName);
@@ -281,33 +309,7 @@
 
     }
     
-    public void testSequenceType() throws Exception {
-        try {
-            String fileName = getClass().getResource("/wsdl/sequencetype.wsdl").toString();
-            generator.setWsdlFile(fileName);
-            generator.addInterfaceName("IACC.Server");
-
-            Definition model = generator.generateCORBABinding();
-            Document document = writer.getDocument(model);
-
-            Element typemap = getElementNode(document, "corba:typeMapping");
-            //assertNotNull(typemap);
-            assertEquals(2, typemap.getElementsByTagName("corba:sequence").getLength());
-            assertEquals(5, typemap.getElementsByTagName("corba:exception").getLength());
-            assertEquals(70, typemap.getElementsByTagName("corba:struct").getLength());
-
-            WSDLToIDLAction idlgen = new WSDLToIDLAction();
-            idlgen.setBindingName("IACC.ServerCORBABinding");
-            idlgen.setOutputFile("sequencetype.idl");
-            idlgen.generateIDL(model);
-
-            File f = new File("sequencetype.idl");
-            assertTrue("sequencetype.idl should be generated", f.exists());
-        } finally {
-            new File("sequencetype.idl").deleteOnExit();
-        }
-    }
-    
+        
     public void testUnionType() throws Exception {
         try {
             String fileName = getClass().getResource("/wsdl/uniontype.wsdl").toString();
@@ -430,7 +432,7 @@
                     assertEquals(corbaOpType.getName(), "echoString");
                     assertEquals(3, corbaOpType.getParam().size());
                     assertEquals(corbaOpType.getReturn().getName(), "return");
-                    assertEquals(corbaOpType.getReturn().getIdltype(), CORBAConstants.NT_CORBA_STRING);
+                    assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_STRING);
                     assertEquals(corbaOpType.getParam().get(0).getName(), "x");
                     assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
                     QName qname = 
@@ -536,29 +538,29 @@
         getTestIdTest(binding);
         setTestIdTest(binding);
         testVoidTest(binding);        
-        testPrimitiveTypeTest(binding, "test_short", CORBAConstants.NT_CORBA_SHORT);
-        testPrimitiveTypeTest(binding, "test_long", CORBAConstants.NT_CORBA_LONG);
-        testPrimitiveTypeTest(binding, "test_longlong", CORBAConstants.NT_CORBA_LONGLONG);
-        testPrimitiveTypeTest(binding, "test_ushort", CORBAConstants.NT_CORBA_USHORT);        
-        testPrimitiveTypeTest(binding, "test_ulong", CORBAConstants.NT_CORBA_ULONG);
-        testPrimitiveTypeTest(binding, "test_ulonglong", CORBAConstants.NT_CORBA_ULONGLONG);
-        testPrimitiveTypeTest(binding, "test_float", CORBAConstants.NT_CORBA_FLOAT);
-        testPrimitiveTypeTest(binding, "test_double", CORBAConstants.NT_CORBA_DOUBLE);
-        testPrimitiveTypeTest(binding, "test_octet", CORBAConstants.NT_CORBA_OCTET);
-        testPrimitiveTypeTest(binding, "test_boolean", CORBAConstants.NT_CORBA_BOOLEAN);
-        testPrimitiveTypeTest(binding, "test_char", CORBAConstants.NT_CORBA_CHAR);
-        testPrimitiveTypeTest(binding, "test_integer", CORBAConstants.NT_CORBA_LONGLONG);
-        testPrimitiveTypeTest(binding, "test_nonNegativeInteger", CORBAConstants.NT_CORBA_ULONGLONG);
-        testPrimitiveTypeTest(binding, "test_positiveInteger", CORBAConstants.NT_CORBA_ULONGLONG);
-        testPrimitiveTypeTest(binding, "test_negativeInteger", CORBAConstants.NT_CORBA_LONGLONG);
-        testPrimitiveTypeTest(binding, "test_normalizedString", CORBAConstants.NT_CORBA_STRING);
-        testPrimitiveTypeTest(binding, "test_token", CORBAConstants.NT_CORBA_STRING);        
-        testPrimitiveTypeTest(binding, "test_language", CORBAConstants.NT_CORBA_STRING);        
-        testPrimitiveTypeTest(binding, "test_Name", CORBAConstants.NT_CORBA_STRING);
-        testPrimitiveTypeTest(binding, "test_NCName", CORBAConstants.NT_CORBA_STRING);
-        testPrimitiveTypeTest(binding, "test_ID", CORBAConstants.NT_CORBA_STRING);
-        testPrimitiveTypeTest(binding, "test_anyURI", CORBAConstants.NT_CORBA_STRING);
-        testPrimitiveTypeTest(binding, "test_nick_name", CORBAConstants.NT_CORBA_STRING);
+        testPrimitiveTypeTest(binding, "test_short", CorbaConstants.NT_CORBA_SHORT);
+        testPrimitiveTypeTest(binding, "test_long", CorbaConstants.NT_CORBA_LONG);
+        testPrimitiveTypeTest(binding, "test_longlong", CorbaConstants.NT_CORBA_LONGLONG);
+        testPrimitiveTypeTest(binding, "test_ushort", CorbaConstants.NT_CORBA_USHORT);        
+        testPrimitiveTypeTest(binding, "test_ulong", CorbaConstants.NT_CORBA_ULONG);
+        testPrimitiveTypeTest(binding, "test_ulonglong", CorbaConstants.NT_CORBA_ULONGLONG);
+        testPrimitiveTypeTest(binding, "test_float", CorbaConstants.NT_CORBA_FLOAT);
+        testPrimitiveTypeTest(binding, "test_double", CorbaConstants.NT_CORBA_DOUBLE);
+        testPrimitiveTypeTest(binding, "test_octet", CorbaConstants.NT_CORBA_OCTET);
+        testPrimitiveTypeTest(binding, "test_boolean", CorbaConstants.NT_CORBA_BOOLEAN);
+        testPrimitiveTypeTest(binding, "test_char", CorbaConstants.NT_CORBA_CHAR);
+        testPrimitiveTypeTest(binding, "test_integer", CorbaConstants.NT_CORBA_LONGLONG);
+        testPrimitiveTypeTest(binding, "test_nonNegativeInteger", CorbaConstants.NT_CORBA_ULONGLONG);
+        testPrimitiveTypeTest(binding, "test_positiveInteger", CorbaConstants.NT_CORBA_ULONGLONG);
+        testPrimitiveTypeTest(binding, "test_negativeInteger", CorbaConstants.NT_CORBA_LONGLONG);
+        testPrimitiveTypeTest(binding, "test_normalizedString", CorbaConstants.NT_CORBA_STRING);
+        testPrimitiveTypeTest(binding, "test_token", CorbaConstants.NT_CORBA_STRING);        
+        testPrimitiveTypeTest(binding, "test_language", CorbaConstants.NT_CORBA_STRING);        
+        testPrimitiveTypeTest(binding, "test_Name", CorbaConstants.NT_CORBA_STRING);
+        testPrimitiveTypeTest(binding, "test_NCName", CorbaConstants.NT_CORBA_STRING);
+        testPrimitiveTypeTest(binding, "test_ID", CorbaConstants.NT_CORBA_STRING);
+        testPrimitiveTypeTest(binding, "test_anyURI", CorbaConstants.NT_CORBA_STRING);
+        testPrimitiveTypeTest(binding, "test_nick_name", CorbaConstants.NT_CORBA_STRING);
     }    
     
     private void getStringAttributeTest(Binding binding) {
@@ -576,7 +578,7 @@
                 OperationType corbaOpType = (OperationType)extElement;                 
                 assertEquals(corbaOpType.getName(), "_get_string_attribute");                
                 assertEquals(corbaOpType.getReturn().getName(), "return");
-                assertEquals(corbaOpType.getReturn().getIdltype(), CORBAConstants.NT_CORBA_STRING);
+                assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_STRING);
             }
         }
     }
@@ -595,7 +597,7 @@
                 OperationType corbaOpType = (OperationType)extElement;                 
                 assertEquals(corbaOpType.getName(), "_get_test_id");                
                 assertEquals(corbaOpType.getReturn().getName(), "return");
-                assertEquals(corbaOpType.getReturn().getIdltype(), CORBAConstants.NT_CORBA_FLOAT);
+                assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_FLOAT);
             }
         }
     }
@@ -616,7 +618,7 @@
                 assertEquals(1, corbaOpType.getParam().size());                
                 assertEquals(corbaOpType.getParam().get(0).getName(), "_arg");
                 assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
-                assertEquals(corbaOpType.getParam().get(0).getIdltype(), CORBAConstants.NT_CORBA_FLOAT);
+                assertEquals(corbaOpType.getParam().get(0).getIdltype(), CorbaConstants.NT_CORBA_FLOAT);
             }
         }
     }