incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eno...@apache.org
Subject svn commit: r530054 - in /incubator/yoko/trunk/tools/src: main/java/org/apache/yoko/tools/processors/idl/ test/resources/idl/
Date Wed, 18 Apr 2007 15:19:27 GMT
Author: enolan
Date: Wed Apr 18 08:19:26 2007
New Revision: 530054

URL: http://svn.apache.org/viewvc?view=rev&rev=530054
Log:
Yoko-345 - Support for operation return args and faults.

Added:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationDeferredAction.java
  (with props)
Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.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/PortTypeVisitor.java
    incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceParam.idl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceParam.wsdl

Modified: 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=diff&rev=530054&r1=530053&r2=530054
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/DeferredActionBase.java
Wed Apr 18 08:19:26 2007
@@ -24,7 +24,7 @@
 
 public abstract class DeferredActionBase implements DeferredAction {         
     
-    private Scope fullyQualifiedName;
+    private Scope fullyQualifiedName;       
     
     public DeferredActionBase(Scope qualifiedName) {
         fullyQualifiedName = qualifiedName; 

Added: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationDeferredAction.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationDeferredAction.java?view=auto&rev=530054
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationDeferredAction.java
(added)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationDeferredAction.java
Wed Apr 18 08:19:26 2007
@@ -0,0 +1,58 @@
+/**
+ * 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.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class OperationDeferredAction extends DeferredActionBase {
+
+    protected ArgType argType;
+    protected XmlSchemaElement element;
+        
+    public OperationDeferredAction(Scope fqName) {
+        super(fqName);
+    };
+        
+    public OperationDeferredAction(ArgType arg, Scope scope) {
+        super(scope);
+        argType = arg;         
+    }
+    
+    public OperationDeferredAction(XmlSchemaElement elem, Scope scope) {
+        super(scope);
+        element = elem;               
+    }        
+    
+    public void doDeferredAction(XmlSchemaType stype, CorbaTypeImpl ctype) {
+        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/OperationDeferredAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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=530054&r1=530053&r2=530054
==============================================================================
--- 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
Wed Apr 18 08:19:26 2007
@@ -179,7 +179,8 @@
                 visitor.setExceptionMode(true);
                 visitor.visit(node);                
                 CorbaTypeImpl corbaType = visitor.getCorbaType();
-                createFaultMessage(corbaType, operation, bindingOperation);
+                createFaultMessage(corbaType, operation, bindingOperation, 
+                                   visitor.getFullyQualifiedName());
                 
                 node = node.getNextSibling();
                 visitor.setExceptionMode(false);
@@ -258,7 +259,7 @@
     }
     
     private Part generateInputPart(Message inputMessage, XmlSchemaElement element) {
-        // message - part
+        // message - part 
         Part part = definition.createPart();
         part.setName(IN_PARAMETER);
         part.setElementName(element.getQName());
@@ -302,10 +303,16 @@
 
     private XmlSchemaElement addElement(XmlSchemaSequence schemaSequence,
                                         XmlSchemaType schemaType,
+                                        Scope fqName,
                                         String name) {
         XmlSchemaElement element = new XmlSchemaElement();
         element.setName(name);
-        element.setSchemaTypeName(schemaType.getQName());
+        if (schemaType != null) {
+            element.setSchemaTypeName(schemaType.getQName());
+        } else {
+            wsdlVisitor.getDeferredActions().
+                add(new OperationDeferredAction(element, fqName));  
+        }
         
         schemaSequence.getItems().add(element);
         
@@ -324,52 +331,59 @@
             
             XmlSchemaType schemaType = visitor.getSchemaType();
             CorbaTypeImpl corbaType = visitor.getCorbaType();
+            Scope fqName = visitor.getFullyQualifiedName();
             
-            addElement(outputWrappingSequence, schemaType, RETURN_PARAMETER);
-            addCorbaReturn(corbaType, RETURN_PARAMETER);
+            addElement(outputWrappingSequence, schemaType, fqName, RETURN_PARAMETER);
+            addCorbaReturn(corbaType, fqName, RETURN_PARAMETER);
         }
     }
 
-    private void addCorbaReturn(CorbaTypeImpl corbaType, String partName) {
+    private void addCorbaReturn(CorbaTypeImpl corbaType, Scope fqName, String partName) {
         ArgType param = new ArgType();
         param.setName(partName);
-        param.setIdltype(corbaType.getQName());
+        if (corbaType != null) {
+            param.setIdltype(corbaType.getQName());
+        } else {
+            wsdlVisitor.getDeferredActions().
+                add(new OperationDeferredAction(param, fqName));
+        }
         corbaOperation.setReturn(param);
     }
 
     private void createFaultMessage(CorbaTypeImpl corbaType,
                                     Operation operation, 
-                                    BindingOperation bindingOperation) {
-        String exceptionName = corbaType.getQName().getLocalPart();
+                                    BindingOperation bindingOperation,
+                                    Scope fqName) {
+        String exceptionName = corbaType.getQName().getLocalPart();        
 
         // message
-        Message faultMsg = definition.createMessage();
-        faultMsg.setQName(new QName(definition.getTargetNamespace(), exceptionName));
+        Message faultMsg = definition.createMessage();        
+        faultMsg.setQName(new QName(definition.getTargetNamespace(), exceptionName));   
    
         faultMsg.setUndefined(false);
 
         // message - part
         Part part = definition.createPart();
-        part.setName("exception");        
-        part.setElementName(new QName(definition.getTargetNamespace(), exceptionName));
+        part.setName("exception");            
+        part.setElementName(new QName(definition.getTargetNamespace(), exceptionName)); 
      
         faultMsg.addPart(part);
 
         // porttype - operation - fault
         Fault fault = definition.createFault();
-        fault.setMessage(faultMsg);
-        fault.setName(faultMsg.getQName().getLocalPart());
+        fault.setMessage(faultMsg);        
+        fault.setName(faultMsg.getQName().getLocalPart());        
         operation.addFault(fault);
 
         // binding - operation - corba:operation - corba:raises
-        RaisesType raisesType = new RaisesType();
+        RaisesType raisesType = new RaisesType();        
         raisesType.setException(new QName(typeMap.getTargetNamespace(),
-                                          exceptionName));
+                                              exceptionName));
         corbaOperation.getRaises().add(raisesType);
 
         // binding - operation - fault
-        BindingFault bindingFault = definition.createBindingFault();
-        bindingFault.setName(faultMsg.getQName().getLocalPart());
+        BindingFault bindingFault = definition.createBindingFault();        
+        bindingFault.setName(faultMsg.getQName().getLocalPart());        
         bindingOperation.addBindingFault(bindingFault);
 
-        definition.addMessage(faultMsg);
+        definition.addMessage(faultMsg);        
     }
 }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java?view=diff&rev=530054&r1=530053&r2=530054
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
Wed Apr 18 08:19:26 2007
@@ -162,10 +162,17 @@
                     visitor.visit(identifierNode);
                     XmlSchemaType stype = visitor.getSchemaType();
                     CorbaTypeImpl ctype = visitor.getCorbaType();
-                    for (int i = 0; i < list.size(); i++) {                          
                     
-                        DeferredAction action = (DeferredAction)list.get(i);
-                        action.doDeferredAction(stype, ctype);                          
                     
+                    Iterator iterator = list.iterator();
+                    
+                    while (iterator.hasNext()) {
+                        DeferredAction action = (DeferredAction)iterator.next();
+                        action.doDeferredAction(stype, ctype);                       
                     }
+                    iterator = list.iterator();                    
+                    while (iterator.hasNext()) {
+                        iterator.next();
+                        iterator.remove();                       
+                    }                      
                 }    
             }            
         }   

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceParam.idl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceParam.idl?view=diff&rev=530054&r1=530053&r2=530054
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceParam.idl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/ForwardInterfaceParam.idl Wed Apr 18
08:19:26 2007
@@ -22,7 +22,7 @@
         interface IpCall;
         
         interface IpAppCall {        
-            void routeCAllParam(in IpCall inTp,
+            IpCall routeCAllParam(in IpCall inTp,
                                 out IpCall outTp,
                                 inout IpCall inoutTp);
         };

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceParam.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceParam.wsdl?view=diff&rev=530054&r1=530053&r2=530054
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceParam.wsdl
(original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceParam.wsdl
Wed Apr 18 08:19:26 2007
@@ -38,6 +38,8 @@
       <xs:element name="routeCAllParamResponse">
         <xs:complexType>
           <xs:sequence>
+            <xs:element name="return" type="wsa:EndpointReferenceType">
+            </xs:element>
             <xs:element name="outTp" type="wsa:EndpointReferenceType">
             </xs:element>
             <xs:element name="inoutTp" type="wsa:EndpointReferenceType">
@@ -126,6 +128,7 @@
         <corba:param xmlns="http://schemas.apache.org/yoko/idl/ForwardInterfaceParam/typemap"
mode="in" name="inTp" idltype="org.cc.IpCall" />
         <corba:param xmlns="http://schemas.apache.org/yoko/idl/ForwardInterfaceParam/typemap"
mode="out" name="outTp" idltype="org.cc.IpCall" />
         <corba:param xmlns="http://schemas.apache.org/yoko/idl/ForwardInterfaceParam/typemap"
mode="inout" name="inoutTp" idltype="org.cc.IpCall" />
+        <corba:return xmlns="http://schemas.apache.org/yoko/idl/ForwardInterfaceParam/typemap"
name="return" idltype="org.cc.IpCall" />
       </corba:operation>
       <wsdl:input name="routeCAllParamRequest">
       </wsdl:input>



Mime
View raw message