axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r230756 - in /webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen: emitter/MultiLanguageClientEmitter.java extension/SimpleDBExtension.java
Date Mon, 08 Aug 2005 05:38:44 GMT
Author: gdaniels
Date: Sun Aug  7 22:38:41 2005
New Revision: 230756

URL: http://svn.apache.org/viewcvs?rev=230756&view=rev
Log:
Fix build, prep for RPC.

Modified:
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=230756&r1=230755&r2=230756&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
(original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
Sun Aug  7 22:38:41 2005
@@ -5,7 +5,17 @@
 import org.apache.axis2.wsdl.codegen.Constants;
 import org.apache.axis2.wsdl.codegen.writer.*;
 import org.apache.axis2.wsdl.databinding.TypeMapper;
-import org.apache.wsdl.*;
+import org.apache.wsdl.MessageReference;
+import org.apache.wsdl.WSDLBinding;
+import org.apache.wsdl.WSDLBindingOperation;
+import org.apache.wsdl.WSDLConstants;
+import org.apache.wsdl.WSDLDescription;
+import org.apache.wsdl.WSDLEndpoint;
+import org.apache.wsdl.WSDLExtensibilityElement;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+import org.apache.wsdl.WSDLService;
+import org.apache.wsdl.WSDLTypes;
 import org.apache.wsdl.extensions.ExtensionConstants;
 import org.apache.wsdl.extensions.SOAPBody;
 import org.apache.wsdl.extensions.SOAPOperation;
@@ -129,8 +139,6 @@
                     }
                 }
                 //
-                testCompatibiltyAll(axisBinding);
-                //
                 writeInterface(axisBinding);
                 //write interface implementations
                 writeInterfaceImplementation(axisBinding, axisService);
@@ -221,8 +229,7 @@
      * @throws Exception
      */
     protected void writeInterface(WSDLBinding axisBinding) throws Exception {
-        Document interfaceModel = createDOMDocumentForInterface(
-                axisBinding);
+        Document interfaceModel = createDOMDocumentForInterface(axisBinding);
         InterfaceWriter interfaceWriter =
                 new InterfaceWriter(this.configuration.getOutputLocation(),
                         this.configuration.getOutputLanguage());
@@ -396,8 +403,6 @@
 
             for (Iterator iterator = bindingCollection.iterator(); iterator.hasNext();) {
                 axisBinding  =  (WSDLBinding)iterator.next();
-                //test the compatibility
-                testCompatibiltyAll(axisBinding);
                 //write interfaces
                 writeSkeleton(axisBinding);
                 //write interface implementations
@@ -751,11 +756,9 @@
                     localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
                     methodElement);
             if (null != binding) {
-                WSDLBindingOperation bindingOperation = binding.getBindingOperation(
-                        operation.getName());
+                WSDLBindingOperation bindingOperation =
+                        binding.getBindingOperation(operation.getName());
                 addSOAPAction(doc, methodElement, bindingOperation);
-                testCompatibilityInput(bindingOperation);
-                testCompatibilityOutput(bindingOperation);
             }
             addAttribute(doc,
                     "mep",
@@ -974,22 +977,8 @@
         return word.replaceAll("\\W", "_");
     }
 
-    private void testCompatibiltyAll(WSDLBinding binding) {
-        HashMap map = binding.getBindingOperations();
-        WSDLBindingOperation bindingOp;
-        Collection col = map.values();
-        for (Iterator iterator = col.iterator(); iterator.hasNext();) {
-            bindingOp = (WSDLBindingOperation) iterator.next();
-            testCompatibilityInput(bindingOp);
-            testCompatibilityOutput(bindingOp);
-        }
-
-
-    }
-
-    private void testCompatibilityInput(WSDLBindingOperation binding) {
-
-        Iterator extIterator = binding.getInput().getExtensibilityElements()
+    protected void foo(WSDLBindingOperation bindingOp) {
+        Iterator extIterator = bindingOp.getInput().getExtensibilityElements()
                 .iterator();
         while (extIterator.hasNext()) {
             WSDLExtensibilityElement element = (WSDLExtensibilityElement) extIterator.next();
@@ -998,25 +987,6 @@
                         ((SOAPBody) element).getUse())) {
                     throw new RuntimeException(
                             "The use 'encoded' is not supported!");
-                }
-            }
-        }
-    }
-
-    private void testCompatibilityOutput(WSDLBindingOperation binding) {
-
-        WSDLBindingMessageReference output = binding.getOutput();
-        if (output!=null){
-            Iterator extIterator = output.getExtensibilityElements()
-                    .iterator();
-            while (extIterator.hasNext()) {
-                WSDLExtensibilityElement element = (WSDLExtensibilityElement) extIterator.next();
-                if (element.getType().equals(ExtensionConstants.SOAP_BODY)) {
-                    if (WSDLConstants.WSDL_USE_ENCODED.equals(
-                            ((SOAPBody) element).getUse())) {
-                        throw new RuntimeException(
-                                "The use 'encoded' is not supported!");
-                    }
                 }
             }
         }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java?rev=230756&r1=230755&r2=230756&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
(original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
Sun Aug  7 22:38:41 2005
@@ -1,8 +1,5 @@
 package org.apache.axis2.wsdl.codegen.extension;
 
-import org.apache.axis2.wsdl.codegen.CodeGenerationException;
-import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
-
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -18,15 +15,86 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- * author : Eran Chinthaka (chinthaka@apache.org)
+ *
  */
 
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.databinding.JavaTypeMapper;
+import org.apache.axis2.wsdl.databinding.DefaultTypeMapper;
+import org.apache.wsdl.WSDLExtensibilityElement;
+import org.apache.wsdl.WSDLTypes;
+import org.apache.wsdl.extensions.ExtensionConstants;
+import org.apache.wsdl.extensions.Schema;
+import org.apache.axis.xsd.xml.schema.XmlSchemaCollection;
+import org.apache.axis.xsd.xml.schema.XmlSchema;
+import org.w3c.dom.Element;
+
+import java.util.List;
+import java.util.Stack;
+import java.util.Vector;
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+  * Work in progress to test simple DataBinding with the XmlSchema lib
+  *
+  */
 public class SimpleDBExtension extends AbstractCodeGenerationExtension {
     public void init(CodeGenConfiguration configuration) {
-        throw new UnsupportedOperationException();
+        this.configuration = configuration;
     }
 
-    public void engage() throws CodeGenerationException {
-        throw new UnsupportedOperationException();
+    public void engage() {
+        try {
+            WSDLTypes typesList = configuration.getWom().getTypes();
+            if (typesList == null) {
+                //there are no types to be code generated
+                //However if the type mapper is left empty it will be a problem for the other
+                //processes. Hence the default type mapper is set to the configuration
+                this.configuration.setTypeMapper(new DefaultTypeMapper());
+                return;
+            }
+
+            List typesArray = typesList.getExtensibilityElements();
+            WSDLExtensibilityElement extensiblityElt = null;
+
+            for (int i = 0; i < typesArray.size(); i++) {
+                extensiblityElt = (WSDLExtensibilityElement) typesArray.get(i);
+                Vector xmlObjectsVector = new Vector();
+                XmlSchemaCollection schemaColl = new XmlSchemaCollection();
+                Schema schema = null;
+
+                if (ExtensionConstants.SCHEMA.equals(extensiblityElt.getType())) {
+                    schema = (Schema) extensiblityElt;
+                    Map inScopeNS = configuration.getWom().getNamespaces();
+                    for (Iterator it = inScopeNS.keySet().iterator(); it.hasNext();) {
+                        String prefix = (String) it.next();
+                        schemaColl.mapNamespace(prefix,
+                                                (String)inScopeNS.get(prefix));
+                    }
+
+                    Stack importedSchemaStack = schema.getImportedSchemaStack();
+                    //compile these schemas
+                    while (!importedSchemaStack.isEmpty()) {
+                        Element el = ((javax.wsdl.extensions.schema.Schema)importedSchemaStack.pop()).getElement();
+                        XmlSchema thisSchema = schemaColl.read(el);
+                        xmlObjectsVector.add(thisSchema);
+                    }
+                }
+
+                //create the type mapper
+                JavaTypeMapper mapper = new JavaTypeMapper();
+                int length = 0;
+                for (int j = 0; j < length; j++) {
+//                    mapper.addTypeMapping();
+                }
+                //set the type mapper to the config
+                configuration.setTypeMapper(mapper);
+
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
     }
 }



Mime
View raw message