incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmidd...@apache.org
Subject svn commit: r505016 - in /incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl: ObjectReferenceVisitor.java OperationVisitor.java ParamDclVisitor.java
Date Thu, 08 Feb 2007 19:33:23 GMT
Author: dmiddlem
Date: Thu Feb  8 11:33:21 2007
New Revision: 505016

URL: http://svn.apache.org/viewvc?view=rev&rev=505016
Log:
Updating support for object references to fix some issues that arose while running 
wsdl2java on the generate wsdl output. (YOKO-269)

Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ObjectReferenceVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ObjectReferenceVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ObjectReferenceVisitor.java?view=diff&rev=505016&r1=505015&r2=505016
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ObjectReferenceVisitor.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ObjectReferenceVisitor.java
Thu Feb  8 11:33:21 2007
@@ -155,6 +155,12 @@
             throw new RuntimeException("[ObjectReferenceVisitor: No binding available for
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 wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
+        XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
+        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.
         if (!isReferenceSchemaTypeDefined(referenceName)) {
@@ -164,12 +170,6 @@
             XmlSchemaElement refElement = new XmlSchemaElement();
             refElement.setQName(referenceName);
             refElement.setName(referenceName.getLocalPart());
-
-            // 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 wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE,
schemas);
-            XmlSchemaType wsaType = new XmlSchemaType(wsaSchema);
-            wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
             refElement.setSchemaType(wsaType);
             refElement.setSchemaTypeName(wsaType.getQName());
       
@@ -207,7 +207,7 @@
         corbaObject.setBinding(bindingName);
         corbaObject.setQName(new QName(typeMap.getTargetNamespace(), customScope.toString()));
         corbaObject.setRepositoryID(repositoryID);
-        corbaObject.setType(endpointType.getQName());
+        corbaObject.setType(wsaType.getQName());
         setCorbaType(corbaObject);
         
         // Add the object definition to the typemap.  We only need to add the default
@@ -264,7 +264,7 @@
                 
                 if (element instanceof BindingType) {
                     BindingType bt = (BindingType)element;
-                    if (bt.getRepositoryID().equals(repositoryID)) {                   
+                    if (bt.getRepositoryID().equals(repositoryID)) { 
                         return b.getQName();    
                     }
                 }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java?view=diff&rev=505016&r1=505015&r2=505016
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
Thu Feb  8 11:33:21 2007
@@ -309,10 +309,17 @@
 
     private XmlSchemaElement addElement(XmlSchemaSequence schemaSequence,
                                         XmlSchemaType schemaType,
-                                        String name) {
+                                        String name,
+                                        boolean isObjectReference) {
         XmlSchemaElement element = new XmlSchemaElement();
         element.setName(name);
-        element.setSchemaTypeName(schemaType.getQName());
+        // REVISIT: An object reference requires that we use a ref name.  An element type
produces
+        // a wsdltojava error.
+        if (isObjectReference) {
+            element.setRefName(schemaType.getQName());
+        } else {
+            element.setSchemaTypeName(schemaType.getQName());
+        }
         
         schemaSequence.getItems().add(element);
         
@@ -335,7 +342,12 @@
             XmlSchemaType schemaType = visitor.getSchemaType();
             CorbaTypeImpl corbaType = visitor.getCorbaType();
             
-            addElement(outputWrappingSequence, schemaType, RETURN_PARAMETER);
+            boolean isObjectReference = false;
+            if (corbaType instanceof org.apache.schemas.yoko.bindings.corba.Object) {
+                isObjectReference = true;
+            }
+            
+            addElement(outputWrappingSequence, schemaType, RETURN_PARAMETER, isObjectReference);
             addCorbaReturn(corbaType, RETURN_PARAMETER);
         }
     }

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=505016&r1=505015&r2=505016
==============================================================================
--- 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
Thu Feb  8 11:33:21 2007
@@ -85,18 +85,23 @@
         XmlSchemaType schemaType = visitor.getSchemaType();
         CorbaTypeImpl corbaType = visitor.getCorbaType();
         
+        boolean isObjectReference = false;
+        if (corbaType instanceof org.apache.schemas.yoko.bindings.corba.Object) {
+            isObjectReference = true;
+        }
+        
         switch (node.getType()) {
         case IDLTokenTypes.LITERAL_in: 
-            addElement(inWrappingSequence, schemaType, nameNode.toString());
+            addElement(inWrappingSequence, schemaType, nameNode.toString(), isObjectReference);
             addCorbaParam(corbaType, ModeType.IN, nameNode.toString());
             break;
         case IDLTokenTypes.LITERAL_out:
-            addElement(outWrappingSequence, schemaType, nameNode.toString());           

+            addElement(outWrappingSequence, schemaType, nameNode.toString(), isObjectReference);
           
             addCorbaParam(corbaType, ModeType.OUT, nameNode.toString());
             break;
         case IDLTokenTypes.LITERAL_inout:
-            addElement(inWrappingSequence, schemaType, nameNode.toString());
-            addElement(outWrappingSequence, schemaType, nameNode.toString());
+            addElement(inWrappingSequence, schemaType, nameNode.toString(), isObjectReference);
+            addElement(outWrappingSequence, schemaType, nameNode.toString(), isObjectReference);
             addCorbaParam(corbaType, ModeType.INOUT, nameNode.toString());
             break;
         default:
@@ -116,10 +121,17 @@
     
     private XmlSchemaElement addElement(XmlSchemaSequence schemaSequence,
                                         XmlSchemaType schemaType,
-                                        String name) {
+                                        String name,
+                                        boolean isObjectReference) {
         XmlSchemaElement element = new XmlSchemaElement();
         element.setName(name);
-        element.setSchemaTypeName(schemaType.getQName());
+        // REVISIT: An object reference requires that we use a ref name.  An element type
produces
+        // a wsdltojava error.
+        if (isObjectReference) {
+            element.setRefName(schemaType.getQName());
+        } else {
+            element.setSchemaTypeName(schemaType.getQName());
+        }
         schemaSequence.getItems().add(element);
         return element;
     }



Mime
View raw message