incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eno...@apache.org
Subject svn commit: r529309 [1/3] - in /incubator/yoko/trunk/tools/src: main/java/org/apache/yoko/tools/processors/idl/ test/java/org/apache/yoko/tools/processors/ test/resources/idl/
Date Mon, 16 Apr 2007 16:19:36 GMT
Author: enolan
Date: Mon Apr 16 09:19:34 2007
New Revision: 529309

URL: http://svn.apache.org/viewvc?view=rev&rev=529309
Log:
Yoko-336 Add support for IDL interface forward declarators - this is only support for some types.
Working on the remaining interface support.

Added:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayDeferredAction.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeDeferredAction.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredAction.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionCollection.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionDeferredAction.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDeferredAction.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopeNameCollection.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceDeferredAction.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructDeferredAction.java   (with props)
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionDeferredAction.java   (with props)
    incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceArray.idl
    incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceAttributes.idl
    incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceException.idl
    incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceParam.idl
    incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceSequence.idl
    incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceStructUnion.idl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceArray.wsdl   (with props)
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceAttributes.wsdl   (with props)
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceException.wsdl   (with props)
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceParam.wsdl   (with props)
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceSequence.wsdl   (with props)
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceStructUnion.wsdl   (with props)
Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeclaratorVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PrimitiveTypesVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TemplateTypeSpecVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypedefVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypesVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Visitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/VisitorBase.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/WSDLASTVisitor.java
    incubator/yoko/trunk/tools/src/test/java/org/apache/yoko/tools/processors/IDLToWSDLGenerationTest.java
    incubator/yoko/trunk/tools/src/test/resources/idl/scopingObjectRef.idl

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayDeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayDeferredAction.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayDeferredAction.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayDeferredAction.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.schemas.yoko.bindings.corba.Anonarray;
+import org.apache.schemas.yoko.bindings.corba.Array;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class ArrayDeferredAction extends DeferredActionBase {
+
+    protected Array array;
+    protected Anonarray anonarray;
+    protected XmlSchemaElement element;
+    
+    
+    public ArrayDeferredAction(Array arrayType, Anonarray anonArrayType,
+                               XmlSchemaElement elem,  Scope scope) {                           
+        super(scope);
+        array = arrayType;
+        anonarray = anonArrayType;
+        element = elem;        
+    }
+    
+    public ArrayDeferredAction(Array arrayType, Scope scope) {                           
+        super(scope);
+        array = arrayType;         
+    }
+    
+    public ArrayDeferredAction(Anonarray anonarrayType, Scope scope) {                           
+        super(scope);
+        anonarray = anonarrayType;         
+    }
+    
+    public ArrayDeferredAction(XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        element = elem;               
+    }
+    
+    public void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        if (array != null) {
+            array.setType(ctype.getQName());
+        }
+        if (anonarray != null) {
+            anonarray.setType(ctype.getQName());
+        }
+        if (element != null) {
+            element.setSchemaTypeName(stype.getQName());
+        }        
+    }
+        
+}
+
+
+

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayDeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayDeferredAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ArrayVisitor.java Mon Apr 16 09:19:34 2007
@@ -37,17 +37,19 @@
 
     private AST identifierNode;
     private XmlSchemaType schemaType;
-    private CorbaTypeImpl corbaType;
+    private CorbaTypeImpl corbaType;    
     
     public ArrayVisitor(Scope scope,
                         WSDLASTVisitor wsdlVisitor,
                         XmlSchemaType schemaTypeRef,
                         CorbaTypeImpl corbaTypeRef,
-                        AST identifierNodeRef) {
+                        AST identifierNodeRef,
+                        Scope fqName) {
         super(scope, wsdlVisitor);
+        setFullyQualifiedName(fqName);
         identifierNode = identifierNodeRef;
         schemaType = schemaTypeRef;
-        corbaType = corbaTypeRef;
+        corbaType = corbaTypeRef;        
     }
 
     public static boolean accept(AST node) {
@@ -83,11 +85,12 @@
         
         // process all anonarrays, skip first array as it might not be anonymous
         if (nextSizeNode != null) {
-            result = doAnonarray(nextSizeNode, schemaType.getQName(), corbaType.getQName());
+            result = doAnonarray(nextSizeNode, schemaType, corbaType);
         } else {
             result = new Types();
             result.setSchemaType(schemaType);
             result.setCorbaType(corbaType);
+            result.setFullyQualifiedName(getFullyQualifiedName());
         }
         
         // process first array
@@ -96,17 +99,47 @@
         CorbaTypeImpl ctype = null;
         if (identifierNode != null) {
             Scope scopedName = getScope();
-            stype = generateSchemaArray(scopedName.toString(), size, result.getSchemaType().getQName());
-            ctype = generateCorbaArray(scopedName, size, result.getCorbaType().getQName());
+            /*stype = generateSchemaArray(scopedName.toString(), size, 
+                                        result.getSchemaType().getQName(), result.getFullyQualifiedName());
+            ctype = generateCorbaArray(scopedName, size, 
+                                       result.getCorbaType().getQName(),
+                                       getFullyQualifiedName());*/
+            if (result.getSchemaType() != null) {
+                stype = generateSchemaArray(scopedName.toString(), size, 
+                                            result.getSchemaType(), 
+                                            result.getFullyQualifiedName());
+            } else {
+                stype = generateSchemaArray(scopedName.toString(), size, 
+                                            null, result.getFullyQualifiedName());
+            }
+            if (result.getCorbaType() != null) {
+                ctype = generateCorbaArray(scopedName, size, result.getCorbaType(),
+                                           getFullyQualifiedName());
+            } else {
+                ctype = generateCorbaArray(scopedName, size, null,
+                                           getFullyQualifiedName());
+            }
         } else {
             // anonymous array
             Scope scopedName = TypesUtils.generateAnonymousScopedName(getScope(), schema);
-            stype = generateSchemaArray(scopedName.toString(),
-                                        size,
-                                        result.getSchemaType().getQName());
-            ctype = generateCorbaAnonarray(scopedName.toString(),
-                                           size,
-                                           result.getCorbaType().getQName());            
+            if (result.getSchemaType() != null) {
+                stype = generateSchemaArray(scopedName.toString(),
+                                            size,
+                                            result.getSchemaType(),
+                                            getFullyQualifiedName());
+            } else {
+                stype = generateSchemaArray(scopedName.toString(),
+                                            size, null, getFullyQualifiedName());
+            }
+            if (result.getCorbaType() != null) {
+                ctype = generateCorbaAnonarray(scopedName.toString(),
+                                               size,
+                                               result.getCorbaType(),
+                                               getFullyQualifiedName());
+            } else {
+                ctype = generateCorbaAnonarray(scopedName.toString(),
+                                               size, null, getFullyQualifiedName());
+            }
         }
         
         // add schemaType
@@ -120,7 +153,7 @@
         setCorbaType(ctype);
     }
 
-    private Types doAnonarray(AST node, QName stype, QName ctype) {
+    private Types doAnonarray(AST node, XmlSchemaType stype, CorbaTypeImpl ctype) {
         Types result = new Types();
         
         if (node != null) {
@@ -134,21 +167,25 @@
             if (result.getSchemaType() == null) {
                 result.setSchemaType(generateSchemaArray(scopedName.toString(),
                                                          size,
-                                                         stype));
+                                                         stype,
+                                                         getFullyQualifiedName()));
             } else {
                 result.setSchemaType(generateSchemaArray(scopedName.toString(),
                                                          size,
-                                                         result.getSchemaType().getQName()));
+                                                         result.getSchemaType(),
+                                                         getFullyQualifiedName()));
             }
             
             if (result.getCorbaType() == null) {
                 result.setCorbaType(generateCorbaAnonarray(scopedName.toString(),
                                                            size,
-                                                           ctype));
+                                                           ctype,
+                                                           getFullyQualifiedName()));
             } else {
                 result.setCorbaType(generateCorbaAnonarray(scopedName.toString(),
                                                            size,
-                                                           result.getCorbaType().getQName()));
+                                                           result.getCorbaType(),
+                                                           getFullyQualifiedName()));
             }
             
 
@@ -163,7 +200,8 @@
         return result;
     }
     
-    private XmlSchemaComplexType generateSchemaArray(String name, Long size, QName type) {
+    private XmlSchemaComplexType generateSchemaArray(String name, Long size, 
+                                                     XmlSchemaType type, Scope fQName) {
         XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema);
         complexType.setName(name);
 
@@ -173,7 +211,13 @@
         element.setMinOccurs(size);
         element.setMaxOccurs(size);
         element.setName("item");
-        element.setSchemaTypeName(type);
+        if (type != null) {
+            element.setSchemaTypeName(type.getQName());
+        } else {
+            ArrayDeferredAction arrayAction = 
+                new ArrayDeferredAction(element, fQName);
+            wsdlVisitor.getDeferredActions().add(arrayAction);
+        }
         
         sequence.getItems().add(element);
 
@@ -182,35 +226,52 @@
         return complexType;
     }
 
-    private Array generateCorbaArray(Scope scopedName, Long size, QName type) {
+    private Array generateCorbaArray(Scope scopedName, Long size, 
+                                     CorbaTypeImpl type, Scope fQName) {
         Array array = new Array();
         array.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
         array.setBound(size);
         array.setRepositoryID(scopedName.toIDLRepositoryID());
-        array.setType(type);
+        if (type != null) {
+            array.setType(type.getQName());
+        } else {
+            ArrayDeferredAction arrayAction = 
+                new ArrayDeferredAction(array, fQName);
+            wsdlVisitor.getDeferredActions().add(arrayAction);
+        }
         return array;
     }
 
-    private Anonarray generateCorbaAnonarray(String name, Long size, QName type) {
+    private Anonarray generateCorbaAnonarray(String name, Long size, 
+                                             CorbaTypeImpl type, Scope fQName) {
         Anonarray anonarray = new Anonarray();
         anonarray.setQName(new QName(typeMap.getTargetNamespace(), name));
         anonarray.setBound(size);
-        anonarray.setType(type);
+        if (type != null) {
+            anonarray.setType(type.getQName());
+        } else {
+            ArrayDeferredAction anonarrayAction = 
+                new ArrayDeferredAction(anonarray, fQName);
+            wsdlVisitor.getDeferredActions().add(anonarrayAction);
+        }
         return anonarray;
     }
     
     class Types {
         private XmlSchemaType schemaType;
         private CorbaTypeImpl corbaType;
+        private Scope fullyQualifiedName;
         
         public Types() {
             schemaType = null;
             corbaType = null;
         }
         
-        public Types(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        public Types(XmlSchemaType stype, CorbaTypeImpl ctype,
+                     Scope fqName) {
             schemaType = stype;
             corbaType = ctype;
+            fullyQualifiedName = fqName;
         }
         
         public void setSchemaType(XmlSchemaType stype) {
@@ -227,6 +288,14 @@
         
         public CorbaTypeImpl getCorbaType() {
             return corbaType;
+        }
+        
+        public void setFullyQualifiedName(Scope fqName) {
+            fullyQualifiedName = fqName;
+        }
+        
+        public Scope getFullyQualifiedName() {
+            return fullyQualifiedName;
         }
     }
 }

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeDeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeDeferredAction.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeDeferredAction.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeDeferredAction.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.schemas.yoko.bindings.corba.ArgType;
+import org.apache.schemas.yoko.bindings.corba.ParamType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class AttributeDeferredAction extends DeferredActionBase {
+
+    protected ArgType argType;
+    protected ParamType param;
+    protected XmlSchemaElement element;
+    
+    
+    public AttributeDeferredAction(ParamType paramType, ArgType arg, 
+                                   XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        param = paramType;  
+        argType = arg;
+        element = elem;        
+    }
+    
+    public AttributeDeferredAction(ParamType paramType, Scope scope) {                           
+        super(scope);
+        param = paramType;         
+    }
+    
+    public AttributeDeferredAction(ArgType arg, Scope scope) {                           
+        super(scope);
+        argType = arg;         
+    }
+    
+    public AttributeDeferredAction(XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        element = elem;               
+    }
+    
+    public void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        if (param != null) {
+            param.setIdltype(ctype.getQName());
+        }
+        if (argType != null) {
+            argType.setIdltype(ctype.getQName());
+        }
+        if (element != null) {
+            element.setSchemaTypeName(stype.getQName());
+        }        
+    }
+       
+}
+
+
+

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeDeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeDeferredAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/AttributeVisitor.java Mon Apr 16 09:19:34 2007
@@ -124,7 +124,7 @@
         XmlSchemaElement outParameters = 
             generateWrappedDocElement(typeNode,
                                       GETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX,
-                                      RETURN_PARAM_NAME);
+                                      RETURN_PARAM_NAME);                                      
 
         // generate input message
         Message inMsg = generateMessage(inParameters,
@@ -208,15 +208,23 @@
      * @param paramName is the name of the  wrapping element.
      * @return the wrapping element.
      */
-    private XmlSchemaElement generateWrappedDocElement(AST typeNode, String name, String paramName) {
+    private XmlSchemaElement generateWrappedDocElement(AST typeNode, String name, 
+                                                       String paramName) {
         XmlSchemaElement element = new XmlSchemaElement();
         if (typeNode != null) {
             ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(getScope(), 
                                                                     wsdlVisitor);
             visitor.visit(typeNode);
             XmlSchemaType stype = visitor.getSchemaType();
+            Scope fqName = visitor.getFullyQualifiedName();
+            
+            if (stype != null) {
+                element.setSchemaTypeName(stype.getQName());
+            } else {
+                wsdlVisitor.getDeferredActions().
+                    add(new AttributeDeferredAction(element, fqName)); 
+            }
             
-            element.setSchemaTypeName(stype.getQName());
             element.setName(paramName);
         }
         
@@ -283,7 +291,12 @@
         visitor.visit(type);
         CorbaTypeImpl corbaType = visitor.getCorbaType();
         
-        param.setIdltype(corbaType.getQName());
+        if (corbaType != null) {
+            param.setIdltype(corbaType.getQName());
+        } else {
+            wsdlVisitor.getDeferredActions().
+                add(new AttributeDeferredAction(param, visitor.getFullyQualifiedName())); 
+        }
         
         return param;
     }
@@ -297,8 +310,12 @@
                                                                 wsdlVisitor);
         visitor.visit(type);
         CorbaTypeImpl corbaType = visitor.getCorbaType();
-        
-        param.setIdltype(corbaType.getQName());
+        if (corbaType != null) {
+            param.setIdltype(corbaType.getQName());
+        } else {
+            wsdlVisitor.getDeferredActions().
+                add(new AttributeDeferredAction(param, visitor.getFullyQualifiedName()));
+        }
 
         return param;
     }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeclaratorVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeclaratorVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeclaratorVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeclaratorVisitor.java Mon Apr 16 09:19:34 2007
@@ -43,10 +43,12 @@
     public DeclaratorVisitor(Scope scope,
                              WSDLASTVisitor wsdlASTVisitor,
                              XmlSchemaType schemaTypeRef,
-                             CorbaTypeImpl corbaTypeRef) {
+                             CorbaTypeImpl corbaTypeRef,
+                             Scope fQName) {
         super(scope, wsdlASTVisitor);
         setSchemaType(schemaTypeRef);
         setCorbaType(corbaTypeRef);
+        setFullyQualifiedName(fQName);
     }
     
     public void visit(AST node) {
@@ -56,7 +58,8 @@
                                                          wsdlVisitor,
                                                          getSchemaType(),
                                                          getCorbaType(),
-                                                         node); 
+                                                         node,
+                                                         getFullyQualifiedName()); 
             arrayVisitor.visit(node);
 
         } else {
@@ -79,7 +82,8 @@
                                                              wsdlVisitor,
                                                              getSchemaType(),
                                                              getCorbaType(),
-                                                             nextDecl); 
+                                                             nextDecl,
+                                                             getFullyQualifiedName()); 
                 arrayVisitor.visit(nextDecl);
 
             } else {

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredAction.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredAction.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredAction.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public interface DeferredAction {
+
+    void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype);    
+    
+}

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public abstract class DeferredActionBase implements DeferredAction {         
+    
+    private Scope fullyQualifiedName;
+    
+    public DeferredActionBase(Scope qualifiedName) {
+        fullyQualifiedName = qualifiedName; 
+    }
+
+    public abstract void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype);
+    
+    public void setFullyQualifiedName(Scope qualifiedName) {
+        fullyQualifiedName = qualifiedName;
+    }
+    
+    public Scope getFullyQualifiedName() {
+        return fullyQualifiedName;
+    }
+    
+}

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionCollection.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionCollection.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionCollection.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionCollection.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+// Class that holds a fully qualified name as the key that represents
+// a type that was forward declared. 
+// Associated with each fully qualified name is a list of actions.
+// Each action represents a task that is deferred until 
+// the type is really declared. 
+public final class DeferredActionCollection {
+    
+    Map deferredActions = new HashMap<String, List>();
+    
+    public void add(DeferredActionBase action) {
+        Object obj = deferredActions.get(action.getFullyQualifiedName().toString());
+        List list = null;
+        if (obj == null) {
+            // create a new list and add first action
+            list = new ArrayList();
+            list.add(action);
+        } else {
+            // add action to list of actions for that scope
+            list = (ArrayList)obj;
+            list.add(action);
+        }
+        deferredActions.put(action.getFullyQualifiedName().toString(), list);
+    }
+    
+    public void remove(DeferredActionBase action) {
+        deferredActions.remove(action.getFullyQualifiedName().toString());
+    }
+                   
+    public int getSize() {
+        return deferredActions.size();   
+    }
+    
+    public List getActionsList(Scope scope) {        
+    
+        List list = new ArrayList();
+        if (deferredActions.size() > 0) {
+            for (Iterator iter = deferredActions.keySet().iterator(); iter.hasNext();) {
+                //Scope key = (Scope)iter.next();
+                String key = (String)iter.next();
+                if (key.equals(scope.toString())) {
+                    return list = (List)deferredActions.get(key);                    
+                }
+            }
+        }           
+        return list;
+    }
+}
\ No newline at end of file

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionCollection.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionDeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionDeferredAction.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionDeferredAction.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionDeferredAction.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.schemas.yoko.bindings.corba.MemberType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class ExceptionDeferredAction extends DeferredActionBase {
+
+    protected MemberType member;
+    protected XmlSchemaElement element;
+    
+    
+    public ExceptionDeferredAction(MemberType memberType, XmlSchemaElement elem,
+                                  Scope scope) {                           
+        super(scope);
+        member = memberType;
+        element = elem;        
+    }
+    
+    public ExceptionDeferredAction(MemberType memberType, Scope scope) {                           
+        super(scope);
+        member = memberType;         
+    }
+    
+    public ExceptionDeferredAction(XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        element = elem;               
+    }
+    
+    public void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        if (member != null) {
+            member.setIdltype(ctype.getQName());
+        }
+        if (element != null) {
+            element.setSchemaType(stype);
+            element.setSchemaTypeName(stype.getQName());
+        }          
+    }
+       
+}
+
+
+

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionDeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionDeferredAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ExceptionVisitor.java Mon Apr 16 09:19:34 2007
@@ -103,6 +103,7 @@
             visitor.visit(memberTypeNode);
             XmlSchemaType stype = visitor.getSchemaType();
             CorbaTypeImpl ctype = visitor.getCorbaType();
+            Scope fullyQualifiedName = visitor.getFullyQualifiedName();
             
             // needed for anonymous arrays in exceptions
             if (ArrayVisitor.accept(memberNode)) {
@@ -112,26 +113,20 @@
                                                              wsdlVisitor,
                                                              stype,
                                                              ctype,
-                                                             null);
+                                                             null,
+                                                             fullyQualifiedName);
                 arrayVisitor.visit(memberNode);
                 stype = arrayVisitor.getSchemaType();
                 ctype = arrayVisitor.getCorbaType();
             }
 
-            // xmlschema:member
-            XmlSchemaElement member = new XmlSchemaElement();
-            String memberName = memberNode.toString();
-            member.setName(memberName);
-            member.setSchemaType(stype);
-            member.setSchemaTypeName(stype.getQName());
-
+            
+            XmlSchemaElement member = createElementType(memberNode, stype,
+                                                        fullyQualifiedName);
             sequence.getItems().add(member);
 
-            
-            // corba:member
-            MemberType memberType = new MemberType();
-            memberType.setName(memberName);
-            memberType.setIdltype(ctype.getQName());
+            MemberType memberType = createMemberType(memberNode, ctype, 
+                                                     fullyQualifiedName);
             exception.getMember().add(memberType);
             
             
@@ -148,6 +143,37 @@
         
         setSchemaType(complexType);
         setCorbaType(exception);
+    }
+    
+    private XmlSchemaElement createElementType(AST memberNode, XmlSchemaType stype,
+                                               Scope fqName) {
+        // xmlschema:member
+        XmlSchemaElement member = new XmlSchemaElement();
+        String memberName = memberNode.toString();
+        member.setName(memberName);
+        if (stype != null) {
+            member.setSchemaType(stype);
+            member.setSchemaTypeName(stype.getQName());
+        } else {
+            wsdlVisitor.getDeferredActions().
+                add(new ExceptionDeferredAction(member, fqName)); 
+        }
+        return member;
+    }
+    
+    private MemberType createMemberType(AST memberNode, CorbaTypeImpl ctype, 
+                                        Scope fqName) {
+        // corba:member
+        MemberType memberType = new MemberType();
+        memberType.setName(memberNode.toString());
+        if (ctype != null) {
+            memberType.setIdltype(ctype.getQName());
+        } else {
+            wsdlVisitor.getDeferredActions().
+                add(new ExceptionDeferredAction(memberType, fqName));
+        }
+        
+        return memberType;
     }
     
 }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java Mon Apr 16 09:19:34 2007
@@ -73,20 +73,21 @@
         visitor.visit(typeNode);
         XmlSchemaType schemaType = visitor.getSchemaType();
         CorbaTypeImpl corbaType = visitor.getCorbaType();
+        Scope fullyQualifiedName = visitor.getFullyQualifiedName();
         
         switch (node.getType()) {
         case IDLTokenTypes.LITERAL_in: 
-            addElement(inWrappingSequence, schemaType, nameNode.toString());
-            addCorbaParam(corbaType, ModeType.IN, nameNode.toString());
+            addElement(inWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
+            addCorbaParam(corbaType, ModeType.IN, nameNode.toString(), fullyQualifiedName);
             break;
         case IDLTokenTypes.LITERAL_out:
-            addElement(outWrappingSequence, schemaType, nameNode.toString()); 
-            addCorbaParam(corbaType, ModeType.OUT, nameNode.toString());
+            addElement(outWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName); 
+            addCorbaParam(corbaType, ModeType.OUT, nameNode.toString(), fullyQualifiedName);
             break;
         case IDLTokenTypes.LITERAL_inout:
-            addElement(inWrappingSequence, schemaType, nameNode.toString());
-            addElement(outWrappingSequence, schemaType, nameNode.toString());
-            addCorbaParam(corbaType, ModeType.INOUT, nameNode.toString());
+            addElement(inWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
+            addElement(outWrappingSequence, schemaType, nameNode.toString(), fullyQualifiedName);
+            addCorbaParam(corbaType, ModeType.INOUT, nameNode.toString(), fullyQualifiedName);
             break;
         default:
             throw new RuntimeException("[ParamDclVisitor: illegal IDL!]");
@@ -98,19 +99,33 @@
 
     private XmlSchemaElement addElement(XmlSchemaSequence schemaSequence,
                                         XmlSchemaType schemaType,
-                                        String name) {
+                                        String name,
+                                        Scope fullyQualifiedName) {
         XmlSchemaElement element = new XmlSchemaElement();
         element.setName(name);
-        element.setSchemaTypeName(schemaType.getQName());
+        if (schemaType == null) {
+            ParamDeferredAction elementAction = 
+                new ParamDeferredAction(element, fullyQualifiedName);
+            wsdlVisitor.getDeferredActions().add(elementAction);
+        } else {
+            element.setSchemaTypeName(schemaType.getQName());
+        }
         schemaSequence.getItems().add(element);
         return element;
     }
 
-    private void addCorbaParam(CorbaTypeImpl corbaType, ModeType mode, String partName) {
+    private void addCorbaParam(CorbaTypeImpl corbaType, ModeType mode, 
+                               String partName, Scope fullyQualifiedName) {
         ParamType param = new ParamType();
         param.setName(partName);
         param.setMode(mode);
-        param.setIdltype(corbaType.getQName());
+        if (corbaType ==  null) {            
+            ParamDeferredAction paramAction = 
+                new ParamDeferredAction(param, fullyQualifiedName);
+            wsdlVisitor.getDeferredActions().add(paramAction);
+        } else {
+            param.setIdltype(corbaType.getQName());
+        }
         corbaOperation.getParam().add(param);
     }
 

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDeferredAction.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDeferredAction.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDeferredAction.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.schemas.yoko.bindings.corba.ParamType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class ParamDeferredAction extends DeferredActionBase {
+
+    protected ParamType param;
+    protected XmlSchemaElement element;
+    
+    
+    public ParamDeferredAction(ParamType defParam, XmlSchemaElement elem,
+                                  Scope scope) {                           
+        super(scope);
+        param = defParam;
+        element = elem;        
+    }
+    
+    public ParamDeferredAction(ParamType defParam, Scope scope) {                           
+        super(scope);
+        param = defParam;         
+    }
+    
+    public ParamDeferredAction(XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        element = elem;               
+    }
+    
+    public void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        if (param != null) {
+            param.setIdltype(ctype.getQName());
+        }
+        if (element != null) {
+            element.setSchemaTypeName(stype.getQName());
+        }        
+    }
+       
+}
+
+
+

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDeferredAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PrimitiveTypesVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PrimitiveTypesVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PrimitiveTypesVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PrimitiveTypesVisitor.java Mon Apr 16 09:19:34 2007
@@ -56,7 +56,7 @@
 
     private XmlSchemaType schemaType;
     private CorbaTypeImpl corbaType;
-    private Scope scope;
+    private Scope scope;   
     private XmlSchemaCollection schemas;
     
     public PrimitiveTypesVisitor(Scope scopeRef, XmlSchemaCollection xmlSchemas) {
@@ -121,7 +121,7 @@
 
         
         schemaType = stype;
-        corbaType = ctype;
+        corbaType = ctype;        
     }
     
     public XmlSchemaType getSchemaType() {
@@ -133,6 +133,10 @@
     }
     
     public Scope getScope() {
+        return scope;
+    }
+    
+    public Scope getFullyQualifiedName() {
         return scope;
     }
     

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopeNameCollection.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopeNameCollection.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopeNameCollection.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopeNameCollection.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class ScopeNameCollection  {
+    
+    Map scopedNames = new HashMap();
+    
+    public void add(Scope scope) {
+        scopedNames.put(scope.toString(), scope);
+    }
+    
+    public void remove(Scope scope) {
+        scopedNames.remove(scope.toString());
+    }
+    
+    public Scope getScope(Scope scope) {
+        return (Scope)scopedNames.get(scope.toString());
+    }
+    
+    public Scope getScope(String scopename) {
+        return (Scope)scopedNames.get(scopename);
+    }
+    
+}
\ No newline at end of file

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopeNameCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ScopeNameCollection.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceDeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceDeferredAction.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceDeferredAction.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceDeferredAction.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.schemas.yoko.bindings.corba.Anonsequence;
+import org.apache.schemas.yoko.bindings.corba.Sequence;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class SequenceDeferredAction extends DeferredActionBase {
+
+    protected Anonsequence anonSequence;
+    protected Sequence sequence;
+    protected XmlSchemaElement element;
+    
+    
+    public SequenceDeferredAction(Sequence sequenceType, Anonsequence anonSequenceType, 
+                                  XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        anonSequence = anonSequenceType;
+        sequence = sequenceType;
+        element = elem;        
+    }
+    
+    public SequenceDeferredAction(Anonsequence anonSequenceType, Scope scope) {                           
+        super(scope);
+        anonSequence = anonSequenceType;         
+    }
+    
+    public SequenceDeferredAction(Sequence sequenceType, Scope scope) {                           
+        super(scope);
+        sequence = sequenceType;         
+    }
+    
+    public SequenceDeferredAction(XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        element = elem;               
+    }
+    
+    public void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        if (anonSequence != null) {
+            anonSequence.setElemtype(ctype.getQName());
+        }
+        if (sequence != null) {
+            sequence.setElemtype(ctype.getQName());
+        }
+        if (element != null) {
+            element.setSchemaTypeName(stype.getQName());
+        }        
+    }
+        
+}
+
+
+

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceDeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceDeferredAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/SequenceVisitor.java Mon Apr 16 09:19:34 2007
@@ -69,6 +69,7 @@
         
         XmlSchemaType stype = visitor.getSchemaType();
         CorbaTypeImpl ctype = visitor.getCorbaType();
+        Scope fullyQualifiedName = visitor.getFullyQualifiedName();
         
 
         long bound = -1;
@@ -86,7 +87,7 @@
 
         XmlSchemaType schemaType = null;
         if (simpleTypeSpecNode.getType() != IDLTokenTypes.LITERAL_octet) {
-            schemaType = generateSchemaType(stype, scopedName, bound);
+            schemaType = generateSchemaType(stype, scopedName, bound, fullyQualifiedName);
         } else {
             // According to CORBA Binding for WSDL specification,
             // idl:sequence<octet> maps to xs:base64Binary by default.
@@ -103,20 +104,24 @@
             corbaType = generateCorbaAnonsequence(ctype,
                                                   schemaType,
                                                   scopedName,
-                                                  bound);
+                                                  bound,
+                                                  fullyQualifiedName);
         } else {
             corbaType = generateCorbaSequence(ctype,
                                               schemaType,
                                               scopedName,
-                                              bound);
+                                              bound,
+                                              fullyQualifiedName);
         }
 
 
         setSchemaType(schemaType); 
         setCorbaType(corbaType);
+        setFullyQualifiedName(fullyQualifiedName);
     }
 
-    private XmlSchemaType generateSchemaType(XmlSchemaType stype, Scope scopedName, long bound) {
+    private XmlSchemaType generateSchemaType(XmlSchemaType stype, Scope scopedName, 
+                                             long bound, Scope fullyQualifiedName) {
         XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
         ct.setName(scopedName.toString());
         XmlSchemaSequence sequence = new XmlSchemaSequence();
@@ -128,7 +133,13 @@
         } else {
             el.setMaxOccurs(Long.MAX_VALUE);
         }
-        el.setSchemaTypeName(stype.getQName());
+        if (stype != null) {
+            el.setSchemaTypeName(stype.getQName());
+        } else {
+            SequenceDeferredAction elementAction = 
+                new SequenceDeferredAction(el, fullyQualifiedName);
+            wsdlVisitor.getDeferredActions().add(elementAction); 
+        }
         sequence.getItems().add(el);
         ct.setParticle(sequence);
         return ct;
@@ -137,7 +148,8 @@
     private CorbaTypeImpl generateCorbaSequence(CorbaTypeImpl ctype,
                                                 XmlSchemaType schemaType,
                                                 Scope scopedName,
-                                                long bound) {
+                                                long bound,
+                                                Scope fullyQualifiedName) {
         //create the corba sequence
         Sequence corbaSeq = new Sequence();
         if (bound == -1) {
@@ -146,7 +158,13 @@
         corbaSeq.setBound(bound);
         corbaSeq.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
         corbaSeq.setType(schemaType.getQName());
-        corbaSeq.setElemtype(ctype.getQName());
+        if (ctype != null) {
+            corbaSeq.setElemtype(ctype.getQName());
+        } else {
+            SequenceDeferredAction seqAction = 
+                new SequenceDeferredAction(corbaSeq, fullyQualifiedName);
+            wsdlVisitor.getDeferredActions().add(seqAction);
+        }
         corbaSeq.setRepositoryID(scopedName.toIDLRepositoryID());
 
         return corbaSeq;
@@ -155,7 +173,8 @@
     private Anonsequence generateCorbaAnonsequence(CorbaTypeImpl ctype,
                                                    XmlSchemaType schemaType,
                                                    Scope scopedName,
-                                                   long bound) {
+                                                   long bound,
+                                                   Scope fullyQualifiedName) {
         // create corba anonsequence
         Anonsequence result = new Anonsequence();
         if (bound == -1) {
@@ -163,9 +182,16 @@
         }                
         result.setBound(bound);
         result.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
-        result.setType(schemaType.getQName());
-        result.setElemtype(ctype.getQName());
+        if (schemaType == null || ctype == null) {
+            SequenceDeferredAction anonSeqAction = 
+                new SequenceDeferredAction(result, fullyQualifiedName);
+            wsdlVisitor.getDeferredActions().add(anonSeqAction);
+        } else {
+            result.setType(schemaType.getQName());
+            result.setElemtype(ctype.getQName());        
+        }
 
+        // REVISIT - Need to do something here is the type was forward declared.
         // add schemaType
         if (schemas.getTypeByQName(schemaType.getQName()) == null) {
             schema.getItems().add(schemaType);

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructDeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructDeferredAction.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructDeferredAction.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructDeferredAction.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.schemas.yoko.bindings.corba.MemberType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class StructDeferredAction extends DeferredActionBase {
+
+    protected MemberType member;
+    protected XmlSchemaElement element;
+    
+    
+    public StructDeferredAction(MemberType memberType, XmlSchemaElement elem,
+                                  Scope scope) {                           
+        super(scope);
+        member = memberType;
+        element = elem;        
+    }
+    
+    public StructDeferredAction(MemberType memberType, Scope scope) {                           
+        super(scope);
+        member = memberType;         
+    }
+    
+    public StructDeferredAction(XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        element = elem;               
+    }
+    
+    public void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        if (member != null) {
+            member.setIdltype(ctype.getQName());
+        }
+        if (element != null) {
+            element.setSchemaTypeName(stype.getQName());
+        }        
+    }
+       
+}
+
+
+

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructDeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructDeferredAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/StructVisitor.java Mon Apr 16 09:19:34 2007
@@ -77,6 +77,7 @@
             
             XmlSchemaType schemaType = null;
             CorbaTypeImpl corbaType = null;
+            Scope fullyQualifiedName = null;
             try {
                 TypesVisitor visitor = new TypesVisitor(structScope, 
                                                         wsdlVisitor,
@@ -85,6 +86,7 @@
                 
                 schemaType = visitor.getSchemaType();
                 corbaType = visitor.getCorbaType();
+                fullyQualifiedName = visitor.getFullyQualifiedName();
                 
             } catch (Exception ex) {
                 System.out.println(ex.getMessage());
@@ -99,10 +101,12 @@
                                                              wsdlVisitor,
                                                              schemaType,
                                                              corbaType,
-                                                             null);
+                                                             null,
+                                                             fullyQualifiedName);
                 arrayVisitor.visit(memberNode);
                 schemaType = arrayVisitor.getSchemaType();
                 corbaType = arrayVisitor.getCorbaType();
+                fullyQualifiedName = arrayVisitor.getFullyQualifiedName();
             }
             
             // xmlschema:member
@@ -110,15 +114,24 @@
             String memberName = memberNode.toString();
             member.setName(memberName);
             member.setSchemaType(schemaType);
-            member.setSchemaTypeName(schemaType.getQName());
-
+            if (schemaType != null) {
+                member.setSchemaTypeName(schemaType.getQName());                
+            } else {
+                wsdlVisitor.getDeferredActions().
+                    add(new StructDeferredAction(member, fullyQualifiedName));                
+            }
             sequence.getItems().add(member);
 
             
             // corba:member
             MemberType memberType = new MemberType();
             memberType.setName(memberName);
-            memberType.setIdltype(corbaType.getQName());
+            if (corbaType != null) {                            
+                memberType.setIdltype(corbaType.getQName());
+            } else {
+                wsdlVisitor.getDeferredActions().
+                    add(new StructDeferredAction(memberType, fullyQualifiedName)); 
+            }
             struct.getMember().add(memberType);
 
             memberTypeNode = memberNode.getNextSibling();

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TemplateTypeSpecVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TemplateTypeSpecVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TemplateTypeSpecVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TemplateTypeSpecVisitor.java Mon Apr 16 09:19:34 2007
@@ -65,6 +65,7 @@
 
         setSchemaType(visitor.getSchemaType());
         setCorbaType(visitor.getCorbaType());
+        setFullyQualifiedName(visitor.getFullyQualifiedName());
     }
 
 }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypedefVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypedefVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypedefVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypedefVisitor.java Mon Apr 16 09:19:34 2007
@@ -59,6 +59,7 @@
 
         XmlSchemaType schemaType = typesVisitor.getSchemaType();
         CorbaTypeImpl corbaType = typesVisitor.getCorbaType();
+        Scope fullyQualifiedName = typesVisitor.getFullyQualifiedName();
         
         Scope typedefScope = new Scope(getScope(), identifierNode);
         
@@ -69,7 +70,8 @@
             DeclaratorVisitor declaratorVisitor = new DeclaratorVisitor(typedefScope,
                                                                         wsdlVisitor,
                                                                         schemaType,
-                                                                        corbaType);
+                                                                        corbaType,
+                                                                        fullyQualifiedName);
             declaratorVisitor.visit(identifierNode);
 
         } else if (StringVisitor.accept(typeDeclaratorNode)) {
@@ -81,7 +83,8 @@
                 DeclaratorVisitor declaratorVisitor = new DeclaratorVisitor(typedefScope,
                                                                             wsdlVisitor,
                                                                             schemaType,
-                                                                            corbaType);
+                                                                            corbaType,
+                                                                            fullyQualifiedName);
                 declaratorVisitor.visit(identifierNode);
   
             } else {
@@ -94,7 +97,8 @@
                                                                      wsdlVisitor,
                                                                      schemaType,
                                                                      corbaType,
-                                                                     identifierNode); 
+                                                                     identifierNode,
+                                                                     fullyQualifiedName); 
                         arrayVisitor.visit(identifierNode);
 
                     } else {
@@ -136,7 +140,8 @@
             DeclaratorVisitor declaratorVisitor = new DeclaratorVisitor(typedefScope,
                                                                         wsdlVisitor,
                                                                         schemaType,
-                                                                        corbaType);
+                                                                        corbaType,
+                                                                        fullyQualifiedName);
             declaratorVisitor.visit(identifierNode);
         
         }
@@ -144,6 +149,7 @@
 
         setSchemaType(schemaType);
         setCorbaType(corbaType);
+        setFullyQualifiedName(fullyQualifiedName);
     }
     
     private void generateAlias(AST identifierNode,

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypesVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypesVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypesVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypesVisitor.java Mon Apr 16 09:19:34 2007
@@ -76,6 +76,7 @@
 
         setSchemaType(visitor.getSchemaType());
         setCorbaType(visitor.getCorbaType());
+        setFullyQualifiedName(visitor.getFullyQualifiedName());
         
     }
 

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionDeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionDeferredAction.java?view=auto&rev=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionDeferredAction.java (added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionDeferredAction.java Mon Apr 16 09:19:34 2007
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.yoko.tools.processors.idl;
+
+import org.apache.schemas.yoko.bindings.corba.Union;
+import org.apache.schemas.yoko.bindings.corba.Unionbranch;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class UnionDeferredAction extends DeferredActionBase {
+
+    protected Union union;
+    protected Unionbranch unionBranch;
+    protected XmlSchemaElement element;
+    
+    
+    public UnionDeferredAction(Union unionType, Unionbranch unionBranchType, XmlSchemaElement elem,
+                                  Scope scope) {                           
+        super(scope);
+        union = unionType;
+        unionBranch = unionBranchType;
+        element = elem;        
+    }
+    
+    public UnionDeferredAction(Union unionType, Scope scope) {                           
+        super(scope);
+        union = unionType;         
+    }
+    
+    public UnionDeferredAction(Unionbranch unionBranchType, Scope scope) {                           
+        super(scope);
+        unionBranch = unionBranchType;         
+    }
+    
+    public UnionDeferredAction(XmlSchemaElement elem, Scope scope) {                           
+        super(scope);
+        element = elem;               
+    }
+    
+    public void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        if (unionBranch != null) {
+            unionBranch.setIdltype(ctype.getQName());
+        }
+        if (element != null) {
+            element.setSchemaTypeName(stype.getQName());
+        }        
+    }
+        
+}
+
+
+

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionDeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionDeferredAction.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java Mon Apr 16 09:19:34 2007
@@ -85,10 +85,17 @@
         visitor.visit(discriminatorNode);
         XmlSchemaType stype = visitor.getSchemaType();
         CorbaTypeImpl ctype = visitor.getCorbaType();
+        Scope fullyQualifiedName = visitor.getFullyQualifiedName();
         
         XmlSchemaElement discriminatorElement = new XmlSchemaElement();
         discriminatorElement.setName(discriminator);
-        discriminatorElement.setSchemaTypeName(stype.getQName());
+        if (stype != null) {
+            discriminatorElement.setSchemaTypeName(stype.getQName());
+        } else {
+            UnionDeferredAction unionDiscriminatorAction = 
+                new UnionDeferredAction(discriminatorElement, fullyQualifiedName);
+            wsdlVisitor.getDeferredActions().add(unionDiscriminatorAction); 
+        }
         discriminatorElement.setMinOccurs(1);
         discriminatorElement.setMaxOccurs(1);
         sequence.getItems().add(discriminatorElement);
@@ -104,7 +111,14 @@
         corbaUnion.setQName(new QName(typeMap.getTargetNamespace(), unionScope.toString()));
         corbaUnion.setRepositoryID(unionScope.toIDLRepositoryID());
         corbaUnion.setType(unionSchemaComplexType.getQName());
-        corbaUnion.setDiscriminator(ctype.getQName());
+        if (ctype != null) {
+            corbaUnion.setDiscriminator(ctype.getQName());
+        } else {
+            // Discriminator type is forward declared.
+            UnionDeferredAction unionDiscriminatorAction = 
+                new UnionDeferredAction(corbaUnion, fullyQualifiedName);
+            wsdlVisitor.getDeferredActions().add(unionDiscriminatorAction);
+        }
         
         processCaseNodes(caseNode, unionScope, choice, corbaUnion);
 
@@ -161,6 +175,7 @@
             visitor.visit(typeNode);
             XmlSchemaType stype = visitor.getSchemaType();
             CorbaTypeImpl ctype = visitor.getCorbaType();
+            Scope fullyQualifiedName = visitor.getFullyQualifiedName();
             
             
             // needed for anonymous arrays in unions
@@ -170,22 +185,37 @@
                                                              wsdlVisitor,
                                                              stype,
                                                              ctype,
-                                                             null);
+                                                             null,
+                                                             fullyQualifiedName);
                 arrayVisitor.visit(nameNode);
                 stype = arrayVisitor.getSchemaType();
                 ctype = arrayVisitor.getCorbaType();
+                fullyQualifiedName = visitor.getFullyQualifiedName();
             }
             
             
             // xmlschema:element
             element.setName(nameNode.toString());
-            element.setSchemaTypeName(stype.getQName());
+            if (stype != null) {
+                element.setSchemaTypeName(stype.getQName());
+            } else {                
+                UnionDeferredAction elementAction = 
+                    new UnionDeferredAction(element, fullyQualifiedName);
+                wsdlVisitor.getDeferredActions().add(elementAction); 
+            }
             choice.getItems().add(element);
             
             
             // corba:unionbranch
             unionBranch.setName(nameNode.toString());
-            unionBranch.setIdltype(ctype.getQName());
+            if (ctype != null) {
+                unionBranch.setIdltype(ctype.getQName());
+            } else {
+                // its type is forward declared.
+                UnionDeferredAction unionBranchAction = 
+                    new UnionDeferredAction(unionBranch, fullyQualifiedName);
+                wsdlVisitor.getDeferredActions().add(unionBranchAction); 
+            }
             corbaUnion.getUnionbranch().add(unionBranch);
             
             

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Visitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Visitor.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Visitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/Visitor.java Mon Apr 16 09:19:34 2007
@@ -32,5 +32,6 @@
     XmlSchemaType getSchemaType();
     CorbaTypeImpl getCorbaType();
 
-    Scope getScope();
+    Scope getScope();  
+    Scope getFullyQualifiedName();  
 }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/VisitorBase.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/VisitorBase.java?view=diff&rev=529309&r1=529308&r2=529309
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/VisitorBase.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/VisitorBase.java Mon Apr 16 09:19:34 2007
@@ -29,23 +29,30 @@
 
 public abstract class VisitorBase implements Visitor {
 
+    protected static ScopeNameCollection scopedNames;
     protected WSDLASTVisitor wsdlVisitor;
     protected XmlSchema schema;
     protected XmlSchemaCollection schemas;
     protected TypeMappingType typeMap;
+    
 
+    protected DeferredActionCollection deferredActions;
     private XmlSchemaType schemaType;
     private CorbaTypeImpl corbaType;
+    private Scope fullyQualifiedName;
     private Scope scope;
     
     public VisitorBase(Scope scopeRef,
                        WSDLASTVisitor wsdlASTVisitor) {
         wsdlVisitor = wsdlASTVisitor;
         schemas = wsdlVisitor.getSchemas();
+        scopedNames = wsdlVisitor.getScopedNames();
+        deferredActions = wsdlVisitor.getDeferredActions();
         schema = wsdlVisitor.getSchema();
         typeMap = wsdlVisitor.getTypeMap();
         
         scope = scopeRef; 
+        fullyQualifiedName = null;
         
         schemaType = null;
         corbaType = null;
@@ -58,10 +65,10 @@
     }
     
     public XmlSchemaType getSchemaType() {
-        if (schemaType == null) {
+        /*if (schemaType == null) {
             throw new RuntimeException("Schema type is null! "
                                        + "Method visit() must be called before getSchemaType()");
-        }
+        }*/
         return schemaType;
     }
     
@@ -70,14 +77,31 @@
     }
     
     public CorbaTypeImpl getCorbaType() {
-        if (corbaType == null) {
+        /*if ((scopedNames.getScope(corbaType.getName()) == null) 
+            && (corbaType == null)) {
             throw new RuntimeException("Corba type is null! "
                                        + "Method visit() must be called before getCorbaType()");
-        }
+        }*/
         return corbaType;        
     }
     
     public Scope getScope() {
         return scope;
+    }
+    
+    public static ScopeNameCollection  getScopedNames() {
+        return scopedNames;
+    }
+    
+    public void setFullyQualifiedName(Scope declaredName) {
+        fullyQualifiedName = declaredName;
+    }
+    
+    public Scope getFullyQualifiedName() {
+        return fullyQualifiedName;
+    }
+    
+    public WSDLASTVisitor getWsdlVisitor() {
+        return wsdlVisitor;
     }
 }



Mime
View raw message