cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r1023402 [5/9] - in /cxf/trunk: api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/common/xmlschema/ common/common/src/test/java/org/apache/cxf/common/xml...
Date Sun, 17 Oct 2010 02:26:08 GMT
Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/AttributeVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/AttributeVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/AttributeVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/AttributeVisitor.java Sun Oct 17 02:26:06 2010
@@ -58,11 +58,11 @@ public class AttributeVisitor extends Vi
     private static final String PART_NAME         = "parameters";
     private static final String PARAM_NAME        = "_arg";
     private static final String RETURN_PARAM_NAME = "return";
-    
+
     private ExtensionRegistry   extReg;
     private PortType            portType;
     private Binding             binding;
-    
+
     public AttributeVisitor(Scope scope,
                             Definition defn,
                             XmlSchema schemaRef,
@@ -74,7 +74,7 @@ public class AttributeVisitor extends Vi
         portType = wsdlPortType;
         binding = wsdlBinding;
     }
-    
+
     public static boolean accept(AST node) {
         if (node.getType() == IDLTokenTypes.LITERAL_readonly
             || node.getType() == IDLTokenTypes.LITERAL_attribute) {
@@ -82,18 +82,18 @@ public class AttributeVisitor extends Vi
         }
         return false;
     }
-    
+
     public void visit(AST attributeNode) {
         // <attr_dcl> ::= ["readonly"] "attribute" <param_type_spec> <simple_declarator>
         //                {"," <simple_declarator>}*
-        
-        
+
+
         AST node = attributeNode.getFirstChild();
-        
+
         AST readonlyNode = null;
         AST typeNode = null;
         AST nameNode = null;
-        
+
         if (node.getType() == IDLTokenTypes.LITERAL_readonly) {
             readonlyNode = node;
             typeNode = readonlyNode.getNextSibling();
@@ -115,15 +115,15 @@ public class AttributeVisitor extends Vi
 
     private void generateGetter(AST typeNode, AST nameNode) {
         // generate wrapped doc element in parameter
-        XmlSchemaElement inParameters = 
+        XmlSchemaElement inParameters =
             generateWrappedDocElement(null,
                                       GETTER_PREFIX + nameNode.toString(),
                                       PARAM_NAME);
         // generate wrapped doc element out parameter
-        XmlSchemaElement outParameters = 
+        XmlSchemaElement outParameters =
             generateWrappedDocElement(typeNode,
                                       GETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX,
-                                      RETURN_PARAM_NAME);                                      
+                                      RETURN_PARAM_NAME);
 
         // generate input message
         Message inMsg = generateMessage(inParameters,
@@ -131,25 +131,25 @@ public class AttributeVisitor extends Vi
         // generate output message
         Message outMsg = generateMessage(outParameters,
                                          GETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
-        
+
         // generate operation
         String name = GETTER_PREFIX + nameNode.toString();
         Operation op = generateOperation(name, inMsg, outMsg);
-        
-        
+
+
         // generate corba return param
         ArgType corbaReturn = generateCorbaReturnParam(typeNode);
-        
+
         // generate corba operation
         OperationType corbaOp = generateCorbaOperation(op, null, corbaReturn);
-        
+
         // generate binding
         generateCorbaBindingOperation(binding, op, corbaOp);
     }
 
     private void generateSetter(AST typeNode, AST nameNode) {
         // generate wrapped doc element in parameter
-        XmlSchemaElement inParameters = 
+        XmlSchemaElement inParameters =
             generateWrappedDocElement(typeNode,
                                       SETTER_PREFIX + nameNode.toString(),
                                       PARAM_NAME);
@@ -158,31 +158,31 @@ public class AttributeVisitor extends Vi
             generateWrappedDocElement(null,
                                       SETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX,
                                       RETURN_PARAM_NAME);
-        
+
         // generate input message
         Message inMsg = generateMessage(inParameters,
                                         SETTER_PREFIX + nameNode.toString());
         // generate output message
         Message outMsg = generateMessage(outParameters,
                                          SETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
-        
+
         // generate operation
         String name = SETTER_PREFIX + nameNode.toString();
         Operation op = generateOperation(name, inMsg, outMsg);
-        
-        
+
+
         // generate corba return param
         ParamType corbaParam = generateCorbaParam(typeNode);
-        
+
         // generate corba operation
         OperationType corbaOp = generateCorbaOperation(op, corbaParam, null);
-        
+
         // generate binding
         generateCorbaBindingOperation(binding, op, corbaOp);
     }
-    
+
     /** Generate a wrapped doc style XmlSchemaElement containing one element.
-     * 
+     *
      * I.e.: generateWrappedDocElement(null, "foo", "bar");
      * <xs:element name="foo">
      *   <xs:complexType>
@@ -190,7 +190,7 @@ public class AttributeVisitor extends Vi
      *     </xs:sequence>
      *   </xs:complexType>
      * </xs:element>
-     * 
+     *
      * i.e.: generateWrappedDocElement(type, "foo", "bar");
      * <xs:element name="foo">
      *   <xs:complexType>
@@ -201,15 +201,15 @@ public class AttributeVisitor extends Vi
      *   </xs:complexType>
      * </xs:element>
 
-     * 
+     *
      * @param typeNode is the type of the element wrapped in the sequence, no element is created if null.
      * @param name is the name of the wrapping element.
      * @param paramName is the name of the  wrapping element.
      * @return the wrapping element.
      */
-    private XmlSchemaElement generateWrappedDocElement(AST typeNode, String name, 
+    private XmlSchemaElement generateWrappedDocElement(AST typeNode, String name,
                                                        String paramName) {
-        XmlSchemaElement element = new XmlSchemaElement();
+        XmlSchemaElement element = new XmlSchemaElement(schema, false);
         if (typeNode != null) {
             ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(getScope(),
                                                                     definition,
@@ -218,7 +218,7 @@ public class AttributeVisitor extends Vi
             visitor.visit(typeNode);
             XmlSchemaType stype = visitor.getSchemaType();
             Scope fqName = visitor.getFullyQualifiedName();
-            
+
             if (stype != null) {
                 element.setSchemaTypeName(stype.getQName());
                 if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
@@ -226,63 +226,62 @@ public class AttributeVisitor extends Vi
                 }
             } else {
                 wsdlVisitor.getDeferredActions().
-                    add(fqName, new AttributeDeferredAction(element)); 
+                    add(fqName, new AttributeDeferredAction(element));
             }
-            
+
             element.setName(paramName);
         }
-        
+
         XmlSchemaSequence sequence = new XmlSchemaSequence();
         if (typeNode != null) {
             sequence.getItems().add(element);
         }
-        
-        XmlSchemaComplexType complex = new XmlSchemaComplexType(schema);
+
+        XmlSchemaComplexType complex = new XmlSchemaComplexType(schema, false);
         complex.setParticle(sequence);
-        
-        XmlSchemaElement result = new XmlSchemaElement();
+
+        XmlSchemaElement result = new XmlSchemaElement(schema, true);
         result.setName(name);
-        result.setQName(new QName(definition.getTargetNamespace(), name));
         result.setSchemaType(complex);
 
-        
+
         schema.getItems().add(result);
-        
+
         return result;
     }
-    
+
     private Message generateMessage(XmlSchemaElement element, String name) {
         Part part = definition.createPart();
         part.setName(PART_NAME);
         part.setElementName(element.getQName());
-        
+
         Message result = definition.createMessage();
         result.setQName(new QName(definition.getTargetNamespace(), name));
         result.addPart(part);
         result.setUndefined(false);
-        
+
         definition.addMessage(result);
-        
+
         return result;
     }
-    
+
     private Operation generateOperation(String name, Message inputMsg, Message outputMsg) {
         Input input = definition.createInput();
         input.setName(inputMsg.getQName().getLocalPart());
         input.setMessage(inputMsg);
-        
+
         Output output = definition.createOutput();
         output.setName(outputMsg.getQName().getLocalPart());
         output.setMessage(outputMsg);
-        
+
         Operation result = definition.createOperation();
         result.setName(name);
         result.setInput(input);
         result.setOutput(output);
         result.setUndefined(false);
-        
+
         portType.addOperation(result);
-        
+
         return result;
     }
 
@@ -296,22 +295,22 @@ public class AttributeVisitor extends Vi
                                                                 wsdlVisitor);
         visitor.visit(type);
         CorbaTypeImpl corbaType = visitor.getCorbaType();
-        
+
         if (corbaType != null) {
             param.setIdltype(corbaType.getQName());
         } else {
             wsdlVisitor.getDeferredActions().
                 add(visitor.getFullyQualifiedName(), new AttributeDeferredAction(param));
         }
-        
+
         return param;
     }
-    
+
     private ParamType generateCorbaParam(AST type) {
         ParamType param = new ParamType();
         param.setName(PARAM_NAME);
         param.setMode(ModeType.IN);
-        
+
         ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(getScope(),
                                                                 definition,
                                                                 schema,
@@ -327,11 +326,11 @@ public class AttributeVisitor extends Vi
 
         return param;
     }
-    
+
     /** Generates a corba:operation in the corba:binding container within a wsdl:binding.
-     * 
+     *
      * Only one (or none) corba parameter and only one (or none) corba return parameter are supported.
-     * 
+     *
      * @param op is the wsdl operation to bind.
      * @param param is the corba parameter, none if null.
      * @param arg is the corba return parameter, none if null.
@@ -346,27 +345,27 @@ public class AttributeVisitor extends Vi
             throw new RuntimeException(ex);
         }
         operation.setName(op.getName());
-   
+
         if (param != null) {
             operation.getParam().add(param);
         }
-        
+
         if (arg != null) {
             operation.setReturn(arg);
         }
-        
+
         return operation;
     }
-    
+
     private BindingOperation generateCorbaBindingOperation(Binding wsdlBinding,
                                                            Operation op,
                                                            OperationType corbaOp) {
         BindingInput bindingInput = definition.createBindingInput();
         bindingInput.setName(op.getInput().getName());
-        
+
         BindingOutput bindingOutput = definition.createBindingOutput();
         bindingOutput.setName(op.getOutput().getName());
-        
+
         BindingOperation bindingOperation = definition.createBindingOperation();
         bindingOperation.addExtensibilityElement(corbaOp);
         bindingOperation.setOperation(op);
@@ -374,7 +373,7 @@ public class AttributeVisitor extends Vi
 
         bindingOperation.setBindingInput(bindingInput);
         bindingOperation.setBindingOutput(bindingOutput);
-        
+
         binding.addBindingOperation(bindingOperation);
 
         return bindingOperation;

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/DeclaratorVisitor.java Sun Oct 17 02:26:06 2010
@@ -39,7 +39,7 @@ public class DeclaratorVisitor extends V
     //                | <complex_declarator>
     // <simple_declarator> ::= <identifier>
     // <complex_declarator> ::= <array_declarator>
-    
+
     public DeclaratorVisitor(Scope scope,
                              Definition defn,
                              XmlSchema schemaRef,
@@ -52,9 +52,9 @@ public class DeclaratorVisitor extends V
         setCorbaType(corbaTypeRef);
         setFullyQualifiedName(fQName);
     }
-    
+
     public void visit(AST node) {
-    
+
         if (ArrayVisitor.accept(node)) {
             ArrayVisitor arrayVisitor = new ArrayVisitor(getScope(),
                                                          definition,
@@ -77,8 +77,8 @@ public class DeclaratorVisitor extends V
             // add corbaType
             typeMap.getStructOrExceptionOrUnion().add(getCorbaType());
         }
-        
-        AST nextDecl = node.getNextSibling(); 
+
+        AST nextDecl = node.getNextSibling();
         while (nextDecl != null) {
             Scope newScope = new Scope(getScope().getParent(), nextDecl);
 
@@ -88,14 +88,14 @@ public class DeclaratorVisitor extends V
                                                              schema,
                                                              wsdlVisitor,
                                                              nextDecl,
-                                                             getFullyQualifiedName()); 
+                                                             getFullyQualifiedName());
                 arrayVisitor.setSchemaType(getSchemaType());
                 arrayVisitor.setCorbaType(getCorbaType());
                 arrayVisitor.visit(nextDecl);
             } else {
                 visitNewTypes(newScope);
             }
-            
+
             nextDecl = nextDecl.getNextSibling();
         }
 
@@ -114,19 +114,19 @@ public class DeclaratorVisitor extends V
             //
             Alias oldAlias = (Alias) oldCorbaType;
             Alias alias = new Alias();
-            
+
             alias.setQName(newQname);
             alias.setBasetype(oldAlias.getBasetype());
             alias.setType(oldAlias.getType());
             alias.setRepositoryID(newScope.toIDLRepositoryID());
-            
+
             nextCorbaType = alias;
         } else if (oldCorbaType instanceof Sequence) {
             // Sequence
             //
-            
+
             nextSchemaType = duplicateXmlSchemaComplexType(newScope);
-            
+
             Sequence oldSequence = (Sequence) oldCorbaType;
             Sequence newSequence = new Sequence();
 
@@ -141,7 +141,7 @@ public class DeclaratorVisitor extends V
         } else if (oldCorbaType instanceof Fixed) {
             // Fixed
             //
-            
+
             nextSchemaType = duplicateXmlSchemaSimpleType(newScope);
 
             Fixed oldFixed = (Fixed) getCorbaType();
@@ -152,7 +152,7 @@ public class DeclaratorVisitor extends V
             newFixed.setScale(oldFixed.getScale());
             newFixed.setType(oldFixed.getType());
             newFixed.setRepositoryID(newScope.toIDLRepositoryID());
-            
+
             nextCorbaType = newFixed;
         } else {
             System.err.println("[DeclaratorVisitor: Unexpected CORBA type error!]");
@@ -164,24 +164,24 @@ public class DeclaratorVisitor extends V
         }
         if (nextSchemaType != null) {
             schema.getItems().add(nextSchemaType);
-            schema.addType(nextSchemaType);                    
+            schema.addType(nextSchemaType);
         }
     }
 
-    
+
     private XmlSchemaComplexType duplicateXmlSchemaComplexType(Scope newScope) {
         XmlSchemaComplexType oldSchemaType = (XmlSchemaComplexType) getSchemaType();
-        XmlSchemaComplexType newSchemaType = new XmlSchemaComplexType(schema);
+        XmlSchemaComplexType newSchemaType = new XmlSchemaComplexType(schema, false);
 
         newSchemaType.setName(newScope.toString());
         newSchemaType.setParticle(oldSchemaType.getParticle());
 
         return newSchemaType;
     }
-    
+
     private XmlSchemaSimpleType duplicateXmlSchemaSimpleType(Scope newScope) {
         XmlSchemaSimpleType oldSimpleType = (XmlSchemaSimpleType) getSchemaType();
-        XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema);
+        XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, false);
         simpleType.setContent(oldSimpleType.getContent());
         simpleType.setName(newScope.toString());
         return simpleType;

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/EnumVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/EnumVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/EnumVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/EnumVisitor.java Sun Oct 17 02:26:06 2010
@@ -40,40 +40,40 @@ public class EnumVisitor extends Visitor
                        WSDLASTVisitor wsdlVisitor) {
         super(scope, defn, schemaRef, wsdlVisitor);
     }
-    
+
     public static boolean accept(AST node) {
         if (node.getType() == IDLTokenTypes.LITERAL_enum) {
             return true;
         }
         return false;
     }
-    
+
     public void visit(AST enumNode) {
         // <enum_type> ::= "enum" <identifier> "{" <enumerator> {"," <enumerator>}* "}"
         // <enumerator> ::= <identifier>
-        
-        
+
+
         AST enumNameNode = enumNode.getFirstChild();
         Scope enumNameScope = new Scope(getScope(), enumNameNode);
 
         // xmlschema:enum
-        XmlSchemaSimpleType enumSchemaSimpleType = new XmlSchemaSimpleType(schema);
+        XmlSchemaSimpleType enumSchemaSimpleType = new XmlSchemaSimpleType(schema, true);
         enumSchemaSimpleType.setName(mapper.mapToQName(enumNameScope));
-        
+
         XmlSchemaSimpleTypeRestriction enumSchemaSimpleTypeRestriction = new XmlSchemaSimpleTypeRestriction();
         enumSchemaSimpleTypeRestriction.setBaseTypeName(Constants.XSD_STRING);
-        
+
         //XmlSchemaSimpleTypeContent xmlSchemaSimpleTypeContent = enumSchemaSimpleTypeRestriction;
         enumSchemaSimpleType.setContent(enumSchemaSimpleTypeRestriction);
 
-        
+
         // corba:enum
         Enum corbaEnum = new Enum();
         corbaEnum.setQName(new QName(typeMap.getTargetNamespace(), enumNameScope.toString()));
         corbaEnum.setRepositoryID(enumNameScope.toIDLRepositoryID());
         corbaEnum.setType(enumSchemaSimpleType.getQName());
-        
-        
+
+
         AST node = enumNameNode.getNextSibling();
         while (node != null) {
             // xmlschema:enumeration
@@ -85,13 +85,9 @@ public class EnumVisitor extends Visitor
             Enumerator enumerator = new Enumerator();
             enumerator.setValue(node.toString());
             corbaEnum.getEnumerator().add(enumerator);
-            
+
             node = node.getNextSibling();
         }
-        
-        // add schemaType
-        schema.getItems().add(enumSchemaSimpleType);
-        schema.addType(enumSchemaSimpleType);
 
         // add corbaType
         typeMap.getStructOrExceptionOrUnion().add(corbaEnum);

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ExceptionVisitor.java Sun Oct 17 02:26:06 2010
@@ -38,7 +38,7 @@ import org.apache.ws.commons.schema.XmlS
 public class ExceptionVisitor extends VisitorBase {
 
     private static final String TYPE_SUFFIX = "Type";
-    
+
     public ExceptionVisitor(Scope scope,
                             Definition defn,
                             XmlSchema schemaRef,
@@ -52,13 +52,13 @@ public class ExceptionVisitor extends Vi
         }
         return false;
     }
-    
+
     public void visit(AST node) {
         // <exception_dcl> ::= "exception" <identifier> "{" <member>* "}"
         // <member> ::= <type_spec> <declarators> ";"
 
         // <type_spec> visited by TypesVisitor
-        
+
         // Following should be visited by a separate visitor
         // <declarators> ::= <declarator> { "," <declarator> }*
         // <declarator> ::= <simple_declarator>
@@ -68,35 +68,34 @@ public class ExceptionVisitor extends Vi
         // <array_declarator> ::= <identifier> <fixed_array_size>+
         // <fixed_array_size> ::= "[" <positive_int_const> "]"
 
-        
+
         AST identifierNode = node.getFirstChild();
         Scope exceptionScope = new Scope(getScope(), identifierNode);
-        
+
         // xmlschema:exception
         Scope scopedName = new Scope(getScope(), identifierNode);
         String exceptionName = mapper.mapToQName(scopedName);
-        XmlSchemaElement element = new XmlSchemaElement();
+        XmlSchemaElement element = new XmlSchemaElement(schema, false);
         element.setName(mapper.mapToQName(scopedName));
-        element.setQName(new QName(schema.getTargetNamespace(), exceptionName));
 
         String exceptionTypeName = exceptionName + TYPE_SUFFIX;
 
-        XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
+        XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, false);
         complexType.setName(exceptionTypeName);
         //complexType.setQName(new QName(schema.getTargetNamespace(), exceptionTypeName));
         XmlSchemaSequence sequence = new XmlSchemaSequence();
         complexType.setParticle(sequence);
 
         element.setSchemaTypeName(complexType.getQName());
-        
+
         // corba:exception
-        org.apache.cxf.binding.corba.wsdl.Exception exception 
+        org.apache.cxf.binding.corba.wsdl.Exception exception
             = new org.apache.cxf.binding.corba.wsdl.Exception();
         exception.setQName(new QName(typeMap.getTargetNamespace(), exceptionName));
         exception.setType(complexType.getQName());
         exception.setRepositoryID(scopedName.toIDLRepositoryID());
 
-        
+
         // exception members
         AST memberTypeNode = identifierNode.getNextSibling();
         while (memberTypeNode != null) {
@@ -111,10 +110,10 @@ public class ExceptionVisitor extends Vi
             XmlSchemaType stype = visitor.getSchemaType();
             CorbaTypeImpl ctype = visitor.getCorbaType();
             Scope fullyQualifiedName = visitor.getFullyQualifiedName();
-            
+
             // needed for anonymous arrays in exceptions
             if (ArrayVisitor.accept(memberNode)) {
-                Scope anonScope = new Scope(exceptionScope, 
+                Scope anonScope = new Scope(exceptionScope,
                                             TypesUtils.getCorbaTypeNameNode(memberTypeNode));
                 ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
                                                              definition,
@@ -129,27 +128,27 @@ public class ExceptionVisitor extends Vi
                 ctype = arrayVisitor.getCorbaType();
             }
 
-            
+
             XmlSchemaElement member = createElementType(memberNode, stype,
                                                         fullyQualifiedName);
             sequence.getItems().add(member);
 
-            MemberType memberType = createMemberType(memberNode, ctype, 
+            MemberType memberType = createMemberType(memberNode, ctype,
                                                      fullyQualifiedName);
             exception.getMember().add(memberType);
-            
-            
+
+
             memberTypeNode = memberNode.getNextSibling();
         }
 
         schema.addType(complexType);
         schema.getItems().add(element);
         schema.getItems().add(complexType);
-        
-        
+
+
         // add exception to corba typemap
         typeMap.getStructOrExceptionOrUnion().add(exception);
-        
+
         setSchemaType(complexType);
         setCorbaType(exception);
         createFaultMessage(element.getQName());
@@ -160,11 +159,11 @@ public class ExceptionVisitor extends Vi
         // messages
         Message faultMsg = definition.createMessage();
 
-        faultMsg.setQName(new QName(definition.getTargetNamespace(), exceptionName));        
+        faultMsg.setQName(new QName(definition.getTargetNamespace(), exceptionName));
         faultMsg.setUndefined(false);
         // message - part
         Part part = definition.createPart();
-        part.setName("exception");           
+        part.setName("exception");
         part.setElementName(qname);
         faultMsg.addPart(part);
 
@@ -174,11 +173,11 @@ public class ExceptionVisitor extends Vi
 
         definition.addMessage(faultMsg);
     }
-    
+
     private XmlSchemaElement createElementType(AST memberNode, XmlSchemaType stype,
                                                Scope fqName) {
         // xmlschema:member
-        XmlSchemaElement member = new XmlSchemaElement();
+        XmlSchemaElement member = new XmlSchemaElement(schema, false);
         String memberName = memberNode.toString();
         member.setName(memberName);
         if (stype != null) {
@@ -189,12 +188,12 @@ public class ExceptionVisitor extends Vi
             }
         } else {
             wsdlVisitor.getDeferredActions().
-                add(fqName, new ExceptionDeferredAction(member)); 
+                add(fqName, new ExceptionDeferredAction(member));
         }
         return member;
     }
-    
-    private MemberType createMemberType(AST memberNode, CorbaTypeImpl ctype, 
+
+    private MemberType createMemberType(AST memberNode, CorbaTypeImpl ctype,
                                         Scope fqName) {
         // corba:member
         MemberType memberType = new MemberType();
@@ -205,8 +204,8 @@ public class ExceptionVisitor extends Vi
             wsdlVisitor.getDeferredActions().
                 add(fqName, new ExceptionDeferredAction(memberType));
         }
-        
+
         return memberType;
     }
-    
+
 }

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/FixedVisitor.java Sun Oct 17 02:26:06 2010
@@ -35,7 +35,7 @@ import org.apache.ws.commons.schema.cons
 public class FixedVisitor extends VisitorBase {
 
     private AST identifierNode;
-    
+
     public FixedVisitor(Scope scope,
                         Definition defn,
                         XmlSchema schemaRef,
@@ -44,21 +44,21 @@ public class FixedVisitor extends Visito
         super(scope, defn, schemaRef, wsdlVisitor);
         identifierNode = identifierNodeRef;
     }
-    
+
     public static boolean accept(AST node) {
         if (node.getType() == IDLTokenTypes.LITERAL_fixed) {
             return true;
         }
         return false;
     }
-    
+
     public void visit(AST fixedNode) {
         //      "typedef" <type_declarator>
         //      <type_declarator> ::= <type_spec> <declarators>
         //      <type_spec> ::= <simple_type_spec>
         //                    | <constr_type_spec>
         //      <simple_type_spec> ::= <base_type_spec>
-        //                           | <template_type_spec> 
+        //                           | <template_type_spec>
         //                           | <scoped_name>
         //      <base_type_spec> ::= ... omitted (integer, char, octect, etc)
         //      <template_type_spec> ::= <sequence_type>
@@ -75,12 +75,12 @@ public class FixedVisitor extends Visito
         //      <complex_declarator> ::= <array_declarator>
         //      <array_declarator> ::= <identifier> <fixed_array_size>+
         //      <fixed_array_size> ::= "[" <positive_int_const> "]"
-        
-        
+
+
         AST digitsNode = fixedNode.getFirstChild();
         AST scaleNode = digitsNode.getNextSibling();
         Scope scopedName = new Scope(getScope(), identifierNode);
-        
+
         // validate digits and scale
         Long digits = new Long(digitsNode.toString());
         Long scale = new Long(scaleNode.toString());
@@ -94,9 +94,9 @@ public class FixedVisitor extends Visito
             System.out.println("Scale cannot be greater than digits");
             return;
         }
-        
+
         // xmlschema:fixed
-        XmlSchemaSimpleType fixedSimpleType = new XmlSchemaSimpleType(schema);
+        XmlSchemaSimpleType fixedSimpleType = new XmlSchemaSimpleType(schema, false);
         XmlSchemaSimpleTypeRestriction fixedRestriction = new XmlSchemaSimpleTypeRestriction();
         fixedRestriction.setBaseTypeName(Constants.XSD_DECIMAL);
         XmlSchemaTotalDigitsFacet fixedTotalDigits = new XmlSchemaTotalDigitsFacet();
@@ -112,7 +112,7 @@ public class FixedVisitor extends Visito
         // add xmlschema:fixed
         setSchemaType(fixedSimpleType);
 
-        
+
         // corba:fixed
         Fixed corbaFixed = new Fixed();
         corbaFixed.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
@@ -121,7 +121,7 @@ public class FixedVisitor extends Visito
         corbaFixed.setRepositoryID(scopedName.toIDLRepositoryID());
         //corbaFixed.setType(Constants.XSD_DECIMAL);
         corbaFixed.setType(fixedSimpleType.getQName());
-        
+
         // add corba:fixed
         setCorbaType(corbaFixed);
     }

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ObjectReferenceVisitor.java Sun Oct 17 02:26:06 2010
@@ -44,25 +44,26 @@ import org.apache.ws.commons.schema.XmlS
 import org.apache.ws.commons.schema.XmlSchemaAppInfo;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaExternal;
 import org.apache.ws.commons.schema.XmlSchemaImport;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaObject;
 import org.apache.ws.commons.schema.XmlSchemaType;
 import org.apache.ws.commons.schema.utils.NamespaceMap;
 
 public class ObjectReferenceVisitor extends VisitorBase {
-    
+
     private WSDLASTVisitor objRefWsdlVisitor;
-    
+
     public ObjectReferenceVisitor(Scope scope,
                                   Definition defn,
                                   XmlSchema schemaRef,
                                   WSDLASTVisitor wsdlVisitor) {
         super(scope, defn, schemaRef, wsdlVisitor);
         objRefWsdlVisitor = wsdlVisitor;
-        
+
     }
 
-    public static boolean accept(Scope scope, XmlSchema s, 
+    public static boolean accept(Scope scope, XmlSchema s,
                                  Definition def, AST node, WSDLASTVisitor wsdlVisitor) {
         boolean result = false;
         if (node.getType() == IDLTokenTypes.LITERAL_Object) {
@@ -72,19 +73,19 @@ public class ObjectReferenceVisitor exte
         }
         return result;
     }
-    
+
     public void visit(AST node) {
         if (!objRefWsdlVisitor.getDeclaredWSAImport()) {
             addWSAddressingImport(schema);
         }
         objRefWsdlVisitor.setDeclaredWSAImport(true);
-        
-        // There are two types of object references we can encounter.  Each one 
+
+        // There are two types of object references we can encounter.  Each one
         // requires us to do something differnt so we'll have methods for each
         // type. Also need to check if its a forward declared object reference.
         if (isForwardDeclaredReference(getScope(), schema, node, scopedNames, wsdlVisitor)) {
-            visitForwardDeclaredObjectReference(getScope(), schemas, schema, 
-                                                node, scopedNames, wsdlVisitor);             
+            visitForwardDeclaredObjectReference(getScope(), schemas, schema,
+                                                node, scopedNames, wsdlVisitor);
         } else if (node.getType() == IDLTokenTypes.LITERAL_Object) {
             visitDefaultTypeObjectReference(node);
         } else {
@@ -92,7 +93,7 @@ public class ObjectReferenceVisitor exte
             visitCustomTypeObjectReference(node);
         }
     }
-    
+
     private void visitDefaultTypeObjectReference(AST node) {
         // Even though we don't need to add a schema definition for a default endpoint
         // type, we still need to create a schema type so that the visitor knows what
@@ -111,24 +112,27 @@ public class ObjectReferenceVisitor exte
         if (wsaSchema == null) {
             wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
         }
-        XmlSchemaType objectType = new XmlSchemaType(wsaSchema);
+        /*
+         * TODO: This anonymous type is ridiculous, but I don't understand this code.
+         */
+        XmlSchemaType objectType = new XmlSchemaType(wsaSchema, false) { };
         objectType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
         setSchemaType(objectType);
-        
+
         // Build and assign the corba:object to the visitor
         Object corbaObject = new Object();
         corbaObject.setQName(new QName(typeMap.getTargetNamespace(), "CORBA.Object"));
         corbaObject.setRepositoryID("IDL:omg.org/CORBA/Object/1.0");
         corbaObject.setType(objectType.getQName());
         setCorbaType(corbaObject);
-        
+
         // Add the object definition to the typemap.  We only need to add the default
         // type once.
         if (!isReferenceCORBATypeDefined(corbaObject.getQName())) {
             typeMap.getStructOrExceptionOrUnion().add(corbaObject);
-        } 
+        }
     }
-    
+
     private void visitCustomTypeObjectReference(AST node) {
         QName bindingName = null;
         QName referenceName = null;
@@ -157,7 +161,7 @@ public class ObjectReferenceVisitor exte
 
             }
         }
-                
+
         if (bindingName == null) {
 
            // Global scope is our last chance to resolve the node
@@ -184,13 +188,13 @@ public class ObjectReferenceVisitor exte
             repositoryID = customScope.toIDLRepositoryID();
             bindingName = getBindingQNameByID(definition, repositoryID, objRefWsdlVisitor);
         }
-        
+
         if (bindingName == null) {
             // We need to have a binding for this kind of object reference to work
             throw new RuntimeException("[ObjectReferenceVisitor: No binding available for endpoint]");
         }
 
-        // Create a schema namespace for WS addressing and use it to create an endpoint 
+        // Create a schema namespace for WS addressing and use it to create an endpoint
         // reference type.  This will be used as the type for our endpoint reference.
         XmlSchema scs[] = schemas.getXmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE);
         XmlSchema wsaSchema = null;
@@ -205,15 +209,15 @@ public class ObjectReferenceVisitor exte
         if (wsaSchema == null) {
             wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
         }
-        XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
+        XmlSchemaType wsaType = new XmlSchemaType(wsaSchema, false) { };
         wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
-        
+
         // Check to see if we have already defined an element for this reference type.  If
         // we have, then there is no need to add it to the schema again.
-        isDuplicateReference(referenceName, bindingName, customScope, wsaType, node);        
+        isDuplicateReference(referenceName, bindingName, customScope, wsaType, node);
 
         setSchemaType(wsaType);
-        
+
         // Build and assign the corba:object to the visitor
         Object corbaObject = new Object();
         corbaObject.setBinding(bindingName);
@@ -221,15 +225,15 @@ public class ObjectReferenceVisitor exte
         corbaObject.setRepositoryID(repositoryID);
         corbaObject.setType(wsaType.getQName());
         setCorbaType(corbaObject);
-        
+
         // Add the object definition to the typemap.  We only need to add the default
         // type once.
         if (!isReferenceCORBATypeDefined(corbaObject.getQName())) {
             typeMap.getStructOrExceptionOrUnion().add(corbaObject);
-        } 
+        }
     }
-    
-    private void isDuplicateReference(QName referenceName, QName bindingName, Scope refScope, 
+
+    private void isDuplicateReference(QName referenceName, QName bindingName, Scope refScope,
                                       XmlSchemaType wsaType, AST node) {
         XmlSchema refSchema = null;
         if (!mapper.isDefaultMapping()) {
@@ -246,19 +250,18 @@ public class ObjectReferenceVisitor exte
         } else {
             refSchema = schema;
         }
-        
+
         // Check to see if we have already defined an element for this reference type.  If
         // we have, then there is no need to add it to the schema again.
         if (!isReferenceSchemaTypeDefined(referenceName, refSchema)) {
             // We need to add a new element definition to the schema section of our WSDL.
             // For custom endpoint types, this should contain an annotation which points
             // to the binding which will be used for this endpoint type.
-            XmlSchemaElement refElement = new XmlSchemaElement();
-            refElement.setQName(referenceName);
+            XmlSchemaElement refElement = new XmlSchemaElement(schema, true);
             refElement.setName(referenceName.getLocalPart());
             refElement.setSchemaType(wsaType);
             refElement.setSchemaTypeName(wsaType.getQName());
-      
+
             // Create an annotation which contains the CORBA binding for the element
             XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
             XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo();
@@ -267,22 +270,19 @@ public class ObjectReferenceVisitor exte
                 Document doc = db.newDocument();
                 Element el = doc.createElement("appinfo");
                 el.setTextContent("corba:binding=" + bindingName.getLocalPart());
-                // TODO: This is correct but the appinfo markup is never added to the 
+                // TODO: This is correct but the appinfo markup is never added to the
                 // schema.  Investigate.
                 appInfo.setMarkup(el.getChildNodes());
             } catch (ParserConfigurationException ex) {
                 throw new RuntimeException("[ObjectReferenceVisitor: error creating endpoint schema]");
             }
-            
+
             annotation.getItems().add(appInfo);
-            
-            refElement.setAnnotation(annotation);
 
-            refSchema.getElements().add(referenceName, refElement);
-            refSchema.getItems().add(refElement);
-        }        
+            refElement.setAnnotation(annotation);
+        }
     }
-    
+
     private boolean isReferenceCORBATypeDefined(QName objectReferenceName) {
         // Get the list of all corba types already defined and look for the provided
         // QName.  If we have defined this type, we don't need to add it to the typemap
@@ -299,97 +299,92 @@ public class ObjectReferenceVisitor exte
 
     private boolean isReferenceSchemaTypeDefined(QName objectReferenceName,
                                                  XmlSchema refSchema) {
-        XmlSchemaObjectCollection schemaObjects = refSchema.getItems();
+        List<XmlSchemaObject> schemaObjects = refSchema.getItems();
 
-        for (Iterator iter = schemaObjects.getIterator(); iter.hasNext();) {
-            java.lang.Object schemaObj = iter.next();
-            
+        for (XmlSchemaObject schemaObj : schemaObjects) {
             if (schemaObj instanceof XmlSchemaElement) {
                 XmlSchemaElement el = (XmlSchemaElement)schemaObj;
-                
+
                 if (el.getName().equals(objectReferenceName.getLocalPart())) {
                     return true;
                 }
             }
         }
-        
+
         return false;
     }
-    
+
     private void addWSAddressingImport(XmlSchema s) {
         boolean alreadyImported = false;
-        for (Iterator i = s.getIncludes().getIterator(); i.hasNext();) {
-            java.lang.Object o = i.next();
-            if (o instanceof XmlSchemaImport) {
-                XmlSchemaImport schemaImport = (XmlSchemaImport)o;
+        for (XmlSchemaExternal ext : s.getExternals()) {
+            if (ext instanceof XmlSchemaImport) {
+                XmlSchemaImport schemaImport = (XmlSchemaImport)ext;
                 if (schemaImport.getNamespace().equals(ReferenceConstants.WSADDRESSING_NAMESPACE)) {
                     alreadyImported = true;
                     break;
                 }
             }
         }
-        
+
         if (!alreadyImported) {
             // We need to add an import statement to include the WS addressing types
-            XmlSchemaImport wsaImport = new XmlSchemaImport();
+            XmlSchemaImport wsaImport = new XmlSchemaImport(s);
             wsaImport.setNamespace(ReferenceConstants.WSADDRESSING_NAMESPACE);
             wsaImport.setSchemaLocation(ReferenceConstants.WSADDRESSING_LOCATION);
-            s.getItems().add(wsaImport);
-            s.getIncludes().add(wsaImport);
         }
-        
+
         // Add the addressing namespace to the WSDLs list of namespaces.
         definition.addNamespace(ReferenceConstants.WSADDRESSING_PREFIX,
                                 ReferenceConstants.WSADDRESSING_NAMESPACE);
-        
+
         try {
             // This is used to get the correct prefix in the schema section of
-            // the wsdl.  If we don't have this, then this namespace gets an 
+            // the wsdl.  If we don't have this, then this namespace gets an
             // arbitrary prefix (e.g. ns5 instead of wsa).
             NamespaceMap nsMap = (NamespaceMap)s.getNamespaceContext();
             if (nsMap == null) {
                 nsMap = new NamespaceMap();
-                nsMap.add(ReferenceConstants.WSADDRESSING_PREFIX, 
+                nsMap.add(ReferenceConstants.WSADDRESSING_PREFIX,
                           ReferenceConstants.WSADDRESSING_NAMESPACE);
                 s.setNamespaceContext(nsMap);
             } else {
-                nsMap.add(ReferenceConstants.WSADDRESSING_PREFIX, 
+                nsMap.add(ReferenceConstants.WSADDRESSING_PREFIX,
                           ReferenceConstants.WSADDRESSING_NAMESPACE);
             }
         } catch (ClassCastException ex) {
-            // Consume the exception.  It is still OK with the default prefix, 
+            // Consume the exception.  It is still OK with the default prefix,
             // just not as clear.
         }
-        
+
     }
-    
-    private static QName getBindingQNameByID(Definition wsdlDef, String repositoryID, 
+
+    private static QName getBindingQNameByID(Definition wsdlDef, String repositoryID,
                                              WSDLASTVisitor wsdlVisitor) {
         // We need to find the binding which corresponds with the given repository ID.
-        // This is specified in the schema definition for a custom endpoint 
+        // This is specified in the schema definition for a custom endpoint
         // reference type.
         Collection bindings = wsdlDef.getBindings().values();
         if (bindings.isEmpty() && !wsdlVisitor.getModuleToNSMapper().isDefaultMapping()) {
-            // If we are not using the default mapping, then the binding definitions are not 
-            // located in the current Definition object, but nistead in the root Definition 
+            // If we are not using the default mapping, then the binding definitions are not
+            // located in the current Definition object, but nistead in the root Definition
             bindings = wsdlVisitor.getDefinition().getBindings().values();
         }
-        
+
         for (Iterator iter = bindings.iterator(); iter.hasNext();) {
             Binding b = (Binding)iter.next();
             List extElements = b.getExtensibilityElements();
-            
+
             for (Iterator extIter = extElements.iterator(); extIter.hasNext();) {
                 java.lang.Object element = extIter.next();
-                
+
                 if (element instanceof BindingType) {
-                    BindingType bt = (BindingType)element;                    
+                    BindingType bt = (BindingType)element;
                     if (bt.getRepositoryID().equals(repositoryID)) {
                         if (wsdlVisitor.getSupportPolymorphicFactories()) {
                             return new QName(b.getQName().getNamespaceURI(),
                                              "InferFromTypeId",
                                              b.getQName().getPrefix());
-            
+
                         } else {
                             return b.getQName();
                         }
@@ -397,15 +392,15 @@ public class ObjectReferenceVisitor exte
                 }
             }
         }
-        
+
         return null;
     }
-    
+
     protected static boolean isForwardDeclaredReference(Scope scope, XmlSchema schema, AST node,
                                                ScopeNameCollection scopedNames, WSDLASTVisitor wsdlVisitor) {
         boolean isForward = false;
         Scope currentScope = scope;
-        
+
         // Check for forward declaration from local scope outwards
         if ((node.getFirstChild() == null)
             || (node.getFirstChild() != null && node.getFirstChild().getType() != IDLTokenTypes.SCOPEOP)) {
@@ -422,7 +417,7 @@ public class ObjectReferenceVisitor exte
                 }
                 currentScope = currentScope.getParent();
                 //fqName = scopedName;
-            }            
+            }
         }
         // Check for forward declaration in global scope
         if (!isForward) {
@@ -433,28 +428,28 @@ public class ObjectReferenceVisitor exte
                 //scopedName = scope;
                 scopedName = new Scope(new Scope(), node);
             }
-            if (scopedNames.getScope(scopedName) != null) {                
+            if (scopedNames.getScope(scopedName) != null) {
                 isForward = true;
             }
             //fqName = scopedName;
-        }                
+        }
 
         return isForward;
     }
-          
-    protected void visitForwardDeclaredObjectReference(Scope scope, 
-                                                       XmlSchemaCollection schemas, 
+
+    protected void visitForwardDeclaredObjectReference(Scope scope,
+                                                       XmlSchemaCollection schemas,
                                                        XmlSchema schema, AST node,
-                                                       ScopeNameCollection scopedNames, 
+                                                       ScopeNameCollection scopedNames,
                                                        WSDLASTVisitor wsdlVisitor) {
-     
-        XmlSchemaType result = null; 
+
+        XmlSchemaType result = null;
         Scope currentScope = scope;
-        
+
         // checks from innermost local scope outwards
         if ((node.getFirstChild() == null)
             || (node.getFirstChild() != null && node.getFirstChild().getType() != IDLTokenTypes.SCOPEOP)) {
-            while (result == null && currentScope != currentScope.getParent()) {                
+            while (result == null && currentScope != currentScope.getParent()) {
                 Scope scopedName = null;
                 if (ScopedNameVisitor.isFullyScopedName(node)) {
                     scopedName = ScopedNameVisitor.getFullyScopedName(currentScope, node);
@@ -476,11 +471,11 @@ public class ObjectReferenceVisitor exte
                     // if not, create a new one and create the WS-Addressing EndpointReferenceType
                     if (wsaSchema == null) {
                         wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
-                        XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
+                        XmlSchemaType wsaType = new XmlSchemaType(wsaSchema, false) { };
                         wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
                         result = wsaType;
                     }
-                }                
+                }
                 currentScope = currentScope.getParent();
             }
         }
@@ -506,49 +501,49 @@ public class ObjectReferenceVisitor exte
                 // if not, create a new one and create the WS-Addressing EndpointReferenceType
                 if (wsaSchema == null) {
                     wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
-                    XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
+                    XmlSchemaType wsaType = new XmlSchemaType(wsaSchema, false) { };
                     wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
                     result = wsaType;
                 }
             }
         }
-        
+
         setSchemaType(result);
     }
 
-    private static boolean hasBinding(Scope scope, XmlSchema s, Definition def, 
+    private static boolean hasBinding(Scope scope, XmlSchema s, Definition def,
                                       AST node, WSDLASTVisitor wsdlVisitor) {
         boolean result = false;
         QName bindingName = null;
         String repositoryID = null;
         Scope currentScope = scope;
         Scope customScope = null;
-        if ((node.getFirstChild() == null) || (node.getFirstChild() != null 
-            && node.getFirstChild().getType() != IDLTokenTypes.SCOPEOP)) {        
+        if ((node.getFirstChild() == null) || (node.getFirstChild() != null
+            && node.getFirstChild().getType() != IDLTokenTypes.SCOPEOP)) {
             while (bindingName == null
-                && currentScope != currentScope.getParent()) {                
+                && currentScope != currentScope.getParent()) {
                 if (ScopedNameVisitor.isFullyScopedName(node)) {
-                    customScope = ScopedNameVisitor.getFullyScopedName(currentScope, node);                
+                    customScope = ScopedNameVisitor.getFullyScopedName(currentScope, node);
                 } else {
-                    customScope = new Scope(currentScope, node);                    
+                    customScope = new Scope(currentScope, node);
                 }
                 repositoryID = customScope.toIDLRepositoryID();
                 bindingName = getBindingQNameByID(def, repositoryID, wsdlVisitor);
                 currentScope = currentScope.getParent();
             }
         }
-                
+
         if (bindingName == null) {
-            // Global scope is our last chance to resolve the node               
+            // Global scope is our last chance to resolve the node
             if (ScopedNameVisitor.isFullyScopedName(node)) {
                 customScope = ScopedNameVisitor.getFullyScopedName(new Scope(), node);
-            } else {                
+            } else {
                 customScope = new Scope(new Scope(), node);
             }
             repositoryID = customScope.toIDLRepositoryID();
             bindingName = getBindingQNameByID(def, repositoryID, wsdlVisitor);
         }
-        
+
         if (bindingName != null) {
             result = true;
         }

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/OperationVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/OperationVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/OperationVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/OperationVisitor.java Sun Oct 17 02:26:06 2010
@@ -54,22 +54,22 @@ public class OperationVisitor extends Vi
 
     private static final String REQUEST_SUFFIX = "Request";
     private static final String RESPONSE_SUFFIX = "Response";
-    
+
     private static final String IN_PARAMETER = "inparameter";
     private static final String OUT_PARAMETER = "outparameter";
     //private static final String INOUT_PARAMETER = "inoutparameter";
     private static final String RETURN_PARAMETER = "return";
-    
+
     private ExtensionRegistry extReg;
     private PortType portType;
     private Binding binding;
-    
+
     private Message inputMsg;
     private Message outputMsg;
-    
-    
+
+
     private OperationType corbaOperation;
-    
+
     public OperationVisitor(Scope scope,
                             Definition defn,
                             XmlSchema schemaRef,
@@ -81,7 +81,7 @@ public class OperationVisitor extends Vi
         portType = wsdlPortType;
         binding = wsdlBinding;
     }
-    
+
     public static boolean accept(Scope scope,
                                  Definition def,
                                  XmlSchema schema,
@@ -103,7 +103,7 @@ public class OperationVisitor extends Vi
         }
         return result;
     }
-    
+
     public void visit(AST node) {
         // <op_dcl> ::= [<op_attribute>] <op_type_spec>
         //              <identifier> <parameter_dcls>
@@ -114,14 +114,14 @@ public class OperationVisitor extends Vi
         // <parameter_dcls> ::= "(" <param_dcl> {"," <param_dcl>}* ")"
         //                    | "(" ")"
         // <raises_expr> ::= "raises" "(" <scoped_name> {"," <scoped_name>}* ")"
-        // <context_expr> ::= "context" "(" <string_literal> {"," <string_literal>}* ")"     
+        // <context_expr> ::= "context" "(" <string_literal> {"," <string_literal>}* ")"
 
         QName operationQName = new QName(schema.getTargetNamespace(), node.toString());
         boolean isDuplicate = false;
-        if (schema.getElements().contains(operationQName)) {
+        if (schema.getElements().containsKey(operationQName)) {
             isDuplicate = true;
         }
-  
+
         Operation operation = generateOperation(operationQName.getLocalPart(), isDuplicate);
 
         BindingOperation bindingOperation = null;
@@ -130,7 +130,7 @@ public class OperationVisitor extends Vi
         } else {
             bindingOperation = generateBindingOperation(binding, operation, operation.getName());
         }
-        
+
         XmlSchemaSequence inputWrappingSequence = new XmlSchemaSequence();
         XmlSchemaElement inputElement = generateWrapper(new QName(schema.getTargetNamespace(),
                                                                   operation.getName()),
@@ -154,12 +154,12 @@ public class OperationVisitor extends Vi
                                                       operation.getName() + RESPONSE_SUFFIX),
                                             outputWrappingSequence);
             outputMsg = generateOutputMessage(operation, bindingOperation);
-            generateOutputPart(outputMsg, outputElement);           
+            generateOutputPart(outputMsg, outputElement);
         }
-        
+
         // <op_type_spec>
         visitOpTypeSpec(node, outputWrappingSequence);
-        
+
         // <parameter_dcls>
         node = TypesUtils.getCorbaTypeNameNode(node);
         while (ParamDclVisitor.accept(node)) {
@@ -177,30 +177,30 @@ public class OperationVisitor extends Vi
         }
 
         // <raises_expr>
-        if (node != null 
+        if (node != null
             && node.getType() == IDLTokenTypes.LITERAL_raises) {
             node = node.getFirstChild();
-            
-            while (node != null) {            
-                // 
+
+            while (node != null) {
+                //
                 ScopedNameVisitor visitor = new ScopedNameVisitor(getScope(),
                                                                   definition,
                                                                   schema,
-                                                                  wsdlVisitor);                
+                                                                  wsdlVisitor);
                 visitor.setExceptionMode(true);
-                visitor.visit(node);                
+                visitor.visit(node);
                 CorbaTypeImpl corbaType = visitor.getCorbaType();
                 XmlSchemaType schemaType = visitor.getSchemaType();
                 //REVISIT, schema type ends with Type for exceptions, so strip it to get the element name.
                 int pos = schemaType.getQName().getLocalPart().indexOf("Type");
                 QName elementQName = new QName(schemaType.getQName().getNamespaceURI(),
                                                schemaType.getQName().getLocalPart().substring(0, pos));
-                createFaultMessage(corbaType, operation, bindingOperation, elementQName);                
+                createFaultMessage(corbaType, operation, bindingOperation, elementQName);
                 node = node.getNextSibling();
                 visitor.setExceptionMode(false);
             }
         }
-        
+
     }
 
     private Operation generateOperation(String name, boolean isDuplicate) {
@@ -217,7 +217,7 @@ public class OperationVisitor extends Vi
         portType.addOperation(op);
         return op;
     }
-    
+
     private BindingOperation generateBindingOperation(Binding wsdlBinding, Operation op,
                                                       String corbaOpName) {
         BindingOperation bindingOperation = definition.createBindingOperation();
@@ -246,29 +246,29 @@ public class OperationVisitor extends Vi
             msgName = new QName(definition.getTargetNamespace(),
                                 getScope().tail() + "." + operation.getName());
         } else {
-            msgName = new QName(definition.getTargetNamespace(), operation.getName()); 
+            msgName = new QName(definition.getTargetNamespace(), operation.getName());
         }
         msg.setQName(msgName);
         msg.setUndefined(false);
-        
+
         String inputName = operation.getName() + REQUEST_SUFFIX;
         Input input = definition.createInput();
         input.setName(inputName);
         input.setMessage(msg);
-        
+
         BindingInput bindingInput = definition.createBindingInput();
-        bindingInput.setName(inputName);    
-        
+        bindingInput.setName(inputName);
+
         bindingOperation.setBindingInput(bindingInput);
         operation.setInput(input);
-        
+
         definition.addMessage(msg);
-        
+
         return msg;
     }
 
     public Message generateOutputMessage(Operation operation, BindingOperation bindingOperation) {
-        Message msg = definition.createMessage(); 
+        Message msg = definition.createMessage();
         QName msgName;
         if (!mapper.isDefaultMapping()) {
             //mangle the message name
@@ -277,34 +277,34 @@ public class OperationVisitor extends Vi
                                 getScope().tail() + "." + operation.getName() + RESPONSE_SUFFIX);
         } else {
             msgName = new QName(definition.getTargetNamespace(),
-                                operation.getName() + RESPONSE_SUFFIX); 
+                                operation.getName() + RESPONSE_SUFFIX);
         }
         msg.setQName(msgName);
         msg.setUndefined(false);
-        
+
         String outputName = operation.getName() + RESPONSE_SUFFIX;
         Output output = definition.createOutput();
         output.setName(outputName);
         output.setMessage(msg);
-        
+
         BindingOutput bindingOutput = definition.createBindingOutput();
-        bindingOutput.setName(outputName);    
-        
+        bindingOutput.setName(outputName);
+
         bindingOperation.setBindingOutput(bindingOutput);
         operation.setOutput(output);
-        
+
         definition.addMessage(msg);
-        
+
         return msg;
     }
-    
+
     private Part generateInputPart(Message inputMessage, XmlSchemaElement element) {
-        // message - part 
+        // message - part
         Part part = definition.createPart();
         part.setName(IN_PARAMETER);
         part.setElementName(element.getQName());
         inputMessage.addPart(part);
-        return part;        
+        return part;
     }
 
     private Part generateOutputPart(Message outputMessage, XmlSchemaElement element) {
@@ -315,7 +315,7 @@ public class OperationVisitor extends Vi
         outputMessage.addPart(part);
         return part;
     }
-    
+
     /*-
      * Build the Wrapped Document Style wrapping elements
      * i.e. <xs:element name="...">
@@ -327,17 +327,13 @@ public class OperationVisitor extends Vi
      *      </xs:element>
      */
     private XmlSchemaElement generateWrapper(QName el, XmlSchemaSequence wrappingSequence) {
-        XmlSchemaComplexType schemaComplexType = new XmlSchemaComplexType(schema);
+        XmlSchemaComplexType schemaComplexType = new XmlSchemaComplexType(schema, false);
         schemaComplexType.setParticle(wrappingSequence);
-        
-        XmlSchemaElement wrappingSchemaElement = new XmlSchemaElement();
-        wrappingSchemaElement.setQName(el);
+
+        XmlSchemaElement wrappingSchemaElement = new XmlSchemaElement(schema, true);
         wrappingSchemaElement.setName(el.getLocalPart());
         wrappingSchemaElement.setSchemaType(schemaComplexType);
 
-        schema.getElements().add(el, wrappingSchemaElement);
-        schema.getItems().add(wrappingSchemaElement);
-        
         return wrappingSchemaElement;
     }
 
@@ -345,7 +341,7 @@ public class OperationVisitor extends Vi
                                         XmlSchemaType schemaType,
                                         Scope fqName,
                                         String name) {
-        XmlSchemaElement element = new XmlSchemaElement();
+        XmlSchemaElement element = new XmlSchemaElement(schema, true);
         element.setName(name);
         if (schemaType != null) {
             element.setSchemaTypeName(schemaType.getQName());
@@ -354,14 +350,12 @@ public class OperationVisitor extends Vi
             }
         } else {
             wsdlVisitor.getDeferredActions().
-                add(fqName, new OperationDeferredAction(element));  
+                add(fqName, new OperationDeferredAction(element));
         }
-        
-        schemaSequence.getItems().add(element);
-        
+
         return element;
     }
-    
+
     private void visitOpTypeSpec(AST node, XmlSchemaSequence outputWrappingSequence) {
         if (node.getType() == IDLTokenTypes.LITERAL_void) {
             // nothing to do here, move along
@@ -373,11 +367,11 @@ public class OperationVisitor extends Vi
                                                                     wsdlVisitor);
 
             visitor.visit(node);
-            
+
             XmlSchemaType schemaType = visitor.getSchemaType();
             CorbaTypeImpl corbaType = visitor.getCorbaType();
             Scope fqName = visitor.getFullyQualifiedName();
-            
+
             addElement(outputWrappingSequence, schemaType, fqName, RETURN_PARAMETER);
             addCorbaReturn(corbaType, fqName, RETURN_PARAMETER);
         }
@@ -396,10 +390,10 @@ public class OperationVisitor extends Vi
     }
 
     private void createFaultMessage(CorbaTypeImpl corbaType,
-                                    Operation operation, 
+                                    Operation operation,
                                     BindingOperation bindingOperation,
                                     QName elementQName) {
-        String exceptionName = corbaType.getQName().getLocalPart();        
+        String exceptionName = corbaType.getQName().getLocalPart();
 
         Definition faultDef = manager.getWSDLDefinition(elementQName.getNamespaceURI());
         if (faultDef == null) {
@@ -412,23 +406,23 @@ public class OperationVisitor extends Vi
 
         // porttype - operation - fault
         Fault fault = definition.createFault();
-        fault.setMessage(faultMsg);        
-        fault.setName(faultMsg.getQName().getLocalPart());        
+        fault.setMessage(faultMsg);
+        fault.setName(faultMsg.getQName().getLocalPart());
         operation.addFault(fault);
 
         // binding - operation - corba:operation - corba:raises
-        RaisesType raisesType = new RaisesType();        
+        RaisesType raisesType = new RaisesType();
         raisesType.setException(new QName(typeMap.getTargetNamespace(),
                                           exceptionName));
         corbaOperation.getRaises().add(raisesType);
 
         // binding - operation - fault
-        BindingFault bindingFault = definition.createBindingFault();        
-        bindingFault.setName(faultMsg.getQName().getLocalPart());        
-        bindingOperation.addBindingFault(bindingFault);    
+        BindingFault bindingFault = definition.createBindingFault();
+        bindingFault.setName(faultMsg.getQName().getLocalPart());
+        bindingOperation.addBindingFault(bindingFault);
 
         //add the fault element namespace to the definition
         String nsURI = elementQName.getNamespaceURI();
-        manager.addWSDLDefinitionNamespace(definition, mapper.mapNSToPrefix(nsURI), nsURI);    
+        manager.addWSDLDefinitionNamespace(definition, mapper.mapNSToPrefix(nsURI), nsURI);
     }
 }

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ParamDclVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ParamDclVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ParamDclVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ParamDclVisitor.java Sun Oct 17 02:26:06 2010
@@ -35,10 +35,10 @@ import org.apache.ws.commons.schema.XmlS
 
 public class ParamDclVisitor extends VisitorBase {
 
-    private XmlSchemaSequence inWrappingSequence; 
+    private XmlSchemaSequence inWrappingSequence;
     private XmlSchemaSequence outWrappingSequence;
     private OperationType corbaOperation;
-    
+
     public ParamDclVisitor(Scope scope,
                            Definition defn,
                            XmlSchema schemaRef,
@@ -62,7 +62,7 @@ public class ParamDclVisitor extends Vis
         }
         return result;
     }
-    
+
     public void visit(AST node) {
         // <param_dcl> ::= <param_attribute> <param_type_spec> <simple_declarator>
         // <param_attribute> ::= "in"
@@ -79,14 +79,14 @@ public class ParamDclVisitor extends Vis
         XmlSchemaType schemaType = visitor.getSchemaType();
         CorbaTypeImpl corbaType = visitor.getCorbaType();
         Scope fullyQualifiedName = visitor.getFullyQualifiedName();
-        
+
         switch (node.getType()) {
-        case IDLTokenTypes.LITERAL_in: 
+        case IDLTokenTypes.LITERAL_in:
             addElement(inWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
             addCorbaParam(corbaType, ModeType.IN, nameNode.toString(), fullyQualifiedName);
             break;
         case IDLTokenTypes.LITERAL_out:
-            addElement(outWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName); 
+            addElement(outWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
             addCorbaParam(corbaType, ModeType.OUT, nameNode.toString(), fullyQualifiedName);
             break;
         case IDLTokenTypes.LITERAL_inout:
@@ -97,7 +97,7 @@ public class ParamDclVisitor extends Vis
         default:
             throw new RuntimeException("[ParamDclVisitor: illegal IDL!]");
         }
-        
+
         setSchemaType(schemaType);
         setCorbaType(corbaType);
     }
@@ -106,7 +106,7 @@ public class ParamDclVisitor extends Vis
                                         XmlSchemaType schemaType,
                                         String name,
                                         Scope fullyQualifiedName) {
-        XmlSchemaElement element = new XmlSchemaElement();
+        XmlSchemaElement element = new XmlSchemaElement(schema, false);
         element.setName(name);
         if (schemaType == null) {
             ParamDeferredAction elementAction;
@@ -122,7 +122,7 @@ public class ParamDclVisitor extends Vis
             }
             wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction);
 
-            //ParamDeferredAction elementAction = 
+            //ParamDeferredAction elementAction =
             //    new ParamDeferredAction(element);
             //wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction);
         } else {
@@ -135,16 +135,16 @@ public class ParamDclVisitor extends Vis
         return element;
     }
 
-    private void addCorbaParam(CorbaTypeImpl corbaType, ModeType mode, 
+    private void addCorbaParam(CorbaTypeImpl corbaType, ModeType mode,
                                String partName, Scope fullyQualifiedName) {
         ParamType param = new ParamType();
         param.setName(partName);
         param.setMode(mode);
-        if (corbaType ==  null) {            
-            ParamDeferredAction paramAction = 
+        if (corbaType ==  null) {
+            ParamDeferredAction paramAction =
                 new ParamDeferredAction(param);
             wsdlVisitor.getDeferredActions().add(fullyQualifiedName, paramAction);
-        } else {            
+        } else {
             param.setIdltype(corbaType.getQName());
         }
         corbaOperation.getParam().add(param);

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ParamDeferredAction.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ParamDeferredAction.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ParamDeferredAction.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ParamDeferredAction.java Sun Oct 17 02:26:06 2010
@@ -19,14 +19,13 @@
 
 package org.apache.cxf.tools.corba.processors.idl;
 
-import java.util.Iterator;
-
 import org.apache.cxf.binding.corba.wsdl.CorbaTypeImpl;
 import org.apache.cxf.binding.corba.wsdl.ParamType;
 import org.apache.cxf.tools.corba.common.ReferenceConstants;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaExternal;
 import org.apache.ws.commons.schema.XmlSchemaImport;
 import org.apache.ws.commons.schema.XmlSchemaType;
 
@@ -39,21 +38,21 @@ public class ParamDeferredAction impleme
     protected Scope typeScope;
     protected WSDLSchemaManager manager;
     protected ModuleToNSMapper mapper;
-    
+
     public ParamDeferredAction(ParamType defParam, XmlSchemaElement elem) {
         param = defParam;
-        element = elem;        
+        element = elem;
     }
-    
+
     public ParamDeferredAction(ParamType defParam) {
-        param = defParam;         
+        param = defParam;
     }
-    
+
     public ParamDeferredAction(XmlSchemaElement elem) {
-        element = elem;               
+        element = elem;
     }
-    
-    public ParamDeferredAction(XmlSchemaElement elem, 
+
+    public ParamDeferredAction(XmlSchemaElement elem,
                                Scope ts,
                                XmlSchema xmlSchema,
                                XmlSchemaCollection xmlSchemas,
@@ -66,7 +65,7 @@ public class ParamDeferredAction impleme
         manager = man;
         mapper = map;
     }
-    
+
     public void execute(XmlSchemaType stype, CorbaTypeImpl ctype) {
         if (param != null) {
             param.setIdltype(ctype.getQName());
@@ -76,41 +75,38 @@ public class ParamDeferredAction impleme
             if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
                 element.setNillable(true);
             }
-     
+
             if (manager == null) {
                 return;
             }
-            
+
             // Now we need to make sure we are importing any types we need
             XmlSchema importedSchema = null;
             if (stype.getQName().getNamespaceURI().equals(ReferenceConstants.WSADDRESSING_NAMESPACE)) {
                 boolean alreadyImported = false;
-                for (Iterator i = schema.getIncludes().getIterator(); i.hasNext();) {
-                    java.lang.Object o = i.next();
-                    if (o instanceof XmlSchemaImport) {
-                        XmlSchemaImport schemaImport = (XmlSchemaImport)o;
+                for (XmlSchemaExternal ext : schema.getExternals()) {
+                    if (ext instanceof XmlSchemaImport) {
+                        XmlSchemaImport schemaImport = (XmlSchemaImport)ext;
                         if (schemaImport.getNamespace().equals(ReferenceConstants.WSADDRESSING_NAMESPACE)) {
                             alreadyImported = true;
                             break;
                         }
                     }
                 }
-                    
+
                 if (!alreadyImported) {
                     // We need to add an import statement to include the WS addressing types
-                    XmlSchemaImport wsaImport = new XmlSchemaImport();
+                    XmlSchemaImport wsaImport = new XmlSchemaImport(schema);
                     wsaImport.setNamespace(ReferenceConstants.WSADDRESSING_NAMESPACE);
                     wsaImport.setSchemaLocation(ReferenceConstants.WSADDRESSING_LOCATION);
-                    schema.getItems().add(wsaImport);
-                    schema.getIncludes().add(wsaImport);
                 }
             } else if (!stype.getQName().getNamespaceURI().equals(schema.getTargetNamespace())) {
                 importedSchema = manager.getXmlSchema(mapper.map(typeScope));
                 manager.addXmlSchemaImport(schema, importedSchema, typeScope.toString("_"));
             }
-        }        
+        }
     }
-       
+
 }
 
 

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java?rev=1023402&r1=1023401&r2=1023402&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java Sun Oct 17 02:26:06 2010
@@ -40,7 +40,7 @@ public class SequenceVisitor extends Vis
     private static final String ELEMENT_NAME = "item";
 
     private AST identifierNode;
-    
+
     public SequenceVisitor(Scope scope,
                            Definition defn,
                            XmlSchema schemaRef,
@@ -49,23 +49,23 @@ public class SequenceVisitor extends Vis
         super(scope, defn, schemaRef, wsdlVisitor);
         identifierNode = identifierNodeRef;
     }
-    
+
     public static boolean accept(AST node) {
         if (node.getType() == IDLTokenTypes.LITERAL_sequence) {
             return true;
         }
         return false;
     }
-    
+
     public void visit(AST seq) {
         // <sequence_type> ::= "sequence" "<" <simple_type_spec> "," <positive_int_const> ">"
         //                   | "sequence" "<" <simple_type_spec> ">"
-        
-        
+
+
         AST simpleTypeSpecNode = seq.getFirstChild();
         // REVISIT: TypesUtils.getPrimitiveCorbaTypeNameNode should be renamed
         // to something more suitable and should be made more general.
-        AST boundNode = TypesUtils.getCorbaTypeNameNode(simpleTypeSpecNode); 
+        AST boundNode = TypesUtils.getCorbaTypeNameNode(simpleTypeSpecNode);
         //get chance to check if bound is symbol name which defined as const,
         //if so, replace the symbol name with defined const
         if (boundNode != null) {
@@ -74,18 +74,18 @@ public class SequenceVisitor extends Vis
                 boundNode.setText(constValue);
             }
         }
-        
+
         SimpleTypeSpecVisitor visitor = new SimpleTypeSpecVisitor(new Scope(getScope(), identifierNode),
                                                                   definition,
                                                                   schema,
                                                                   wsdlVisitor,
                                                                   null);
         visitor.visit(simpleTypeSpecNode);
-        
+
         XmlSchemaType stype = visitor.getSchemaType();
         CorbaTypeImpl ctype = visitor.getCorbaType();
         Scope fullyQualifiedName = visitor.getFullyQualifiedName();
-        
+
 
         long bound = -1;
         if (boundNode != null) {
@@ -99,14 +99,14 @@ public class SequenceVisitor extends Vis
         } else {
             scopedName = new Scope(getScope(), identifierNode);
         }
-              
-        XmlSchemaType schemaType = null;                
-        
+
+        XmlSchemaType schemaType = null;
+
         // According to CORBA Binding for WSDL specification,
         // idl:sequence<octet> maps to xs:base64Binary by default.
-        // 
+        //
         // wsdlVisitor.getSequenceOctetType() returns the XmlSchema type
-        // that idl:sequence<octet> should map to, as specified by the 
+        // that idl:sequence<octet> should map to, as specified by the
         // -s command line option or the default type xsd:base64Binary.
         //
         if (stype != null) {
@@ -118,7 +118,7 @@ public class SequenceVisitor extends Vis
         } else {
             schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
         }
-        
+
         CorbaTypeImpl corbaType = null;
         if (identifierNode == null) {
             corbaType = generateCorbaAnonsequence(ctype,
@@ -135,17 +135,17 @@ public class SequenceVisitor extends Vis
         }
 
 
-        setSchemaType(schemaType); 
+        setSchemaType(schemaType);
         setCorbaType(corbaType);
         setFullyQualifiedName(fullyQualifiedName);
     }
 
-    private XmlSchemaType generateSchemaType(XmlSchemaType stype, Scope scopedName, 
+    private XmlSchemaType generateSchemaType(XmlSchemaType stype, Scope scopedName,
                                              long bound, Scope fullyQualifiedName) {
-        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
+        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
         ct.setName(mapper.mapToQName(scopedName));
         XmlSchemaSequence sequence = new XmlSchemaSequence();
-        XmlSchemaElement el = new XmlSchemaElement();
+        XmlSchemaElement el = new XmlSchemaElement(schema, false);
         el.setName(ELEMENT_NAME);
         el.setMinOccurs(0);
         if (bound != -1) {
@@ -159,15 +159,15 @@ public class SequenceVisitor extends Vis
                 el.setNillable(true);
             }
         } else {
-            SequenceDeferredAction elementAction = 
+            SequenceDeferredAction elementAction =
                 new SequenceDeferredAction(el);
-            wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction); 
+            wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction);
         }
         sequence.getItems().add(el);
         ct.setParticle(sequence);
         return ct;
     }
-    
+
     private CorbaTypeImpl generateCorbaSequence(CorbaTypeImpl ctype,
                                                 XmlSchemaType schemaType,
                                                 Scope scopedName,
@@ -177,7 +177,7 @@ public class SequenceVisitor extends Vis
         Sequence corbaSeq = new Sequence();
         if (bound == -1) {
             bound = 0;
-        }                
+        }
         corbaSeq.setBound(bound);
         corbaSeq.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
         corbaSeq.setType(schemaType.getQName());
@@ -186,7 +186,7 @@ public class SequenceVisitor extends Vis
         if (ctype != null) {
             corbaSeq.setElemtype(ctype.getQName());
         } else {
-            SequenceDeferredAction seqAction = 
+            SequenceDeferredAction seqAction =
                 new SequenceDeferredAction(corbaSeq);
             wsdlVisitor.getDeferredActions().add(fullyQualifiedName, seqAction);
         }
@@ -204,37 +204,31 @@ public class SequenceVisitor extends Vis
         Anonsequence result = new Anonsequence();
         if (bound == -1) {
             bound = 0;
-        }                
+        }
         result.setBound(bound);
         result.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
         //REVISIT, if we add qualification then change the below.
         result.setElemname(new QName("", ELEMENT_NAME));
         if (schemaType == null || ctype == null) {
-            SequenceDeferredAction anonSeqAction = 
+            SequenceDeferredAction anonSeqAction =
                 new SequenceDeferredAction(result);
             wsdlVisitor.getDeferredActions().add(fullyQualifiedName, anonSeqAction);
         } else {
             result.setType(schemaType.getQName());
-            result.setElemtype(ctype.getQName());        
+            result.setElemtype(ctype.getQName());
         }
 
         // Need to create an action if the type was forward declared.
-        if (schemaType != null) {
-            if (schemas.getTypeByQName(schemaType.getQName()) == null 
-                && schema.getTypeByName(schemaType.getQName()) == null) {
-                schema.getItems().add(schemaType);
-                schema.addType(schemaType);
-            }
-        } else {
-            SequenceDeferredAction anonSeqAction = 
+        if (schemaType == null) {
+            SequenceDeferredAction anonSeqAction =
                 new SequenceDeferredAction(schemas, schema);
             wsdlVisitor.getDeferredActions().add(fullyQualifiedName, anonSeqAction);
         }
-        
+
         // add corbaType
         typeMap.getStructOrExceptionOrUnion().add(result);
-        
+
         return result;
     }
-    
+
 }



Mime
View raw message