You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by en...@apache.org on 2006/08/01 13:44:23 UTC
svn commit: r427580 - in /incubator/yoko/trunk/tools/src:
main/java/org/apache/yoko/tools/processors/idl/ test/resources/idl/
Author: enolan
Date: Tue Aug 1 06:44:22 2006
New Revision: 427580
URL: http://svn.apache.org/viewvc?rev=427580&view=rev
Log:
Applying matteo patch for jira 107 patch adds support for nested structs.
Modified:
incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/MessagePartVisitor.java
incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ReturnParameterVisitor.java
incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/TypesVisitor.java
incubator/yoko/trunk/tools/src/test/resources/idl/Struct.idl
incubator/yoko/trunk/tools/src/test/resources/idl/expected_Struct.wsdl
Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/MessagePartVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/MessagePartVisitor.java?rev=427580&r1=427579&r2=427580&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/MessagePartVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/MessagePartVisitor.java Tue Aug 1 06:44:22 2006
@@ -153,7 +153,7 @@
part = (Part) inputMsg.getParts().get(0);
}
inWrappedElement = typesVisitor.addElement(inWrappingSequence, element, partName);
- typesVisitor.setCurrentPart(element, partName, param);
+ typesVisitor.setCurrentPart(inWrappedElement, partName, param);
typesVisitor.visit(typeNode);
return part;
}
@@ -171,7 +171,7 @@
part = (Part) outputMsg.getParts().get(0);
}
outWrappedElement = typesVisitor.addElement(outWrappingSequence, element, partName);
- typesVisitor.setCurrentPart(element, partName, param);
+ typesVisitor.setCurrentPart(outWrappedElement, partName, param);
typesVisitor.visit(typeNode);
return part;
}
Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ReturnParameterVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ReturnParameterVisitor.java?rev=427580&r1=427579&r2=427580&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ReturnParameterVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/ReturnParameterVisitor.java Tue Aug 1 06:44:22 2006
@@ -79,7 +79,7 @@
part = (Part) outputMsg.getParts().get(0);
}
outWrappedElement = typesVisitor.addElement(outWrappingSequence, element, partName);
- typesVisitor.setCurrentPart(element, partName, param);
+ typesVisitor.setCurrentPart(outWrappedElement, partName, param);
typesVisitor.visit(typeNode);
return part;
}
@@ -88,8 +88,6 @@
String partName = RETURN_PARAMETER;
ArgType param = createCorbaReturn(partName);
createOutputPart(partName, param, node);
- typesVisitor.setCurrentPart(outputMsg.getQName(), partName, param);
- typesVisitor.visit(node);
}
private ArgType createCorbaReturn(String partName) {
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?rev=427580&r1=427579&r2=427580&view=diff
==============================================================================
--- 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 Tue Aug 1 06:44:22 2006
@@ -119,19 +119,15 @@
XmlSchemaElement element = new XmlSchemaElement();
element.setQName(el);
element.setName(name);
-
- // This is already done in addWrapper ??
- schema.getElements().add(el, element);
schemaSequence.getItems().add(element);
return element;
}
- public void setCurrentPart(QName el, String name, ArgType param) {
+ public void setCurrentPart(XmlSchemaElement element, String name, ArgType param) {
//get the element & check if a type has been set
- XmlSchemaElement element = (XmlSchemaElement) schema.getElements().getItem(el);
- if (element.getSchemaType() == null) {
+ if (element != null && element.getSchemaType() == null) {
currentType = element;
parts.add(name);
currentParam = param;
@@ -145,7 +141,10 @@
case PRIMITIVE: {
visitor = new PrimitiveTypesVisitor(schemas, schema, typeMap);
visitor.visit(node);
- node = node.getNextSibling();
+ if (currentType instanceof XmlSchemaElement) {
+ ((XmlSchemaElement) currentType).setSchemaTypeName(visitor.getSchemaTypeName());
+ currentParam.setIdltype(visitor.getCorbaTypeName());
+ }
break;
}
case ARRAY: {
@@ -177,12 +176,7 @@
//System.err.println("Type not yet supported : " + node);
}
}
- if (visitor != null) {
- if (currentType instanceof XmlSchemaElement) {
- ((XmlSchemaElement) currentType).setSchemaTypeName(visitor.getSchemaTypeName());
- currentParam.setIdltype(visitor.getCorbaTypeName());
- }
- }
+
}
private int getType(AST node) {
Modified: incubator/yoko/trunk/tools/src/test/resources/idl/Struct.idl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/Struct.idl?rev=427580&r1=427579&r2=427580&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/Struct.idl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/Struct.idl Tue Aug 1 06:44:22 2006
@@ -21,7 +21,6 @@
Compensation getCompensation(in Employee emp2);
-/*
struct NestedOutsideStruct {
short aShort;
long aLong;
@@ -32,6 +31,5 @@
Employee employStruct;
Compensation compensationStruct;
};
-*/
};
Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Struct.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Struct.wsdl?rev=427580&r1=427579&r2=427580&view=diff
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Struct.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Struct.wsdl Tue Aug 1 06:44:22 2006
@@ -14,7 +14,16 @@
<corba:member name="currency" idltype="corba:string" />
<corba:member name="praise" idltype="corba:string" />
</corba:struct>
- </corba:typeMapping>
+ <corba:struct xmlns:ns4="http://schemas.apache.org/yoko/idl/Struct" xmlns="http://schemas.apache.org/yoko/idl/Struct/typemap" repositoryID="IDL:NestedOutsideStruct:1.0" name="NestedOutsideStruct" type="ns4:NestedOutsideStruct">
+ <corba:member name="aShort" idltype="corba:short" />
+ <corba:member name="aLong" idltype="corba:long" />
+ <corba:member name="outsider" idltype="OutsideStruct" />
+ </corba:struct>
+ <corba:struct xmlns:ns4="http://schemas.apache.org/yoko/idl/Struct" xmlns="http://schemas.apache.org/yoko/idl/Struct/typemap" repositoryID="IDL:NestedStructs:1.0" name="NestedStructs" type="ns4:NestedStructs">
+ <corba:member name="employStruct" idltype="Employee" />
+ <corba:member name="compensationStruct" idltype="Compensation" />
+ </corba:struct>
+ </corba:typeMapping>
<wsdl:types>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://schemas.apache.org/yoko/idl/Struct" xmlns="http://schemas.apache.org/yoko/idl/Struct" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="OutsideStruct">
@@ -75,6 +84,24 @@
</xs:sequence>
</xs:complexType>
</xs:element>
+ <xs:complexType name="NestedOutsideStruct">
+ <xs:sequence>
+ <xs:element name="aShort" type="xs:short">
+ </xs:element>
+ <xs:element name="aLong" type="xs:int">
+ </xs:element>
+ <xs:element name="outsider" type="OutsideStruct">
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="NestedStructs">
+ <xs:sequence>
+ <xs:element name="employStruct" type="Employee">
+ </xs:element>
+ <xs:element name="compensationStruct" type="Compensation">
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="congratulate">