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 05:02:36 UTC

svn commit: r1021602 - in /cxf/branches/2.2.x-fixes: ./ tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/ tools/corba/src/test/resources/idl/

Author: ffang
Date: Tue Oct 12 03:02:35 2010
New Revision: 1021602

URL: http://svn.apache.org/viewvc?rev=1021602&view=rev
Log:
Merged revisions 1021599 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1021599 | ffang | 2010-10-12 10:50:53 +0800 (二, 12 10 2010) | 1 line
  
  [CXF-3059] idl2wsdl fails when constant is used to define boundary of sequence.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java
    cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java
    cxf/branches/2.2.x-fixes/tools/corba/src/test/resources/idl/Sequence.idl

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java?rev=1021602&r1=1021601&r2=1021602&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java (original)
+++ cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/SequenceVisitor.java Tue Oct 12 03:02:35 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/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java?rev=1021602&r1=1021601&r2=1021602&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java (original)
+++ cxf/branches/2.2.x-fixes/tools/corba/src/main/java/org/apache/cxf/tools/corba/processors/idl/TypesUtils.java Tue Oct 12 03:02:35 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/branches/2.2.x-fixes/tools/corba/src/test/resources/idl/Sequence.idl
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/tools/corba/src/test/resources/idl/Sequence.idl?rev=1021602&r1=1021601&r2=1021602&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/corba/src/test/resources/idl/Sequence.idl (original)
+++ cxf/branches/2.2.x-fixes/tools/corba/src/test/resources/idl/Sequence.idl Tue Oct 12 03:02:35 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;