axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r375878 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description: AxisOperation.java AxisService.java
Date Wed, 08 Feb 2006 07:11:51 GMT
Author: deepal
Date: Tue Feb  7 23:11:50 2006
New Revision: 375878

URL: http://svn.apache.org/viewcvs?rev=375878&view=rev
Log:
- if some module wants to add control operations to a service when they are engaged to an
operation of that service

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java?rev=375878&r1=375877&r2=375878&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
Tue Feb  7 23:11:50 2006
@@ -23,14 +23,14 @@
 import java.util.Iterator;
 
 public abstract class AxisOperation extends AxisDescription
-        implements  WSDLConstants {
+        implements WSDLConstants {
     public static final String STYLE_RPC = "rpc";
     public static final String STYLE_MSG = "msg";
     public static final String STYLE_DOC = "doc";
     private Log log = LogFactory.getLog(getClass());
     private int mep = MEP_CONSTANT_INVALID;
 
-    public static final String SOAP_ACTION ="soapaction";
+    public static final String SOAP_ACTION = "soapaction";
 
     // to store engaged modules
     private ArrayList engagedModules = new ArrayList();
@@ -51,7 +51,7 @@
     private QName name;
 
     private ArrayList wsamappingList;
-    
+
     public AxisOperation() {
         mepURI = MEP_URI_IN_OUT;
         modulerefs = new ArrayList();
@@ -118,9 +118,20 @@
                 needToadd = false;
             }
         }
-
-        new PhaseResolver(axisConfig).engageModuleToOperation(this, moduleref);
-
+        // adding control operations
+        ((AxisService) getParent()).addModuleOperations(moduleref, axisConfig);
+        PhaseResolver phaseResolver = new PhaseResolver(axisConfig);
+        phaseResolver.engageModuleToOperation(this, moduleref);
+
+        HashMap map = moduleref.getOperations();
+        Collection col = map.values();
+
+        for (Iterator iterator = col.iterator(); iterator.hasNext();) {
+            AxisOperation axisOperation = (AxisOperation) iterator.next();
+            AxisOperation serviceop =
+                    ((AxisService) getParent()).getOperation(axisOperation.getName());
+            phaseResolver.engageModuleToOperation(serviceop, moduleref);
+        }
         if (needToadd) {
             engagedModules.add(moduleref);
         }
@@ -161,7 +172,7 @@
     }
 
     /**
-     * Finds a MEPContext for an incoming message. An incoming message can be 
+     * Finds a MEPContext for an incoming message. An incoming message can be
      * of two states.
      * <p/>
      * 1)This is a new incomming message of a given MEP. 2)This message is a
@@ -224,7 +235,7 @@
     }
 
     /**
-     * Maps the String URI of the Message exchange pattern to a integer. 
+     * Maps the String URI of the Message exchange pattern to a integer.
      * Further, in the first lookup, it will cache the looked
      * up value so that the subsequent method calls are extremely efficient.
      */
@@ -367,14 +378,15 @@
     public void setWsamappingList(ArrayList wsamappingList) {
         this.wsamappingList = wsamappingList;
     }
+
     /**
      * 
      */
-    public OperationClient createClient (ServiceContext sc, Options options){
-        throw new UnsupportedOperationException ("The MEP you are using (" + mepURI + ")
has not implemented createClient().");
+    public OperationClient createClient(ServiceContext sc, Options options) {
+        throw new UnsupportedOperationException("The MEP you are using (" + mepURI + ") has
not implemented createClient().");
     }
-    
+
     public Object getKey() {
-    	return getName();
+        return getName();
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=375878&r1=375877&r2=375878&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
Tue Feb  7 23:11:50 2006
@@ -25,15 +25,14 @@
 import org.apache.axis2.modules.Module;
 import org.apache.axis2.util.PolicyUtil;
 import org.apache.axis2.wsdl.builder.SchemaGenerator;
-import org.apache.axis2.wsdl.builder.WSDLComponentFactory;
 import org.apache.axis2.wsdl.writer.WOMWriter;
 import org.apache.axis2.wsdl.writer.WOMWriterFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.wsdl.*;
-import org.apache.wsdl.extensions.*;
+import org.apache.wsdl.WSDLConstants;
+import org.apache.wsdl.WSDLDescription;
 
 import javax.wsdl.*;
 import javax.wsdl.extensions.soap.SOAPAddress;
@@ -149,10 +148,11 @@
 
                 this.mapActionToOperation((String) parameter.getValue(), axisOperation);
             }
-
-            // this opration is a control operation.
-            axisOperation.setControlOperation(true);
-            this.addOperation(axisOperation);
+            if (this.getOperation(axisOperation.getName()) == null) {
+                // this opration is a control operation.
+                axisOperation.setControlOperation(true);
+                this.addOperation(axisOperation);
+            }
         }
     }
 
@@ -325,72 +325,6 @@
             printUsingWOM(out, serviceURL);
         }
     }
-
-    private WSDLBinding generateBinding(WSDLComponentFactory wsdlComponentFactory,
-                                        WSDLInterface portType, QName bindingName,
-                                        String style,
-                                        String use,
-                                        String trsportURI,
-                                        String namespeceURI) {
-        WSDLBinding binding = wsdlComponentFactory.createBinding();
-
-        ExtensionFactory extensionFactory = wsdlComponentFactory.createExtensionFactory();
-
-        binding.setBoundInterface(portType);
-        binding.setName(bindingName);
-
-        SOAPBinding soapbindingImpl = (SOAPBinding) extensionFactory.getExtensionElement(
-                ExtensionConstants.SOAP_11_BINDING);
-        soapbindingImpl.setStyle(style);
-        soapbindingImpl.setTransportURI(trsportURI);
-        binding.addExtensibilityElement(soapbindingImpl);
-
-        Iterator op_itr = portType.getOperations().keySet().iterator();
-        while (op_itr.hasNext()) {
-            String opName = (String) op_itr.next();
-            WSDLOperation wsdlOperation = portType.getOperation(opName);
-            MessageReference inMessage = wsdlOperation.getInputMessage();
-
-            WSDLBindingOperation bindingoperation = wsdlComponentFactory.createWSDLBindingOperation();
-            bindingoperation.setName(new QName(opName));
-            bindingoperation.setOperation(wsdlOperation);
-            binding.addBindingOperation(bindingoperation);
-
-            SOAPOperation soapOpimpl = (SOAPOperation) extensionFactory.getExtensionElement(
-                    ExtensionConstants.SOAP_11_OPERATION);
-            soapOpimpl.setStyle(style);
-            //to do heve to set a proper SOAPAction
-            soapOpimpl.setSoapAction(opName);
-            bindingoperation.addExtensibilityElement(soapOpimpl);
-            if (inMessage != null) {
-                WSDLBindingMessageReference bindingInMessage = wsdlComponentFactory.createWSDLBindingMessageReference();
-                bindingInMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
-                bindingoperation.setInput(bindingInMessage);
-
-                SOAPBody requestSoapbody = (SOAPBody) extensionFactory.getExtensionElement(
-                        ExtensionConstants.SOAP_11_BODY);
-                requestSoapbody.setUse(use);
-                //todo need to fix this
-                requestSoapbody.setNamespaceURI(namespeceURI);
-                bindingInMessage.addExtensibilityElement(requestSoapbody);
-            }
-
-            MessageReference outMessage = wsdlOperation.getOutputMessage();
-            if (outMessage != null) {
-                WSDLBindingMessageReference bindingOutMessage = wsdlComponentFactory.createWSDLBindingMessageReference();
-
-                bindingOutMessage.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
-                bindingoperation.setOutput(bindingOutMessage);
-                SOAPBody resSoapbody = (SOAPBody) extensionFactory.getExtensionElement(
-                        ExtensionConstants.SOAP_11_BODY);
-                resSoapbody.setUse(use);
-                resSoapbody.setNamespaceURI(namespeceURI);
-                bindingOutMessage.addExtensibilityElement(resSoapbody);
-            }
-        }
-        return binding;
-    }
-
 
     private void printUsingWSDLDefinition(OutputStream out, String serviceURL) throws AxisFault
{
         try {



Mime
View raw message