axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/multibinding VerifyFilesTestCase.java
Date Tue, 14 May 2002 18:59:25 GMT
butek       02/05/14 11:59:25

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaBindingWriter.java
                        JavaGeneratorFactory.java JavaImplWriter.java
                        JavaInterfaceWriter.java
                        JavaServiceIfaceWriter.java
                        JavaServiceImplWriter.java JavaSkelWriter.java
                        JavaStubWriter.java JavaTestCaseWriter.java
               java/test/wsdl/multibinding VerifyFilesTestCase.java
  Log:
  The SEI can be named either after the portType or the binding.  We had
  code all over the place in the writers that essentially said, "if literal, name
  is binding, else name is portType".  If we ever want to change that check
  (like NOW - I now want the check to be "if literal and wrapped") then we
  have to change it in all these places.  So instead, I'm now using
  binding.set/getDynamicVar(JavaBindingWriter.SEI_NAME), I'm
  determining it ONCE in JavaGeneratorFactory.generatorPass, and using
  this dynamic var everywhere that we used to have that check.
  
  This has the added goodness that WSDL2Java makes itself very easy to
  extend for someone like Thomas Sandholm who doesn't ever want to do
  that check.
  
  Revision  Changes    Path
  1.7       +6 -0      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBindingWriter.java
  
  Index: JavaBindingWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBindingWriter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JavaBindingWriter.java	10 May 2002 13:30:35 -0000	1.6
  +++ JavaBindingWriter.java	14 May 2002 18:59:24 -0000	1.7
  @@ -79,6 +79,12 @@
       Generator implWriter = null;
       Generator interfaceWriter = null;
   
  +    // This is the dynamic var key for the SEI name.  This name
  +    // could either be derived from the portType or the binding.
  +    // The generatorPass fills this dynamic var in and it is
  +    // used in the writers that need the SEI name.
  +    public static String SEI_NAME = "SEI name";
  +
       /**
        * Constructor.
        */
  
  
  
  1.3       +32 -6     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
  
  Index: JavaGeneratorFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaGeneratorFactory.java	10 May 2002 13:30:35 -0000	1.2
  +++ JavaGeneratorFactory.java	14 May 2002 18:59:24 -0000	1.3
  @@ -172,6 +172,7 @@
           this.symbolTable = symbolTable;
           javifyNames(symbolTable);
           resolveNameClashes(symbolTable);
  +        determineSEINames(symbolTable);
           if (emitter.isAllWanted()) {
               setAllReferencesToTrue();
           }
  @@ -331,7 +332,7 @@
        * Note: This method also ensures that anonymous types are 
        * given unique java type names.
        */
  -    private void javifyNames(SymbolTable symbolTable) {
  +    protected void javifyNames(SymbolTable symbolTable) {
           int uniqueNum = 0;
           HashMap anonQNames = new HashMap();
           Iterator it = symbolTable.getHashMap().values().iterator();
  @@ -389,11 +390,36 @@
           }
       } // javifyNames
   
  +    protected void determineSEINames(SymbolTable symbolTable) {
  +        Iterator it = symbolTable.getHashMap().values().iterator();
  +        while (it.hasNext()) {
  +            Vector v = (Vector) it.next();
  +            for (int i = 0; i < v.size(); ++i) {
  +                SymTabEntry entry = (SymTabEntry) v.elementAt(i);
  +                if (entry instanceof BindingEntry) {
  +                    // The SEI name is normally the portType name.
  +                    // But the binding info MIGHT force the SEI
  +                    // name to be the binding name.
  +                    BindingEntry bEntry = (BindingEntry) entry;
  +                    String seiName = null;
  +                    if (bEntry.hasLiteral() && symbolTable.isWrapped()) {
  +                        seiName = bEntry.getName();
  +                    }
  +                    else {
  +                        PortTypeEntry ptEntry = symbolTable.getPortTypeEntry(
  +                                bEntry.getBinding().getPortType().getQName());
  +                        seiName = ptEntry.getName();
  +                    }                    bEntry.setDynamicVar(JavaBindingWriter.SEI_NAME,
seiName);
  +                }
  +            }
  +        }
  +    } // determineSEINames
  +
       /**
        * Messages, PortTypes, Bindings, and Services can share the same name.  If they do
in this
        * Definition, force their names to be suffixed with _PortType and _Service, respectively.
        */
  -    private void resolveNameClashes(SymbolTable symbolTable) {
  +    protected void resolveNameClashes(SymbolTable symbolTable) {
           Iterator it = symbolTable.getHashMap().values().iterator();
           while (it.hasNext()) {
               Vector v = new Vector((Vector) it.next());  // New vector we can temporarily
add to it
  @@ -541,7 +567,7 @@
        * on WSDL2Java). Set all symbols as referenced (except nonSOAP bindings
        * which we don't know how to deal with).
        */
  -    private void setAllReferencesToTrue() {
  +    protected void setAllReferencesToTrue() {
           Iterator it = symbolTable.getHashMap().values().iterator();
           while (it.hasNext()) {
               Vector v = (Vector) it.next();
  @@ -563,7 +589,7 @@
        * If a binding's type is not TYPE_SOAP, then we don't use that binding
        * or that binding's portType.
        */
  -    private void ignoreNonSOAPBindings(SymbolTable symbolTable) {
  +    protected void ignoreNonSOAPBindings(SymbolTable symbolTable) {
   
           // Look at all uses of the portTypes.  If none of the portType's bindings are of
type
           // TYPE_SOAP, then turn off that portType's isReferenced flag.
  @@ -614,7 +640,7 @@
           }
       } // ignoreNonSOAPBindings
   
  -    private void constructSignatures(SymbolTable symbolTable) {
  +    protected void constructSignatures(SymbolTable symbolTable) {
           Iterator it = symbolTable.getHashMap().values().iterator();
           while (it.hasNext()) {
               Vector v = (Vector) it.next();
  @@ -702,7 +728,7 @@
        * Find all inout/out parameters and add a flag to the Type of that parameter saying
a holder
        * is needed.
        */
  -    private void determineIfHoldersNeeded(SymbolTable symbolTable) {
  +    protected void determineIfHoldersNeeded(SymbolTable symbolTable) {
           Iterator it = symbolTable.getHashMap().values().iterator();
           while (it.hasNext()) {
               Vector v = (Vector) it.next();
  
  
  
  1.18      +1 -4      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaImplWriter.java
  
  Index: JavaImplWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaImplWriter.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- JavaImplWriter.java	9 May 2002 13:14:28 -0000	1.17
  +++ JavaImplWriter.java	14 May 2002 18:59:24 -0000	1.18
  @@ -119,10 +119,7 @@
           PortType portType = binding.getPortType();
           PortTypeEntry ptEntry = symbolTable.getPortTypeEntry(portType.getQName());
   
  -        // If there is not literal use, the interface name is the portType name.
  -        // Otherwise it is the binding name.
  -        String portTypeName = bEntry.hasLiteral() ?
  -                bEntry.getName() : ptEntry.getName();
  +        String portTypeName = (String) bEntry.getDynamicVar(JavaBindingWriter.SEI_NAME);
           pw.print("public class " + className + " implements " + portTypeName);
           pw.println(" {");
   
  
  
  
  1.8       +3 -6      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaInterfaceWriter.java
  
  Index: JavaInterfaceWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaInterfaceWriter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JavaInterfaceWriter.java	9 May 2002 13:14:28 -0000	1.7
  +++ JavaInterfaceWriter.java	14 May 2002 18:59:24 -0000	1.8
  @@ -90,12 +90,9 @@
           this.symbolTable = symbolTable;
           this.bEntry = bEntry;
   
  -        // If there is literal use in this binding, then the interface name is
  -        // derived from the binding name, not the portType name (the default).
  -        if (bEntry.hasLiteral()) {
  -            super.className = Utils.getJavaLocalName(bEntry.getName());
  -            super.fileName = className + ".java";
  -        }
  +        super.className = Utils.getJavaLocalName(
  +                (String) bEntry.getDynamicVar(JavaBindingWriter.SEI_NAME));
  +        super.fileName = className + ".java";
       } // ctor
   
       /**
  
  
  
  1.4       +1 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceIfaceWriter.java
  
  Index: JavaServiceIfaceWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceIfaceWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JavaServiceIfaceWriter.java	9 May 2002 13:14:28 -0000	1.3
  +++ JavaServiceIfaceWriter.java	14 May 2002 18:59:24 -0000	1.4
  @@ -140,8 +140,7 @@
   
               // If there is not literal use, the interface name is the portType name.
               // Otherwise it is the binding name.
  -            String bindingType = bEntry.hasLiteral() ?
  -                    bEntry.getName() : ptEntry.getName();
  +            String bindingType = (String) bEntry.getDynamicVar(JavaBindingWriter.SEI_NAME);
   
               // Write out the get<PortName> methods
               pw.println("    public String get" + portName + "Address();");
  
  
  
  1.11      +1 -4      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java
  
  Index: JavaServiceImplWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JavaServiceImplWriter.java	9 May 2002 13:14:28 -0000	1.10
  +++ JavaServiceImplWriter.java	14 May 2002 18:59:24 -0000	1.11
  @@ -155,10 +155,7 @@
               String portName = Utils.xmlNameToJavaClass(p.getName());
               String stubClass = bEntry.getName() + "Stub";
   
  -            // If there is not literal use, the interface name is the portType name.
  -            // Otherwise it is the binding name.
  -            String bindingType = bEntry.hasLiteral() ?
  -                    bEntry.getName() : ptEntry.getName();
  +            String bindingType = (String) bEntry.getDynamicVar(JavaBindingWriter.SEI_NAME);
   
               // getPort(Class) must return a stub for an interface.  Collect all
               // the port interfaces so the getPort(Class) method can be constructed.
  
  
  
  1.24      +1 -4      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java
  
  Index: JavaSkelWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- JavaSkelWriter.java	9 May 2002 13:14:28 -0000	1.23
  +++ JavaSkelWriter.java	14 May 2002 18:59:24 -0000	1.24
  @@ -111,10 +111,7 @@
           PortTypeEntry ptEntry =
                   symbolTable.getPortTypeEntry(portType.getQName());
   
  -        // If there is not literal use, the interface name is the portType name.
  -        // Otherwise it is the binding name.
  -        String portTypeName = bEntry.hasLiteral() ?
  -                bEntry.getName () : ptEntry.getName();
  +        String portTypeName = (String) bEntry.getDynamicVar(JavaBindingWriter.SEI_NAME);
           boolean isRPC = true;
           if (bEntry.getBindingStyle() == BindingEntry.STYLE_DOCUMENT) {
               isRPC = false;
  
  
  
  1.58      +2 -4      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
  
  Index: JavaStubWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- JavaStubWriter.java	9 May 2002 13:14:28 -0000	1.57
  +++ JavaStubWriter.java	14 May 2002 18:59:24 -0000	1.58
  @@ -123,10 +123,8 @@
           PortTypeEntry ptEntry =
                   symbolTable.getPortTypeEntry(portType.getQName());
   
  -        // If there is not literal use, the interface name is the portType name.
  -        // Otherwise it is the binding name.
  -        String portTypeName = bEntry.hasLiteral() ?
  -                bEntry.getName() : ptEntry.getName();
  +        String portTypeName = 
  +                (String) bEntry.getDynamicVar(JavaBindingWriter.SEI_NAME);
           boolean isRPC = true;
           if (bEntry.getBindingStyle() == BindingEntry.STYLE_DOCUMENT) {
               isRPC = false;
  
  
  
  1.25      +1 -4      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java
  
  Index: JavaTestCaseWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- JavaTestCaseWriter.java	9 May 2002 13:14:28 -0000	1.24
  +++ JavaTestCaseWriter.java	14 May 2002 18:59:24 -0000	1.25
  @@ -179,10 +179,7 @@
               String testMethodName = "test" + counter++ + portName + javaOpName;
               pw.println("    public void " + testMethodName + "() {");
   
  -            // If there is not literal use, the interface name is the portType name.
  -            // Otherwise it is the binding name.
  -            String bindingType = bEntry.hasLiteral() ?
  -                    bEntry.getName() : ptEntry.getName();
  +            String bindingType = (String) bEntry.getDynamicVar(JavaBindingWriter.SEI_NAME);
               writeBindingAssignment(bindingType, portName);
   
               pw.println("        try {");
  
  
  
  1.5       +0 -2      xml-axis/java/test/wsdl/multibinding/VerifyFilesTestCase.java
  
  Index: VerifyFilesTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/multibinding/VerifyFilesTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- VerifyFilesTestCase.java	18 Apr 2002 13:50:42 -0000	1.4
  +++ VerifyFilesTestCase.java	14 May 2002 18:59:25 -0000	1.5
  @@ -76,14 +76,12 @@
        */
       protected Set shouldExist() {
           HashSet set = new HashSet();
  -        set.add("BindingAllLit.java");
           set.add("BindingAllLitImpl.java");
           set.add("BindingAllLitSkeleton.java");
           set.add("BindingAllLitStub.java");
           set.add("BindingNoLitImpl.java");
           set.add("BindingNoLitSkeleton.java");
           set.add("BindingNoLitStub.java");
  -        set.add("BindingSomeLit.java");
           set.add("BindingSomeLitImpl.java");
           set.add("BindingSomeLitSkeleton.java");
           set.add("BindingSomeLitStub.java");
  
  
  

Mime
View raw message