You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2010/10/12 04:50:53 UTC
svn commit: r1021599 - in /cxf/trunk/tools/corba/src:
main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java
main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java
test/resources/idl/Sequence.idl
Author: ffang
Date: Tue Oct 12 02:50:53 2010
New Revision: 1021599
URL: http://svn.apache.org/viewvc?rev=1021599&view=rev
Log:
[CXF-3059] idl2wsdl fails when constant is used to define boundary of sequence.
Modified:
cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java
cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java
cxf/trunk/tools/corba/src/test/resources/idl/Sequence.idl
Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java?rev=1021599&r1=1021598&r2=1021599&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java Tue Oct 12 02:50:53 2010
@@ -66,7 +66,14 @@ public class SequenceVisitor extends Vis
// REVISIT: TypesUtils.getPrimitiveCorbaTypeNameNode should be renamed
// to something more suitable and should be made more general.
AST boundNode = TypesUtils.getCorbaTypeNameNode(simpleTypeSpecNode);
-
+ //get chance to check if bound is symbol name which defined as const,
+ //if so, replace the symbol name with defined const
+ if (boundNode != null) {
+ String constValue = TypesUtils.getConstValueByName(boundNode, typeMap);
+ if (constValue != null) {
+ boundNode.setText(constValue);
+ }
+ }
SimpleTypeSpecVisitor visitor = new SimpleTypeSpecVisitor(new Scope(getScope(), identifierNode),
definition,
Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java?rev=1021599&r1=1021598&r2=1021599&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java (original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java Tue Oct 12 02:50:53 2010
@@ -19,10 +19,16 @@
package org.apache.cxf.tools.corba.processors.idl;
+import java.util.Iterator;
+import java.util.List;
+
import javax.xml.namespace.QName;
import antlr.collections.AST;
+import org.apache.cxf.binding.corba.wsdl.Const;
+import org.apache.cxf.binding.corba.wsdl.CorbaTypeImpl;
+import org.apache.cxf.binding.corba.wsdl.TypeMappingType;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaType;
@@ -95,5 +101,20 @@ public final class TypesUtils {
return scopedName;
}
+
+ public static String getConstValueByName(AST node, TypeMappingType typeMap) {
+ List<CorbaTypeImpl> types = typeMap.getStructOrExceptionOrUnion();
+ for (Iterator<CorbaTypeImpl> it = types.iterator(); it.hasNext();) {
+ CorbaTypeImpl corbaType = it.next();
+ if (corbaType instanceof Const) {
+ Const corbaConst = (Const) corbaType;
+ String name = corbaConst.getQName().getLocalPart();
+ if (name.equals(node.getText())) {
+ return corbaConst.getValue();
+ }
+ }
+ }
+ return null;
+ }
}
Modified: cxf/trunk/tools/corba/src/test/resources/idl/Sequence.idl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idl/Sequence.idl?rev=1021599&r1=1021598&r2=1021599&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idl/Sequence.idl (original)
+++ cxf/trunk/tools/corba/src/test/resources/idl/Sequence.idl Tue Oct 12 02:50:53 2010
@@ -20,7 +20,8 @@
typedef sequence<long> longSequence;
typedef sequence<string> stringSequence;
-typedef sequence<long, 10> boundedLongSequence;
+const long upperBound = 10;
+typedef sequence<long, upperBound> boundedLongSequence;
typedef sequence<string, 2> boundedStringSequence;
typedef sequence<longSequence> longSequenceSequence;