axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r561798 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/codegen/writer/ distribution/ kernel/src/org/apache/axis2/description/
Date Wed, 01 Aug 2007 13:57:06 GMT
Author: dims
Date: Wed Aug  1 06:57:06 2007
New Revision: 561798

URL: http://svn.apache.org/viewvc?view=rev&rev=561798
Log:
Work better with recursive WSDL's - (AXIS2-3041 - WSDL2java does not provoide circular wsdl
import support). There is still a problem computing Effective Policy. Generated code compiles
fine. Also removed a mistakenly checked in iml file (IDEA artifact)

Removed:
    webservices/axis2/trunk/java/modules/distribution/distribution.iml
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=561798&r1=561797&r2=561798
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
Wed Aug  1 06:57:06 2007
@@ -279,7 +279,12 @@
         
             axisBindingMessage = (AxisBindingMessage) axisBindingOperation.getChild(key);
             if (axisBindingMessage != null) {
-                return axisBindingMessage.getEffectivePolicy();
+                try {
+                    return axisBindingMessage.getEffectivePolicy();
+                } catch (RuntimeException ex){
+                    System.out.println("ERROR: Ignoring policy - " + ex.getMessage());
+                    log.error(ex.getMessage(), ex);
+                }
             }
         }
         return null;

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java?view=diff&rev=561798&r1=561797&r2=561798
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
Wed Aug  1 06:57:06 2007
@@ -39,6 +39,7 @@
 import java.util.Map;
 import java.util.Vector;
 import java.util.ArrayList;
+import java.util.Stack;
 
 public class WSDL11Writer {
 
@@ -76,7 +77,7 @@
     public void writeWSDL(AxisService axisService, Definition definition, Map changedMap)
{
         try {
             if (axisService != null) {
-                writeWSDL(definition, axisService.getName(), changedMap);
+                writeWSDL(definition, axisService.getName(), changedMap, new Stack());
             }
         } catch (Exception e) {
             throw new RuntimeException("WSDL writing failed!", e);
@@ -85,7 +86,9 @@
 
     private void writeWSDL(Definition definition,
                            String serviceName,
-                           Map changedMap) throws Exception {
+                           Map changedMap,
+                           Stack stack) throws Exception {
+        stack.push(definition);
         // first process the imports and save them.
         Map imports = definition.getImports();
         if (imports != null && (imports.size() > 0)) {
@@ -98,7 +101,10 @@
                 for (Iterator importsIter = importsVector.iterator(); importsIter.hasNext();)
{
                     wsdlImport = (Import)importsIter.next();
                     wsdlName = "wsdl_" + count++ + ".wsdl";
-                    writeWSDL(wsdlImport.getDefinition(), wsdlName, changedMap);
+                    Definition innerDefinition = wsdlImport.getDefinition();
+                    if(!stack.contains(innerDefinition)) {
+                        writeWSDL(innerDefinition, wsdlName, changedMap, stack);
+                    }
                     wsdlImport.setLocationURI(wsdlName);
                 }
             }
@@ -148,6 +154,7 @@
         }
         out.flush();
         out.close();
+        stack.pop();
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=561798&r1=561797&r2=561798
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Wed Aug  1 06:57:06 2007
@@ -294,6 +294,12 @@
 
     private void processTypes(Definition wsdlDefinition, AxisService axisService)
             throws AxisFault {
+        processTypes(wsdlDefinition, axisService, new Stack());
+    }
+
+    private void processTypes(Definition wsdlDefinition, AxisService axisService, Stack stack)
+            throws AxisFault {
+        stack.push(wsdlDefinition);
         // process all the types in all the wsdls
         Types types = wsdlDefinition.getTypes();
         if (types != null) {
@@ -312,9 +318,13 @@
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
                 // process the types recuresiveilt
-                processTypes(wsdlImport.getDefinition(), axisService);
+                Definition innerDefinition = wsdlImport.getDefinition();
+                if(!stack.contains(innerDefinition)){
+                    processTypes(innerDefinition, axisService, stack);
+                }
             }
         }
+        stack.pop();
     }
 
     private void addDocumentation(AxisDescription axisDescription, Element documentationElement)
{
@@ -634,7 +644,7 @@
 
         // setup the schemaMap
         this.schemaMap = new HashMap();
-        populateSchemaMap(wsdl4jDefinition);
+        populateSchemaMap(wsdl4jDefinition, new Stack());
 
         setPolicyRegistryFromService(axisService);
 
@@ -650,8 +660,8 @@
      * @param definition
      */
 
-    private void populateSchemaMap(Definition definition) {
-
+    private void populateSchemaMap(Definition definition, Stack stack) {
+        stack.push(definition);
         Types types = definition.getTypes();
         Object extensibilityElement;
         if (types != null) {
@@ -673,9 +683,13 @@
             values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
-                populateSchemaMap(wsdlImport.getDefinition());
+                Definition innerDefinition = wsdlImport.getDefinition();
+                if(!stack.contains(innerDefinition)) {
+                    populateSchemaMap(innerDefinition, stack);
+                }
             }
         }
+        stack.pop();
     }
 
 
@@ -824,6 +838,19 @@
      */
 
     private PortType getPortType(QName portTypeQName, Definition definition) {
+        return getPortType(portTypeQName, definition, new Stack());
+    }
+
+    /**
+     * get the port type form all the imported documents
+     *
+     * @param portTypeQName
+     * @param definition
+     * @return portType
+     */
+
+    private PortType getPortType(QName portTypeQName, Definition definition, Stack stack)
{
+        stack.push(definition);
         PortType portType = null;
         Iterator iter = definition.getImports().values().iterator();
         Vector values = null;
@@ -832,10 +859,13 @@
             values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
-                // find the binding recursively
-                portType = getPortType(portTypeQName, wsdlImport.getDefinition());
-                if (portType != null) {
-                    break;
+                Definition innerDefinition = wsdlImport.getDefinition();
+                if(stack.contains(innerDefinition)){
+                    // find the binding recursively
+                    portType = getPortType(portTypeQName, innerDefinition, stack);
+                    if (portType != null) {
+                        break;
+                    }
                 }
             }
             if (portType != null) {
@@ -847,9 +877,25 @@
             // this can be in a imported wsdl
             portType = definition.getPortType(portTypeQName);
         }
+        stack.pop();
         return portType;
     }
 
+    private Binding getBinding(QName bindingQName, Definition definition) {
+        ArrayList list = new ArrayList();
+        Binding binding = getBinding(bindingQName, definition, list);
+        if (binding == null) {
+            for(int i=0;i<list.size();i++){
+                Binding binding2 = definition.getBinding(bindingQName);
+                if(binding2 != null && binding2.getPortType() != null){
+                    binding = binding2;
+                    break;
+                }
+            }
+        }
+        return binding;
+    }
+
     /**
      * first find the binding in the given definition
      * if not found serch in the imported doucuments
@@ -859,8 +905,8 @@
      * @return binding
      */
 
-    private Binding getBinding(QName bindingQName, Definition definition) {
-
+    private Binding getBinding(QName bindingQName, Definition definition, ArrayList list)
{
+        list.add(definition);
         Binding binding = null;
         //first try to find a binding in the upper inmport
         Iterator iter = definition.getImports().values().iterator();
@@ -870,20 +916,19 @@
             values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
-                // find the binding recursively
-                binding = getBinding(bindingQName, wsdlImport.getDefinition());
-                if (binding != null) {
-                    break;
+                Definition innerDefinition = wsdlImport.getDefinition();
+                if(!list.contains(innerDefinition)) {
+                    // find the binding recursively
+                    binding = getBinding(bindingQName, innerDefinition, list);
+                    if (binding != null) {
+                        break;
+                    }
                 }
             }
             if (binding != null) {
                 break;
             }
         }
-
-        if (binding == null) {
-            binding = definition.getBinding(bindingQName);
-        }
         return binding;
     }
 
@@ -2548,13 +2593,15 @@
         }
     }
 
+    private void processPoliciesInDefintion(Definition definition) {
+    }
     /**
      * Process the policy definitions
      *
      * @param definition
      */
-    private void processPoliciesInDefintion(Definition definition) {
-
+    private void processPoliciesInDefintion(Definition definition, Stack stack) {
+        stack.push(definition);
         List extElements = definition.getExtensibilityElements();
         ExtensibilityElement extElement;
         UnknownExtensibilityElement unknown = null;
@@ -2585,10 +2632,14 @@
             values = (Vector) iter.next();
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
+                Definition innerDefinition = wsdlImport.getDefinition();
                 // find the binding recursively
-                processPoliciesInDefintion(wsdlImport.getDefinition());
+                if(!stack.contains(innerDefinition)) {
+                    processPoliciesInDefintion(innerDefinition, stack);
+                }
             }
         }
+        stack.pop();
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message