You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/12/12 20:58:49 UTC

svn commit: r356360 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: description/AxisService.java engine/RequestURIBasedDispatcher.java

Author: chinthaka
Date: Mon Dec 12 11:58:42 2005
New Revision: 356360

URL: http://svn.apache.org/viewcvs?rev=356360&view=rev
Log:
Making the RequestURIBasedDispatcher "actually" work. And adding a String alias for each and every operation you add to a service.

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

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=356360&r1=356359&r2=356360&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 Mon Dec 12 11:58:42 2005
@@ -19,13 +19,17 @@
 import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
 import com.ibm.wsdl.extensions.soap.SOAPConstants;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.om.OMElement;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.wsdl.*;
+import org.apache.wsdl.WSDLBindingOperation;
+import org.apache.wsdl.WSDLEndpoint;
+import org.apache.wsdl.WSDLExtensibilityAttribute;
+import org.apache.wsdl.WSDLExtensibilityElement;
+import org.apache.wsdl.WSDLInterface;
+import org.apache.wsdl.WSDLOperation;
+import org.apache.wsdl.WSDLService;
 import org.apache.wsdl.extensions.ExtensionConstants;
 import org.apache.wsdl.extensions.SOAPOperation;
 import org.apache.wsdl.impl.WSDLInterfaceImpl;
@@ -40,7 +44,13 @@
 import javax.xml.namespace.QName;
 import java.io.IOException;
 import java.io.Writer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Class AxisService
@@ -69,7 +79,7 @@
 
     private WSDLService serviceimpl = null;
 
-    private HashMap wsaaction_operationmap = null;
+    private HashMap operationsAliasesMap = null;
 
     private HashMap operations = new HashMap();
 
@@ -85,7 +95,7 @@
 
     public AxisService(WSDLService serviceimpl) {
         this.serviceimpl = serviceimpl;
-        this.wsaaction_operationmap = new HashMap();
+        this.operationsAliasesMap = new HashMap();
         this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());
         this.setServiceInterface(new WSDLInterfaceImpl());
         moduleConfigmap = new HashMap();
@@ -94,7 +104,7 @@
 
     public AxisService() {
         this.serviceimpl = new WSDLServiceImpl();
-        this.wsaaction_operationmap = new HashMap();
+        this.operationsAliasesMap = new HashMap();
         this.setComponentProperty(PARAMETER_KEY, new ParameterIncludeImpl());
         this.setServiceInterface(new WSDLInterfaceImpl());
         moduleConfigmap = new HashMap();
@@ -102,7 +112,7 @@
 
     /**
      * Constructor AxisService
-     * 
+     *
      * @param qName
      */
     public AxisService(QName qName) {
@@ -112,13 +122,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.AxisService#addToengagedModules(javax.xml.namespace.QName)
      */
 
     /**
      * To ebgage a module it is reuired to use this method
-     * 
+     *
      * @param moduleref
      */
     public void engageModule(ModuleDescription moduleref,
@@ -154,7 +164,7 @@
 
     /**
      * To add a operation to a service if a module requird to do so
-     * 
+     *
      * @param module
      */
 
@@ -179,7 +189,7 @@
 
     /**
      * To get a copy from module operation
-     * 
+     *
      * @param axisOperation
      * @return
      * @throws AxisFault
@@ -208,7 +218,7 @@
 
     /**
      * Method getEngadgedModules
-     * 
+     *
      * @return Collection
      */
     public Collection getEngagedModules() {
@@ -217,17 +227,21 @@
 
     /**
      * Method getOperation
-     * 
+     *
      * @param operationName
      * @return AxisOperation
      */
     public AxisOperation getOperation(QName operationName) {
-        return (AxisOperation) operations.get(operationName);
+        AxisOperation axisOperation = (AxisOperation) operations.get(operationName);
+        if (axisOperation == null) {
+            axisOperation = (AxisOperation) operationsAliasesMap.get(operationName.getLocalPart());
+        }
+        return axisOperation;
     }
 
     /**
      * To get the WSDL operation element in service interface
-     * 
+     *
      * @param operationName
      *            <code>QName</cde>
      * @return WSDLOperation <code>WSDLOperation</code>
@@ -239,13 +253,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.AxisService#addOperation(org.apache.axis2.description.AxisOperation)
      */
 
     /**
      * Method addOperation
-     * 
+     *
      * @param axisOperation
      */
     public void addOperation(AxisOperation axisOperation) {
@@ -266,17 +280,19 @@
             }
         }
         operations.put(axisOperation.getName(), axisOperation);
+        operationsAliasesMap.put(axisOperation.getName().getLocalPart(), axisOperation);
+
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.AxisService#setClassLoader(java.lang.ClassLoader)
      */
 
     /**
      * Method setClassLoader
-     * 
+     *
      * @param classLoader
      */
     public void setClassLoader(ClassLoader classLoader) {
@@ -285,13 +301,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.AxisService#getClassLoader()
      */
 
     /**
      * Method getClassLoader
-     * 
+     *
      * @return ClassLoader
      */
     public ClassLoader getClassLoader() {
@@ -300,13 +316,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.AxisService#setContextPath(java.lang.String)
      */
 
     /**
      * Method setContextPath
-     * 
+     *
      * @param contextPath
      */
     public void setContextPath(String contextPath) {
@@ -317,13 +333,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.AxisService#getContextPath()
      */
 
     /**
      * Method getContextPath
-     * 
+     *
      * @return String
      */
     public String getContextPath() {
@@ -332,13 +348,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.AxisService#setStyle(javax.swing.text.Style)
      */
 
     /**
      * Method setStyle
-     * 
+     *
      * @param style
      */
     public void setStyle(String style) {
@@ -349,13 +365,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.AxisService#getStyle()
      */
 
     /**
      * Method getStyle
-     * 
+     *
      * @return String
      */
     public String getStyle() {
@@ -364,20 +380,20 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.PhasesInclude#getPhases(java.util.ArrayList,
      *      int)
      */
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.ParameterInclude#addParameter(org.apache.axis2.description.Parameter)
      */
 
     /**
      * Method addParameter
-     * 
+     *
      * @param param
      */
     public void addParameter(Parameter param) throws AxisFault {
@@ -397,13 +413,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.ParameterInclude#getParameter(java.lang.String)
      */
 
     /**
      * Method getParameter
-     * 
+     *
      * @param name
      * @return Parameter
      */
@@ -421,13 +437,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.FlowInclude#getInFlow()
      */
 
     /**
      * Method getInFlow
-     * 
+     *
      * @return Flow
      */
     public Flow getInFlow() {
@@ -436,13 +452,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.FlowInclude#setInFlow(org.apache.axis2.description.Flow)
      */
 
     /**
      * Method setInFlow
-     * 
+     *
      * @param inFlow
      */
     public void setInFlow(Flow inFlow) {
@@ -453,13 +469,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.FlowInclude#getOutFlow()
      */
 
     /**
      * Method getOutFlow
-     * 
+     *
      * @return Flow
      */
     public Flow getOutFlow() {
@@ -468,13 +484,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.FlowInclude#setOutFlow(org.apache.axis2.description.Flow)
      */
 
     /**
      * Method setOutFlow
-     * 
+     *
      * @param outFlow
      */
     public void setOutFlow(Flow outFlow) {
@@ -485,13 +501,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.FlowInclude#getFaultInFlow()
      */
 
     /**
      * Method getFaultInFlow
-     * 
+     *
      * @return Flow
      */
     public Flow getFaultInFlow() {
@@ -500,13 +516,13 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.axis2.description.FlowInclude#setFaultInFlow(org.apache.axis2.description.Flow)
      */
 
     /**
      * Method setFaultInFlow
-     * 
+     *
      * @param faultFlow
      */
     public void setFaultInFlow(Flow faultFlow) {
@@ -527,7 +543,7 @@
 
     /**
      * Method getOperations
-     * 
+     *
      * @return HashMap
      */
     public HashMap getOperations() {
@@ -572,7 +588,7 @@
      * picked. If more than one Operation is found with the given SOAP Action;
      * null will be ruturned. If no particular Operation is found with the given
      * SOAP Action; null will be returned.
-     * 
+     *
      * @param soapAction
      *            SOAP Action defined for the particular Operation
      * @return A AxisOperation if a unque Operation can be found with the given
@@ -599,7 +615,7 @@
      * the particular SOAP Action. If more than one Operation is found with the
      * given SOAP Action; null will be ruturned. If no particular Operation is
      * found with the given SOAP Action; null will be returned
-     * 
+     *
      * @param endpoint
      *            Particular Enpoint in which the bining is defined with the
      *            particular SOAP Action.
@@ -647,7 +663,7 @@
 
     /**
      * To get the description about the service ty67tyuio
-     * 
+     *
      * @return String
      */
     public String getAxisServiceName() {
@@ -656,7 +672,7 @@
 
     /**
      * Set the description about the service
-     * 
+     *
      * @param axisServiceName
      */
     public void setAxisServiceName(String axisServiceName) {
@@ -810,30 +826,30 @@
      * Map an action (ala WSA action) to the given operation. This is used by
      * addressing based dispatching to figure out which operation it is that a
      * given message is for.
-     * 
+     *
      * @param action
      *            the action key
      * @param axisOperation
      *            the operation to map to
      */
     public void mapActionToOperation(String action, AxisOperation axisOperation) {
-        wsaaction_operationmap.put(action, axisOperation);
+        operationsAliasesMap.put(action, axisOperation);
     }
 
     /**
      * Return the AxisOperation which has been mapped to the given action.
-     * 
+     *
      * @param action
      *            the action key
      * @return the corresponding AxisOperation or null if it isn't found
      */
     public AxisOperation getOperationByAction(String action) {
-        return (AxisOperation) wsaaction_operationmap.get(action);
+        return (AxisOperation) operationsAliasesMap.get(action);
     }
 
     /**
      * To get the parent (which is AxisConfiguration in this case)
-     * 
+     *
      * @return <code>AxisConfiguration</code>
      */
     public AxisServiceGroup getParent() {
@@ -870,7 +886,7 @@
 
     /**
      * Adding module configuration , if there is moduleConfig tag in service
-     * 
+     *
      * @param moduleConfiguration
      */
     public void addModuleConfig(ModuleConfiguration moduleConfiguration) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java?rev=356360&r1=356359&r2=356360&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java Mon Dec 12 11:58:42 2005
@@ -47,6 +47,15 @@
                                        MessageContext messageContext)
             throws AxisFault {
         log.debug("Checking for Operation using target endpoint uri fragment : " + operationName);
+        EndpointReference toEPR = messageContext.getTo();
+        if (toEPR != null && operationName == null) {
+            String filePart = toEPR.getAddress();
+            String[] values = Utils.parseRequestURLForServiceAndOperation(
+                    filePart);
+            if (values.length >= 2 && values[1] != null) {
+                operationName = new QName(values[1]);
+            }
+        }
         if (operationName != null) {
             return service.getOperation(operationName);
         }