ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r742786 - in /ode/trunk: axis2-war/src/main/webapp/WEB-INF/conf/ axis2/src/main/java/org/apache/ode/axis2/hooks/
Date Mon, 09 Feb 2009 23:22:08 GMT
Author: midon
Date: Mon Feb  9 23:22:02 2009
New Revision: 742786

URL: http://svn.apache.org/viewvc?rev=742786&view=rev
Log:
ODE-415: split the ODEAxisDispatcher into 2 distinct dispatchers

Added:
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java
      - copied, changed from r740964, ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisDispatcher.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java
Removed:
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisDispatcher.java
Modified:
    ode/trunk/axis2-war/src/main/webapp/WEB-INF/conf/axis2.xml
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java

Modified: ode/trunk/axis2-war/src/main/webapp/WEB-INF/conf/axis2.xml
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/main/webapp/WEB-INF/conf/axis2.xml?rev=742786&r1=742785&r2=742786&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/main/webapp/WEB-INF/conf/axis2.xml (original)
+++ ode/trunk/axis2-war/src/main/webapp/WEB-INF/conf/axis2.xml Mon Feb  9 23:22:02 2009
@@ -224,13 +224,13 @@
                      class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
             <handler name="SOAPActionBasedDispatcher"
                      class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
-            <handler name="ODEAxisDispatcher"
-                     class="org.apache.ode.axis2.hooks.ODEAxisDispatcher"/>
+            <handler name="ODEAxisServiceDispatcher"
+                     class="org.apache.ode.axis2.hooks.ODEAxisServiceDispatcher"/>
         </phase>
         <phase name="Security"/>
         <phase name="Addressing">
-            <handler name="ODEAxisDispatcher"
-                     class="org.apache.ode.axis2.hooks.ODEAxisDispatcher"/>
+            <handler name="ODEAxisOperationDispatcher"
+                     class="org.apache.ode.axis2.hooks.ODEAxisOperationDispatcher"/>
             <handler name="AddressingBasedDispatcher"
                      class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"/>
         </phase>

Copied: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java
(from r740964, ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisDispatcher.java)
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java?p2=ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java&p1=ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisDispatcher.java&r1=740964&r2=742786&rev=742786&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisDispatcher.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisOperationDispatcher.java
Mon Feb  9 23:22:02 2009
@@ -38,14 +38,13 @@
 /**
  * Dispatches the service based on the information from the target endpoint URL.
  */
-public class ODEAxisDispatcher extends AbstractDispatcher {
-    private static final long serialVersionUID = 2809507126685915170L;
+public class ODEAxisOperationDispatcher extends AbstractDispatcher {
 
     private static MultiKeyMap _elmtToOperation = new MultiKeyMap();
 
     /** Field NAME */
-    public static final String NAME = "ODEAxisDispatcher";
-    private static final Log log = LogFactory.getLog(ODEAxisDispatcher.class);
+    public static final String NAME = "ODEAxisOperationDispatcher";
+    private static final Log log = LogFactory.getLog(ODEAxisOperationDispatcher.class);
     QName operationName = null;
 
     public AxisOperation findOperation(AxisService service, MessageContext messageContext)
@@ -107,23 +106,7 @@
      * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
      */
     public AxisService findService(MessageContext messageContext) throws AxisFault {
-        EndpointReference toEPR = messageContext.getTo();
-
-        if (toEPR != null) {
-            log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
-
-            // The only thing we understand if a service name that
-            // follows /processes/ in the request URL.
-            String path = parseRequestURLForService(toEPR.getAddress());
-            if (path != null) {
-                AxisConfiguration registry =
-                        messageContext.getConfigurationContext().getAxisConfiguration();
-                AxisService service = registry.getService(path);
-                log.debug("Found service in registry from name " + path + ": " + service);
-                return service;
-            }
-        }
-        log.warn("No service has been found!");
+        // #ODEAxisServiceDispatcher will do that
         return null;
     }
 
@@ -132,31 +115,6 @@
     }
 
     /**
-     * Obtain the service name from the request URL. The request URL is
-     * expected to use the path "/processes/" under which all processes
-     * and their services are listed. Returns null if the path does not
-     * contain this part.
-     */
-    protected String parseRequestURLForService(String path) {
-        int index = path.indexOf("/processes/");
-        if (-1 != index) {
-            String service;
-
-            int serviceStart = index + "/processes/".length();
-            if (path.length() > serviceStart + 1) {
-                service = path.substring(serviceStart);
-                // Path may contain query string, not interesting for us.
-                int queryIndex = service.indexOf('?');
-                if (queryIndex > 0) {
-                    service = service.substring(0, queryIndex);
-                }
-                return service;
-            }
-        }
-        return null;
-    }
-
-    /**
      * Associates an operation and the corresponding message part element name. Only
      * makes sense for doc/lit services (only one part) for which the operation can't
      * easily be guessed from the message element name.
@@ -168,4 +126,5 @@
         if (operationName.equals(elmtName)) return;
         _elmtToOperation.put(axisServiceName, elmtName, operationName);
     }
-}
+
+}
\ No newline at end of file

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java?rev=742786&r1=742785&r2=742786&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisService.java Mon Feb 
9 23:22:02 2009
@@ -36,11 +36,8 @@
 import javax.wsdl.Service;
 import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.ServiceBuilder;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
@@ -287,7 +284,7 @@
                 Part part = (Part) parts.iterator().next();
                 // Parts are types, it's rpc/enc, no mapping needs to be declared
                 if (part.getElementName() != null)
-                    ODEAxisDispatcher.addElmtToOpMapping(axisServiceName, wsdlOp.getName(),
part.getElementName()
+                    ODEAxisOperationDispatcher.addElmtToOpMapping(axisServiceName, wsdlOp.getName(),
part.getElementName()
                             .getLocalPart());
             }
         }

Added: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java?rev=742786&view=auto
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java
(added)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/hooks/ODEAxisServiceDispatcher.java
Mon Feb  9 23:22:02 2009
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.axis2.hooks;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.engine.AbstractDispatcher;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.i18n.Messages;
+import org.apache.commons.collections.map.MultiKeyMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Dispatches the service based on the information from the target endpoint URL.
+ */
+public class ODEAxisServiceDispatcher extends AbstractDispatcher {
+
+    /** Field NAME */
+    public static final String NAME = "ODEAxisServiceDispatcher";
+    private static final Log log = LogFactory.getLog(ODEAxisServiceDispatcher.class);
+    QName operationName = null;
+
+    public AxisOperation findOperation(AxisService service, MessageContext messageContext)
+            throws AxisFault {
+        // #ODEAxisOperationDispatcher will do that
+        return null;
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
+     */
+    public AxisService findService(MessageContext messageContext) throws AxisFault {
+        EndpointReference toEPR = messageContext.getTo();
+
+        if (toEPR != null) {
+            log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
+
+            // The only thing we understand if a service name that
+            // follows /processes/ in the request URL.
+            String path = parseRequestURLForService(toEPR.getAddress());
+            if (path != null) {
+                AxisConfiguration registry =
+                        messageContext.getConfigurationContext().getAxisConfiguration();
+                AxisService service = registry.getService(path);
+                log.debug("Found service in registry from name " + path + ": " + service);
+                return service;
+            }
+        }
+        log.warn("No service has been found!");
+        return null;
+    }
+
+    public void initDispatcher() {
+        init(new HandlerDescription(NAME));
+    }
+
+    /**
+     * Obtain the service name from the request URL. The request URL is
+     * expected to use the path "/processes/" under which all processes
+     * and their services are listed. Returns null if the path does not
+     * contain this part.
+     */
+    protected String parseRequestURLForService(String path) {
+        int index = path.indexOf("/processes/");
+        if (-1 != index) {
+            String service;
+
+            int serviceStart = index + "/processes/".length();
+            if (path.length() > serviceStart + 1) {
+                service = path.substring(serviceStart);
+                // Path may contain query string, not interesting for us.
+                int queryIndex = service.indexOf('?');
+                if (queryIndex > 0) {
+                    service = service.substring(0, queryIndex);
+                }
+                return service;
+            }
+        }
+        return null;
+    }
+
+}



Mime
View raw message