Author: keith
Date: Wed Apr 2 07:57:46 2008
New Revision: 15494
Log:
Adding a dispatcher to dispatched to undispatched operations. Mashup-637
Added:
trunk/mashup/java/modules/core/src/org/wso2/mashup/dispatchers/UndispatchedOperationDispatcher.java
Modified:
trunk/mashup/java/modules/core/conf/axis2.xml
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
Modified: trunk/mashup/java/modules/core/conf/axis2.xml
==============================================================================
--- trunk/mashup/java/modules/core/conf/axis2.xml (original)
+++ trunk/mashup/java/modules/core/conf/axis2.xml Wed Apr 2 07:57:46 2008
@@ -360,6 +360,8 @@
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+ <handler name="UndispatchedOperationDispatcher"
+
class="org.wso2.mashup.dispatchers.UndispatchedOperationDispatcher"/>
</phase>
<!-- System pre defined phases -->
<phase name="RMPhase"/>
@@ -420,6 +422,8 @@
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+ <handler name="UndispatchedOperationDispatcher"
+
class="org.wso2.mashup.dispatchers.UndispatchedOperationDispatcher"/>
</phase>
<phase name="RMPhase"/>
<phase name="OpPhase"/>
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
Wed Apr 2 07:57:46 2008
@@ -140,4 +140,5 @@
public static final String PASSWORD_SEPARATOR = "<separator/>";
public static String MASHUP_PRIVATE_FOLDER_NAME = "_private";
+ public static String UNDISPATCHED_OPERATION = "undispatched";
}
Added:
trunk/mashup/java/modules/core/src/org/wso2/mashup/dispatchers/UndispatchedOperationDispatcher.java
==============================================================================
--- (empty file)
+++
trunk/mashup/java/modules/core/src/org/wso2/mashup/dispatchers/UndispatchedOperationDispatcher.java
Wed Apr 2 07:57:46 2008
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2006,2007 WSO2, Inc. http://www.wso2.org
+ *
+ * Licensed 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.wso2.mashup.dispatchers;
+
+import org.apache.axis2.AxisFault;
+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.description.Parameter;
+import org.apache.axis2.engine.AbstractDispatcher;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.mashup.MashupConstants;
+
+import javax.xml.namespace.QName;
+
+public class UndispatchedOperationDispatcher extends AbstractDispatcher {
+ private static final Log log =
LogFactory.getLog(UndispatchedOperationDispatcher.class);
+
+ /**
+ * Called by Axis Engine to find the operation.
+ */
+ public AxisOperation findOperation(AxisService service, MessageContext
messageContext)
+ throws AxisFault {
+ Parameter parameter =
service.getParameter(MashupConstants.UNDISPATCHED_OPERATION);
+ if (parameter != null) {
+ String undispatchedOperation = (String) parameter.getValue();
+ AxisOperation operation = service.getOperation(new
QName(undispatchedOperation));
+ if (operation != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Dispatching to operation " +
undispatchedOperation);
+ }
+ return operation;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Called by Axis Engine to find the service.
+ */
+ public AxisService findService(MessageContext messageContext) throws
AxisFault {
+ return null;
+ }
+
+ public void initDispatcher() {
+ init(new HandlerDescription("UndispatchedOperationDispatcher"));
+ }
+}
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev