ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r381970 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/ codegen/src/org/apache/axis2/wsdl/codegen/emitter/ codegen/src/org/apache/axis2/wsdl/codegen/extension/ wsdl/src/org/apache/axis2/wsdl/builder/ w...
Date Wed, 01 Mar 2006 09:55:56 GMT
Author: ajith
Date: Wed Mar  1 01:55:54 2006
New Revision: 381970

URL: http://svn.apache.org/viewcvs?rev=381970&view=rev
Log:
1.Temporarily removed the SchemaUnwrapping code
2.Temporarily removed the Schema parsing code in the WSDLPump since the commons XmlSchema
has a problem in handling  base URI's
3. Added a few comments here and there

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaUnwrapper.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?rev=381970&r1=381969&r2=381970&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
Wed Mar  1 01:55:54 2006
@@ -5,7 +5,7 @@
 # these are loaded in their lexical order
 # Note the last extension - It includes a check to figure out whether proper databinding
has taken place
 # This extension should appear AFTER all the databinding extensions inorder to function properly
-codegen.extension=org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.SchemaUnwrapperExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.JaxMeExtension,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension,org.apache.axis2.wsdl.codegen.extension.PolicyEvaluator
+codegen.extension=org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.JaxMeExtension,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension,org.apache.axis2.wsdl.codegen.extension.PolicyEvaluator
 #codegen.extension=org.apache.axis2.wsdl.codegen.extension.AxisBindingBuilder,org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension
 # The third party schemas to be loaded. e.g. The Xmime extension
 # Note - these will be loaded from the org.apache.axis2.wsdl.codegen.schema package.

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=381970&r1=381969&r2=381970&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
Wed Mar  1 01:55:54 2006
@@ -37,7 +37,6 @@
 import org.apache.axis2.util.PolicyAttachmentUtil;
 import org.apache.axis2.util.PolicyUtil;
 import org.apache.axis2.util.XSLTUtils;
-import org.apache.axis2.wsdl.builder.SchemaUnwrapper;
 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
 import org.apache.axis2.wsdl.codegen.CodeGenerationException;
 import org.apache.axis2.wsdl.codegen.writer.AntBuildWriter;
@@ -92,7 +91,7 @@
 
     private static Map MEPtoClassMap;
     private static Map MEPtoSuffixMap;
-    
+
 
     /**
      * Field constructorMap
@@ -157,7 +156,7 @@
     protected CodeGenConfiguration configuration;
     protected TypeMapper mapper;
     protected URIResolver resolver;
-    
+
     protected PolicyAttachmentUtil attachmentUtil;
 
 
@@ -200,14 +199,14 @@
      */
     protected void addEndpoint(Document doc, Element rootElement) throws Exception {
         WSDLEndpoint endpoint = infoHolder.getPort();
-        
+
         Policy endpointPolicy = attachmentUtil.getPolicyForEndPoint(endpoint.getName());
-        
+
         if (endpointPolicy != null) {
         	String policyString = PolicyUtil.getPolicyAsString(endpointPolicy);
         	addAttribute(doc, "policy", policyString, rootElement);
         }
-        
+
         Element endpointElement = doc.createElement("endpoint");
         org.apache.wsdl.extensions.SOAPAddress address = null;
         Iterator iterator = endpoint.getExtensibilityElements().iterator();
@@ -397,6 +396,7 @@
      * Creates the DOM tree for implementations.
      */
     protected Document createDOMDocumentForInterfaceImplementation() throws Exception {
+
         WSDLInterface boundInterface = infoHolder.getWSDLinterface();
         WSDLBinding binding = infoHolder.getBinding();
         String packageName = configuration.getPackageName();
@@ -411,7 +411,7 @@
         addAttribute(doc, "namespace", boundInterface.getName().getNamespaceURI(), rootElement);
         addAttribute(doc, "interfaceName", localPart, rootElement);
         addAttribute(doc, "callbackname", localPart + CALL_BACK_HANDLER_SUFFIX, rootElement);
-        
+
         // add the wrap classes flag
         if (configuration.isPackClasses()) {
             addAttribute(doc, "wrapped", "yes", rootElement);
@@ -419,8 +419,6 @@
 
         // add SOAP version
         addSoapVersion(binding, doc, rootElement);
-        
-        
 
         // add the end point
         addEndpoint(doc, rootElement);
@@ -450,13 +448,15 @@
         // add the databind supporters. Now the databind supporters are completly contained
inside
         // the stubs implementation and not visible outside
         rootElement.appendChild(createDOMElementforDatabinders(doc, binding));
-        
+
         Object stubMethods;
-        
+
+        //if some extension has added the stub methods property, add them to the
+        //main document
         if ((stubMethods = configuration.getProperty("stubMethods")) != null) {
         	rootElement.appendChild(doc.importNode((Element) stubMethods, true));
         }
-        
+
         doc.appendChild(rootElement);
         return doc;
     }
@@ -529,8 +529,6 @@
         rootElement.appendChild(createDOMElementforDatabinders(doc, binding));
         doc.appendChild(rootElement);
 
-        System.out.println("rootElement = " + rootElement);
-
         return doc;
     }
 
@@ -644,9 +642,9 @@
 
         // ///////////////////////
         doc.appendChild(rootElement);
-        
+
         return doc;
-    }    
+    }
 
     /**
      * @see org.apache.axis2.wsdl.codegen.emitter.Emitter#emitSkeleton()
@@ -667,7 +665,7 @@
                 throw new Exception(CodegenMessages.getMessage("emitter.unknownStyle", codegenStyle
+ ""));
             }
 
-            
+
         } catch (Exception e) {
             throw new CodeGenerationException(e);
         }
@@ -925,21 +923,21 @@
                         addHeaderOperations(soapHeaderOutputParameterList, bindingOperation,
false);
                     }
                 }
-                
+
                 /*
                  * Setting the policy of the operation
                  */
                 WSDLEndpoint endpoint = infoHolder.getPort();
-                
+
                 if (endpoint != null) {
                 	Policy policy = attachmentUtil.getOperationPolicy(endpoint.getName(), operation.getName());
-                	
+
                 	if (policy != null) {
                 		addAttribute(doc, "policy", PolicyUtil.getPolicyAsString(policy), methodElement);
                 	}
-                }	
-                
-                               
+                }
+
+
                 methodElement.appendChild(getInputElement(doc, operation, soapHeaderInputParameterList));
                 methodElement.appendChild(getOutputElement(doc, operation, soapHeaderOutputParameterList));
                 rootElement.appendChild(methodElement);
@@ -973,13 +971,13 @@
                             addHeaderOperations(soapHeaderOutputParameterList, bindingOperation,
false);
                         }
                     }
-                    
+
                     /*
                      * Setting the policy of the operation
                      */
                     WSDLEndpoint endpoint = infoHolder.getPort();
                     Policy policy = attachmentUtil.getOperationPolicy(endpoint.getName(),
operation.getName());
-                    
+
                     if (policy != null) {
                     	addAttribute(doc, "policy", PolicyUtil.getPolicyAsString(policy), methodElement);
                     }
@@ -1130,7 +1128,8 @@
                 root.appendChild(doc.importNode(((Document) o).getDocumentElement(), true));
             } else {
 
-                // oops we have no idea how to do this
+                // oops we have no idea how to do this, if the model provided is not a DOM
document
+                // we are done. we might as well skip  it here
             }
         }
     }
@@ -1140,7 +1139,9 @@
      * expect the fully qulified class names to be present in the class names list due to
the simple
      * reason that they've not been written yet! Hence the mappers class name list needs
to be updated
      * to suit the expected package to be written
-     * in this case we modify the package name to have make the class a inner class of the
stub
+     * in this case we modify the package name to have make the class a inner class of the
stub,
+     * interface or the message receiver depending on the style
+     *
      */
     private void updateMapperClassnames(String fullyQulifiedIncludingClassNamePrefix) {
         Map classNameMap = mapper.getAllMappedNames();
@@ -1153,6 +1154,10 @@
         }
     }
 
+    /**
+     * Update the mappers for the interface
+     * @param boundInterface
+     */
     private void updateMapperForInterface(WSDLInterface boundInterface) {
         String packageName = configuration.getPackageName();
         String interfaceName = getCoreClassName(boundInterface);
@@ -1160,14 +1165,21 @@
         updateMapperClassnames(packageName + "." + interfaceName + ".");
     }
 
+    /**
+     * Update mapper for message receiver
+     * @param boundInterface
+     */
     private void updateMapperForMessageReceiver(WSDLInterface boundInterface) {
         String packageName = configuration.getPackageName();
         String localPart = getCoreClassName(boundInterface);
         String messageReceiver = localPart + MESSAGE_RECEIVER_SUFFIX;
-
         updateMapperClassnames(packageName + "." + messageReceiver + ".");
     }
 
+    /**
+     * Update mapper for the stub
+     * @param boundInterface
+     */
     private void updateMapperForStub(WSDLInterface boundInterface) {
         String packageName = configuration.getPackageName();
         String localPart = getCoreClassName(boundInterface);
@@ -1178,7 +1190,6 @@
 
     /**
      * Writes the Ant build.
-     *
      * @throws Exception
      */
     protected void writeAntBuild() throws Exception {

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?rev=381970&r1=381969&r2=381970&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
Wed Mar  1 01:55:54 2006
@@ -2,6 +2,12 @@
 
 import org.apache.axis2.wsdl.codegen.CodeGenerationException;
 import org.apache.axis2.wsdl.builder.SchemaUnwrapper;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.util.HashMap;
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -18,14 +24,18 @@
  * limitations under the License.
  */
 
+/**
+ * This extension invlokes the schema unwrapper depending on the users setting.
+ * it is desirable to put this extension before other extensions since extnsions
+ * such as the databinding extension may well depend on the schema being unwrapped
+ * previously
+ */
 public class SchemaUnwrapperExtension extends AbstractCodeGenerationExtension {
 
     public void engage() throws CodeGenerationException {
           if (!configuration.isParametersWrapped()){
               //unwrap the schema since we are told to do so
              SchemaUnwrapper.unwrap(configuration.getWom());
-
-
           }
     }
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java?rev=381970&r1=381969&r2=381970&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
Wed Mar  1 01:55:54 2006
@@ -90,6 +90,11 @@
         //check the comptibilty
         checkCompatibility();
 
+        // Note  - typically we  need to check the presence of unwrapped or wrapped
+        // parameter style  here. However XMLBeans nicely generates classes for all
+        // elements,even internal ones and hence in this extension we do not have to
+        // special case anything
+
         Element[] additionalSchemas = loadAdditionalSchemas();
 
         try {
@@ -327,13 +332,13 @@
             HashMap bindingOps = b.getBindingOperations();
             Collection bindingOpsCollection = bindingOps.values();
             for (Iterator iterator1 = bindingOpsCollection.iterator(); iterator1.hasNext();)
{
-                foo((WSDLBindingOperation) iterator1.next());
+                checkInvalidUse((WSDLBindingOperation) iterator1.next());
             }
 
         }
     }
 
-    protected void foo(WSDLBindingOperation bindingOp) {
+    protected void checkInvalidUse(WSDLBindingOperation bindingOp) {
         WSDLBindingMessageReference input = bindingOp.getInput();
         if (input != null) {
             Iterator extIterator = input.getExtensibilityElements()

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaUnwrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaUnwrapper.java?rev=381970&r1=381969&r2=381970&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaUnwrapper.java
(original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/SchemaUnwrapper.java
Wed Mar  1 01:55:54 2006
@@ -54,7 +54,7 @@
             WSDLBinding[] bindingsArray = (WSDLBinding[])
                     bindings.values().toArray(new WSDLBinding[bindings.size()]);
             for (int i = 0; i < bindingsArray.length; i++) {
-                unwrapSchemaForInterface(bindingsArray[i].getBoundInterface(),description);
+                unwrapSchemaForInterface(bindingsArray[i].getBoundInterface());
 
             }
 
@@ -63,7 +63,7 @@
             WSDLInterface[] interfacesArray = (WSDLInterface[])
                     interfaces.values().toArray(new WSDLInterface[interfaces.size()]);
             for (int i = 0; i < interfacesArray.length; i++) {
-                unwrapSchemaForInterface(interfacesArray[i],description);
+                unwrapSchemaForInterface(interfacesArray[i]);
             }
 
 
@@ -76,15 +76,17 @@
      * @param wsdlInterface
      * @param decription
      */
-    private static void unwrapSchemaForInterface(WSDLInterface wsdlInterface,WSDLDescription
decription){
-        Map operationsMap = wsdlInterface.getOperations();
+    private static void unwrapSchemaForInterface(WSDLInterface wsdlInterface){
+        // we should be getting all the operation since we also need to consider the inherited
ones
+        Map operationsMap = wsdlInterface.getAllOperations();
         if (!operationsMap.isEmpty()){
             WSDLOperation[] operations = (WSDLOperation[])
                     operationsMap.values().toArray(new WSDLOperation[operationsMap.size()]);
             WSDLOperation operation;
             for (int i = 0; i < operations.length; i++) {
                 operation = operations[i];
-                //process Schema
+                // There's is no such concept as having multiple output parameters
+                // (atleast in java) so our focus is only in the input message reference
                 MessageReference inputMessage = operation.getInputMessage();
                 processMessageReference(inputMessage);
             }
@@ -96,7 +98,9 @@
     /**
      * Processes a message reference,
      * What we do is to store the relevant message elements inside
-     * the metadata bag for further use
+     * the metadata bag for further use. The unwrapping algorithm
+     * only looks at the sequnece and not anything else
+     *
      * @param messageReference
      */
 
@@ -123,12 +127,8 @@
                                           internalElement.getQName(),
                                           internalElement);
                              }
-
-
                         }
-
                     }
-
                 }
             }
         }

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java?rev=381970&r1=381969&r2=381970&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
(original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
Wed Mar  1 01:55:54 2006
@@ -203,24 +203,27 @@
         // get all the schema elements (as DOM elements) and read them
         // into  commons XMLSchema objects. This comes in handy when we
         // need to populate the message references
-        List typeExtensibilityElements = wsdlTypes.getExtensibilityElements();
-        XmlSchemaCollection commonsSchemaReader = new XmlSchemaCollection();
-        Map namespacesMap = wsdlDefinition.getNamespaces();
-        String[] prefixes = (String[])namespacesMap.keySet().toArray(new String[namespacesMap.size()]);
-        for (int i = 0; i < prefixes.length; i++) {
-            commonsSchemaReader.mapNamespace(prefixes[i],(String)namespacesMap.get(prefixes[i]));
-        }
 
-        XmlSchema schema;
-        for (int i = 0; i < typeExtensibilityElements.size(); i++) {
-            Object extElement =  typeExtensibilityElements.get(i);
-            if (extElement instanceof org.apache.wsdl.extensions.Schema){
-                org.apache.wsdl.extensions.Schema schemaExtesnsibilityElement = ((org.apache.wsdl.extensions.Schema)
extElement);
-                schema = commonsSchemaReader.read(schemaExtesnsibilityElement.getElement());
-                //attach this schema in the extensibility element
-                schemaExtesnsibilityElement.setSchema(schema);
-            }
-        }
+        // this is temporarily commented until the xmlschema baseuri handling is fixed
+
+//        List typeExtensibilityElements = wsdlTypes.getExtensibilityElements();
+//        XmlSchemaCollection commonsSchemaReader = new XmlSchemaCollection();
+//        Map namespacesMap = wsdlDefinition.getNamespaces();
+//        String[] prefixes = (String[])namespacesMap.keySet().toArray(new String[namespacesMap.size()]);
+//        for (int i = 0; i < prefixes.length; i++) {
+//            commonsSchemaReader.mapNamespace(prefixes[i],(String)namespacesMap.get(prefixes[i]));
+//        }
+//
+//        XmlSchema schema;
+//        for (int i = 0; i < typeExtensibilityElements.size(); i++) {
+//            Object extElement =  typeExtensibilityElements.get(i);
+//            if (extElement instanceof org.apache.wsdl.extensions.Schema){
+//                org.apache.wsdl.extensions.Schema schemaExtesnsibilityElement = ((org.apache.wsdl.extensions.Schema)
extElement);
+//                schema = commonsSchemaReader.read(schemaExtesnsibilityElement.getElement());
+//                //attach this schema in the extensibility element
+//                schemaExtesnsibilityElement.setSchema(schema);
+//            }
+//        }
 
 
 
@@ -527,7 +530,8 @@
             wsdlOperation.setInputMessage(wsdlInputMessage);
 
             // attach the right schema element
-            findSchemaElement(wsdlInputMessage,wsdlTypes);
+            // Note  - commented till the XmlSchema baseuri code is fixed
+            //findSchemaElement(wsdlInputMessage,wsdlTypes);
         }
 
         //Create an output message and add
@@ -555,7 +559,8 @@
             wsdlOperation.setOutputMessage(wsdlOutputMessage);
 
             // attach the right schema element
-            findSchemaElement(wsdlOutputMessage,wsdlTypes);
+            //Note - Commented till fixing the commons schema
+            //findSchemaElement(wsdlOutputMessage,wsdlTypes);
 
         }
 
@@ -1180,7 +1185,7 @@
                 }else if (ExtensionConstants.SOAP_12_HEADER.equals(unknown.getElementType())){
                     org.apache.wsdl.extensions.SOAPHeader soapHeaderExtensibilityElement
= (org.apache.wsdl.extensions.SOAPHeader) extensionFactory.getExtensionElement(
                             unknown.getElementType());
-//right now there's no known header binding!. Ignore the copying of values for now
+                       //right now there's no known header binding!. Ignore the copying of
values for now
                     component.addExtensibilityElement(soapHeaderExtensibilityElement);
                 }else if (ExtensionConstants.SOAP_12_BINDING.equals(unknown.getElementType())){
                     org.apache.wsdl.extensions.SOAPBinding soapBindingExtensibiltyElement
= (org.apache.wsdl.extensions.SOAPBinding) extensionFactory



Mime
View raw message