incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mvesc...@apache.org
Subject svn commit: r468436 - in /incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl: OperationVisitor.java ParamDclVisitor.java ParamTypeSpecVisitor.java PortTypeVisitor.java
Date Fri, 27 Oct 2006 16:09:33 GMT
Author: mvescovi
Date: Fri Oct 27 09:09:32 2006
New Revision: 468436

URL: http://svn.apache.org/viewvc?view=rev&rev=468436
Log:
Initial refactor of <op_dcl> IDL grammar rule and its derivation rules.

Added:
    incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java
  (with props)
    incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamTypeSpecVisitor.java
  (with props)
Modified:
    incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
    incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java

Modified: incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java?view=diff&rev=468436&r1=468435&r2=468436
==============================================================================
--- incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
(original)
+++ incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/OperationVisitor.java
Fri Oct 27 09:09:32 2006
@@ -20,32 +20,78 @@
 package org.apache.yoko.tools.processors.idl;
 
 import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
 import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
 import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
 import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
 import javax.wsdl.PortType;
 import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensionRegistry;
+import javax.xml.namespace.QName;
 
 import antlr.ASTVisitor;
 import antlr.collections.AST;
 
+import org.apache.schemas.yoko.bindings.corba.ArgType;
 import org.apache.schemas.yoko.bindings.corba.OperationType;
+import org.apache.schemas.yoko.bindings.corba.RaisesType;
+import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaType;
 
 import org.apache.yoko.wsdl.CorbaConstants;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
 
 public class OperationVisitor implements ASTVisitor {
 
+    private static final String REQUEST_SUFFIX = "Request";
+    private static final String RESPONSE_SUFFIX = "Response";
+    
+    private static final String IN_PARAMETER = "inparameter";
+    private static final String OUT_PARAMETER = "outparameter";
+    private static final String INOUT_PARAMETER = "inoutparameter";
+    private static final String RETURN_PARAMETER = "return";
+    
+    private XmlSchemaCollection schemas;
+    private XmlSchema schema;
+    private TypeMappingType typeMap;
+    
     private Definition definition;
     private TypesVisitor typesVisitor;
     private ExtensionRegistry extReg;
     private PortType portType;
     private Binding binding;
     
-    public OperationVisitor(Definition wsdlDefinition,
+    private Message inputMsg;
+    private Message outputMsg;
+    
+    private Part inputPart;
+    private Part outputPart;
+    
+    private OperationType corbaOperation;
+    
+    public OperationVisitor(XmlSchemaCollection xmlSchemas,
+                            XmlSchema xmlSchema,
+                            TypeMappingType typeMapRef,
+                            Definition wsdlDefinition,
                             TypesVisitor typeVisitor,
                             PortType wsdlPortType,
                             Binding wsdlBinding) {
+        schemas = xmlSchemas;
+        schema = xmlSchema;
+        typeMap = typeMapRef;
         definition = wsdlDefinition;
         typesVisitor = typeVisitor;
         extReg = definition.getExtensionRegistry();
@@ -53,7 +99,7 @@
         binding = wsdlBinding;
     }
     
-    public static boolean accept(AST node) {
+    public static boolean accept(XmlSchemaCollection schemas, XmlSchema schema, AST node)
{
         boolean result = false;
         AST node2 = node.getFirstChild();
         if (node2.getType() == IDLTokenTypes.LITERAL_oneway) {
@@ -63,51 +109,280 @@
             result =
                 type == IDLTokenTypes.LITERAL_void
                 || PrimitiveTypesVisitor.accept(node2)
-                || StringVisitor.accept(node2);
-                // || ScopedNameVisitor.accept(node);
-                // REVISIT: previous line should not be commented out
-                // FIXME fix ScopedNameVisitor
+                || StringVisitor.accept(node2)
+                || ScopedNameVisitor.accept(schemas, schema, node2);
         }
         return result;
     }
     
     public void visit(AST node) {
-        MessageVisitor msgVisitor = new MessageVisitor(definition, typesVisitor);
-        Operation op = definition.createOperation();
-        op.setName(node.toString());
-        op.setUndefined(false);
-        portType.addOperation(op);
-        BindingOperation bindingOperation = createBindingOperation(binding, op);
-        msgVisitor.setOperation(op);
-        msgVisitor.setBindingOperation(bindingOperation);
-        AST node2 = node.getFirstChild();
-        if (node2 != null && node2.getType() == IDLTokenTypes.LITERAL_oneway) {
-            // oneway operations map to operations with input message
-            msgVisitor.createInputMessage();
+        // <op_dcl> ::= [<op_attribute>] <op_type_spec>
+        //              <identifier> <parameter_dcls>
+        //              [<raises_expr>] [<context_expr>]
+        // <op_attribute> ::= "oneway"
+        // <op_type_spec> ::= <param_type_spec>
+        //                  | "void"
+        // <parameter_dcls> ::= "(" <param_dcl> {"," <param_dcl>}* ")"
+        //                    | "(" ")"
+        // <raises_expr> ::= "raises" "(" <scoped_name> {"," <scoped_name>}*
")"
+        // <context_expr> ::= "context" "(" <string_literal> {"," <string_literal>}*
")"
+        
+        
+        Operation operation = generateOperation(node.toString());
+
+        BindingOperation bindingOperation = generateBindingOperation(binding, operation);
+        
+        XmlSchemaSequence inputWrappingSequence = new XmlSchemaSequence();
+        XmlSchemaElement inputElement = generateWrapper(new QName(schema.getTargetNamespace(),
+                                                                  operation.getName()),
+                                                        inputWrappingSequence);
+        inputMsg = generateInputMessage(operation, bindingOperation);
+        inputPart = generateInputPart(inputMsg, inputElement);
+
+        // <op_attribute>
+        node = node.getFirstChild();
+        XmlSchemaSequence outputWrappingSequence = null;
+        XmlSchemaElement outputElement = null;
+        if (node != null && (node.getType() == IDLTokenTypes.LITERAL_oneway)) {
+            // oneway operations map to operations with only input message
+            // no outputMsg nor outputPart need be created
+            node = node.getNextSibling();
         } else {
             // normal operations map to request-response operations
             // with input and output messages
-            msgVisitor.createInputMessage();
-            msgVisitor.createOutputMessage();
+            outputWrappingSequence = new XmlSchemaSequence();
+            outputElement = generateWrapper(new QName(schema.getTargetNamespace(),
+                                                      operation.getName() + RESPONSE_SUFFIX),
+                                            outputWrappingSequence);
+            outputMsg = generateOutputMessage(operation, bindingOperation);
+            outputPart = generateOutputPart(outputMsg, outputElement);           
         }
-        msgVisitor.visit(node);
+        
+        // <op_type_spec>
+        visitOpTypeSpec(node, outputWrappingSequence);
+        
+        // <parameter_dcls>
+        node = node.getNextSibling();
+        while (ParamDclVisitor.accept(node)) {
+            ParamDclVisitor visitor = new ParamDclVisitor(schemas,
+                                                          schema,
+                                                          typeMap,
+                                                          inputWrappingSequence,
+                                                          outputWrappingSequence,
+                                                          corbaOperation);
+            visitor.visit(node);
+
+            node = node.getNextSibling();
+        }
+        
+        // <raises_expr>
+        if (node != null 
+            && node.getType() == IDLTokenTypes.LITERAL_raises) {
+            node = node.getFirstChild();
+            
+            while (node != null) {
+//            ScopedNameVisitor visitor = new ScopedNameVisitor(schemas,
+//                                                              schema,
+//                                                              typeMap);
+//            visitor.visit(node);
+//            XmlSchemaType schemaType = visitor.getSchemaType();
+//            CorbaTypeImpl corbaType = visitor.getCorbaType();
+
+                createFaultMessage(node, operation, bindingOperation);
+                
+                node = node.getNextSibling();
+            }
+        }
+        
     }
 
-    private BindingOperation createBindingOperation(Binding wsdlBinding, Operation op) {
+    private Operation generateOperation(String name) {
+        Operation op = definition.createOperation();
+        op.setName(name);
+        op.setUndefined(false);
+        portType.addOperation(op);
+        return op;
+    }
+    
+    private BindingOperation generateBindingOperation(Binding wsdlBinding, Operation op)
{
         BindingOperation bindingOperation = definition.createBindingOperation();
-        OperationType operationType = null;
+        //OperationType operationType = null;
         try {
-            operationType = (OperationType)extReg.createExtension(BindingOperation.class,
-                                                                  CorbaConstants.NE_CORBA_OPERATION);
+            corbaOperation = (OperationType)extReg.createExtension(BindingOperation.class,
+                                                                   CorbaConstants.NE_CORBA_OPERATION);
         } catch (WSDLException ex) {
             throw new RuntimeException(ex);
         }
-        operationType.setName(op.getName());
-        bindingOperation.addExtensibilityElement(operationType);
+        corbaOperation.setName(op.getName());
+        bindingOperation.addExtensibilityElement(corbaOperation);
         bindingOperation.setOperation(op);
         bindingOperation.setName(op.getName());
         binding.addBindingOperation(bindingOperation);
         return bindingOperation;
     }
 
+
+    public Message generateInputMessage(Operation operation, BindingOperation bindingOperation)
{
+        Message msg = definition.createMessage(); 
+        msg.setQName(new QName(definition.getTargetNamespace(), operation.getName()));
+        msg.setUndefined(false);
+        
+        String inputName = operation.getName() + REQUEST_SUFFIX;
+        Input input = definition.createInput();
+        input.setName(inputName);
+        input.setMessage(msg);
+        
+        BindingInput bindingInput = definition.createBindingInput();
+        bindingInput.setName(inputName);    
+        
+        bindingOperation.setBindingInput(bindingInput);
+        operation.setInput(input);
+        
+        definition.addMessage(msg);
+        
+        return msg;
+    }
+
+    public Message generateOutputMessage(Operation operation, BindingOperation bindingOperation)
{
+        Message msg = definition.createMessage(); 
+        msg.setQName(new QName(definition.getTargetNamespace(),
+                               operation.getName() + RESPONSE_SUFFIX));
+        msg.setUndefined(false);
+        
+        String outputName = operation.getName() + RESPONSE_SUFFIX;
+        Output output = definition.createOutput();
+        output.setName(outputName);
+        output.setMessage(msg);
+        
+        BindingOutput bindingOutput = definition.createBindingOutput();
+        bindingOutput.setName(outputName);    
+        
+        bindingOperation.setBindingOutput(bindingOutput);
+        operation.setOutput(output);
+        
+        definition.addMessage(msg);
+        
+        return msg;
+    }
+    
+    private Part generateInputPart(Message inputMessage, XmlSchemaElement element) {
+        // message - part
+        Part part = definition.createPart();
+        //QName element = inputMsg.getQName();
+        part.setName(IN_PARAMETER);
+        part.setElementName(element.getQName());
+        //typesVisitor.addWrapper(element, inWrappingSequence);
+        inputMessage.addPart(part);
+        return part;        
+    }
+
+    private Part generateOutputPart(Message outputMessage, XmlSchemaElement element) {
+        // message - part
+        Part part = definition.createPart();
+        //QName element = outputMsg.getQName();
+        part.setName(OUT_PARAMETER);
+        part.setElementName(element.getQName());
+        //typesVisitor.addWrapper(element, outWrappingSequence);
+        outputMessage.addPart(part);
+        return part;
+    }
+    
+    /*-
+     * Build the Wrapped Document Style wrapping elements
+     * i.e. <xs:element name="...">
+     *       <xs:complexType>
+     *        <xs:sequence>
+     *         ...
+     *        </xs:sequence>
+     *       </xs:complexType>
+     *      </xs:element>
+     */
+    private XmlSchemaElement generateWrapper(QName el, XmlSchemaSequence wrappingSequence)
{
+        XmlSchemaComplexType schemaComplexType = new XmlSchemaComplexType(schema);
+        schemaComplexType.setParticle(wrappingSequence);
+        
+        XmlSchemaElement wrappingSchemaElement = new XmlSchemaElement();
+        wrappingSchemaElement.setQName(el);
+        wrappingSchemaElement.setName(el.getLocalPart());
+        wrappingSchemaElement.setSchemaType(schemaComplexType);
+
+        schema.getElements().add(el, wrappingSchemaElement);
+        schema.getItems().add(wrappingSchemaElement);
+        
+        return wrappingSchemaElement;
+    }
+
+    private XmlSchemaElement addElement(XmlSchemaSequence schemaSequence,
+                                        XmlSchemaType schemaType,
+                                        String name) {
+        XmlSchemaElement element = new XmlSchemaElement();
+        element.setName(name);
+        //element.setQName(new QName(schema.getTargetNamespace(), name));
+        element.setSchemaTypeName(schemaType.getQName());
+        
+        schemaSequence.getItems().add(element);
+        
+        return element;
+    }
+    
+    private void visitOpTypeSpec(AST node, XmlSchemaSequence outputWrappingSequence) {
+        if (node.getType() == IDLTokenTypes.LITERAL_void) {
+            // nothing to do here, move along
+            return;
+        } else {
+            ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(schemas, schema, typeMap);
+            visitor.visit(node);
+            
+            XmlSchemaType schemaType = visitor.getSchemaType();
+            CorbaTypeImpl corbaType = visitor.getCorbaType();
+            
+            addElement(outputWrappingSequence, schemaType, RETURN_PARAMETER);
+            addCorbaReturn(corbaType, RETURN_PARAMETER);
+        }
+    }
+
+    private void addCorbaReturn(CorbaTypeImpl corbaType, String partName) {
+        ArgType param = new ArgType();
+        param.setName(partName);
+        param.setIdltype(corbaType.getQName());
+        corbaOperation.setReturn(param);
+    }
+
+    private void createFaultMessage(AST node,
+                                    Operation operation, 
+                                    BindingOperation bindingOperation) {
+        String exceptionName = node.toString();
+
+        // message
+        Message faultMsg = definition.createMessage();
+        faultMsg.setQName(new QName(definition.getTargetNamespace(), exceptionName));
+        faultMsg.setUndefined(false);
+
+        // message - part
+        Part part = definition.createPart();
+        part.setName("exception");
+        // REVISIT: should be reading QName from exception XmlSchemaElement
+        // part.setElementName(element.getQName());
+        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());
+        operation.addFault(fault);
+
+        // binding - operation - corba:operation - corba:raises
+        RaisesType raisesType = new RaisesType();
+        raisesType.setException(new QName(typesVisitor.getCorbaTypeMapping().getTargetNamespace(),
+                                          exceptionName));
+        corbaOperation.getRaises().add(raisesType);
+
+        // binding - operation - fault
+        BindingFault bindingFault = definition.createBindingFault();
+        bindingFault.setName(faultMsg.getQName().getLocalPart());
+        bindingOperation.addBindingFault(bindingFault);
+
+        definition.addMessage(faultMsg);
+    }
 }

Added: incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java?view=auto&rev=468436
==============================================================================
--- incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java
(added)
+++ incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamDclVisitor.java
Fri Oct 27 09:09:32 2006
@@ -0,0 +1,127 @@
+/**
+ * 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 antlr.collections.AST;
+
+import org.apache.schemas.yoko.bindings.corba.ModeType;
+import org.apache.schemas.yoko.bindings.corba.OperationType;
+import org.apache.schemas.yoko.bindings.corba.ParamType;
+import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+public class ParamDclVisitor extends TypeSpecVisitorBase {
+
+    private XmlSchemaCollection schemas;
+    private XmlSchema schema;
+    private TypeMappingType typeMap;
+    private XmlSchemaSequence inWrappingSequence; 
+    private XmlSchemaSequence outWrappingSequence;
+    private OperationType corbaOperation;
+    
+    public ParamDclVisitor(XmlSchemaCollection xmlSchemas,
+                           XmlSchema xmlSchema,
+                           TypeMappingType corbaTypeMap,
+                           XmlSchemaSequence inWrapSeq,
+                           XmlSchemaSequence outWrapSeq,
+                           OperationType corbaOp) {
+        super(xmlSchemas, xmlSchema, corbaTypeMap);
+        schemas = xmlSchemas;
+        schema = xmlSchema;
+        typeMap = corbaTypeMap;
+        inWrappingSequence = inWrapSeq;
+        outWrappingSequence = outWrapSeq;
+        corbaOperation = corbaOp;
+    }
+
+    public static boolean accept(AST node) {
+        boolean result = false;
+        if (node != null) {
+            int type = node.getType();
+            result = type == IDLTokenTypes.LITERAL_in
+                || type == IDLTokenTypes.LITERAL_out
+                || type == IDLTokenTypes.LITERAL_inout;
+        }
+        return result;
+    }
+    
+    public void visit(AST node) {
+        // <param_dcl> ::= <param_attribute> <param_type_spec> <simple_declarator>
+        // <param_attribute> ::= "in"
+        //                     | "out"
+        //                     | "inout"
+
+        AST typeNode = node.getFirstChild();
+        AST nameNode = typeNode.getNextSibling();
+        
+        ParamTypeSpecVisitor visitor = new ParamTypeSpecVisitor(schemas, schema, typeMap);
+        visitor.visit(typeNode);
+        XmlSchemaType schemaType = visitor.getSchemaType();
+        CorbaTypeImpl corbaType = visitor.getCorbaType();
+        
+        switch (node.getType()) {
+        case IDLTokenTypes.LITERAL_in: 
+            addElement(inWrappingSequence, schemaType, nameNode.toString());
+            addCorbaParam(corbaType, ModeType.IN, nameNode.toString());
+            break;
+        case IDLTokenTypes.LITERAL_out:
+            addElement(outWrappingSequence, schemaType, nameNode.toString());           

+            addCorbaParam(corbaType, ModeType.OUT, nameNode.toString());
+            break;
+        case IDLTokenTypes.LITERAL_inout:
+            addElement(inWrappingSequence, schemaType, nameNode.toString());
+            addElement(outWrappingSequence, schemaType, nameNode.toString());
+            addCorbaParam(corbaType, ModeType.INOUT, nameNode.toString());
+            break;
+        default:
+            throw new RuntimeException("[ParamDclVisitor: illegal IDL!]");
+        }
+            
+        
+        setSchemaType(schemaType);
+        setCorbaType(corbaType);
+    }
+
+    private XmlSchemaElement addElement(XmlSchemaSequence schemaSequence,
+                                        XmlSchemaType schemaType,
+                                        String name) {
+        XmlSchemaElement element = new XmlSchemaElement();
+        element.setName(name);
+        element.setSchemaTypeName(schemaType.getQName());
+        schemaSequence.getItems().add(element);
+        return element;
+    }
+
+    private void addCorbaParam(CorbaTypeImpl corbaType, ModeType mode, String partName) {
+        ParamType param = new ParamType();
+        param.setName(partName);
+        param.setMode(mode);
+        param.setIdltype(corbaType.getQName());
+        corbaOperation.getParam().add(param);
+    }
+
+}

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

Added: incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamTypeSpecVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamTypeSpecVisitor.java?view=auto&rev=468436
==============================================================================
--- incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamTypeSpecVisitor.java
(added)
+++ incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/ParamTypeSpecVisitor.java
Fri Oct 27 09:09:32 2006
@@ -0,0 +1,75 @@
+/**
+ * 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 antlr.collections.AST;
+
+import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+public class ParamTypeSpecVisitor extends TypeSpecVisitorBase {
+
+    private XmlSchemaCollection schemas;
+    private XmlSchema schema;
+    private TypeMappingType typeMap;
+    
+    public ParamTypeSpecVisitor(XmlSchemaCollection xmlSchemas,
+                                XmlSchema xmlSchema,
+                                TypeMappingType corbaTypeMap) {
+        super(xmlSchemas, xmlSchema, corbaTypeMap);
+        schemas = xmlSchemas;
+        schema = xmlSchema;
+        typeMap = corbaTypeMap;
+    }
+
+    public void visit(AST node) {
+        // <param_type_spec> ::= <base_type_spec>
+        //                     | <string_type>
+        //                     | <wstring_type>
+        //                     | <scoped_name>
+
+        
+        TypeSpecVisitor visitor = null;
+        
+        
+        if (PrimitiveTypesVisitor.accept(node)) {
+            // base_type_spec
+            visitor = new PrimitiveTypesVisitor(schemas, schema, typeMap);
+            
+        } else if (StringVisitor.accept(node)) {
+            // string_type_spec
+            // wstring_type_spec
+            visitor = new StringVisitor(schemas, schema, typeMap);
+
+        } else if (ScopedNameVisitor.accept(schemas, schema, node)) {
+            // scoped_name
+            visitor = new ScopedNameVisitor(schemas, schema, typeMap);
+        
+        }
+        
+        
+        visitor.visit(node);
+
+        setSchemaType(visitor.getSchemaType());
+        setCorbaType(visitor.getCorbaType());
+    }
+}

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

Modified: incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java?view=diff&rev=468436&r1=468435&r2=468436
==============================================================================
--- incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
(original)
+++ incubator/yoko/branches/idltowsdl_anon_refactor/tools/src/main/java/org/apache/yoko/tools/processors/idl/PortTypeVisitor.java
Fri Oct 27 09:09:32 2006
@@ -115,13 +115,20 @@
         while (exportNode != null) {
             
             if (TypeDclVisitor.accept(exportNode)) {
-                TypeDclVisitor visitor = new TypeDclVisitor(schemas, schema, typeMap, typesVisitor);
+                TypeDclVisitor visitor = new TypeDclVisitor(schemas,
+                                                            schema,
+                                                            typeMap,
+                                                            typesVisitor);
                 visitor.visit(exportNode);
             } else if (ConstVisitor.accept(exportNode)) {
-                ConstVisitor visitor = new ConstVisitor(schemas, schema, typeMap);
+                ConstVisitor visitor = new ConstVisitor(schemas,
+                                                        schema,
+                                                        typeMap);
                 visitor.visit(exportNode);
             } else if (ExceptionVisitor.accept(exportNode)) {
-                ExceptionVisitor visitor = new ExceptionVisitor(schemas, schema, typeMap);
+                ExceptionVisitor visitor = new ExceptionVisitor(schemas,
+                                                                schema,
+                                                                typeMap);
                 visitor.visit(exportNode);
             } else if (AttributeVisitor.accept(exportNode)) {
                 AttributeVisitor attributeVisitor = new AttributeVisitor(definition,
@@ -129,8 +136,11 @@
                                                                          portType,
                                                                          binding);
                 attributeVisitor.visit(exportNode);                
-            } else if (OperationVisitor.accept(exportNode)) {
-                OperationVisitor visitor = new OperationVisitor(definition,
+            } else if (OperationVisitor.accept(schemas, schema, exportNode)) {
+                OperationVisitor visitor = new OperationVisitor(schemas,
+                                                                schema,
+                                                                typeMap,
+                                                                definition,
                                                                 typesVisitor,
                                                                 portType,
                                                                 binding);



Mime
View raw message