You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2006/07/12 23:55:00 UTC
svn commit: r421429 [2/2] - in /incubator/ode/scratch/pxe-iapi: axis/ axis2/
axis2/src/ axis2/src/main/java/com/fs/pxe/axis/
axis2/src/main/java/com/fs/pxe/axis2/
axis2/src/main/java/com/fs/pxe/axis2/hooks/ bpel-dd/src/main/xsd/
bpel-runtime/src/main/j...
Added: incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisDispatcher.java
URL: http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisDispatcher.java?rev=421429&view=auto
==============================================================================
--- incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisDispatcher.java (added)
+++ incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisDispatcher.java Wed Jul 12 14:54:59 2006
@@ -0,0 +1,129 @@
+package com.fs.pxe.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.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 PXEAxisDispatcher extends AbstractDispatcher {
+
+ /**
+ * Field NAME
+ */
+ public static final QName NAME = new QName("http://pxe.intalio.org/",
+ "PXEAxisDispatcher");
+ private static final Log log = LogFactory.getLog(PXEAxisDispatcher.class);
+ QName operationName = null;
+
+
+ public AxisOperation findOperation(AxisService service, MessageContext messageContext)
+ throws AxisFault {
+ AxisOperation operation;
+
+ // Start with the wsaAction. We assume wsaAction is the more reliable
+ // way to identify the operation.
+ String action = messageContext.getWSAAction();
+ if (action != null) {
+ log.debug(Messages.getMessage("checkingoperation", action));
+ operation = service.getOperationByAction(action);
+ if (operation != null)
+ return operation;
+ }
+
+ // Failing that, look at the body of the SOAP message. We expect one
+ // element that has the same (local) name as the operation. This works
+ // well for RPC, not always for Doc/Lit.
+ OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
+ if (bodyFirstChild != null) {
+ String localName = bodyFirstChild.getLocalName();
+ log.debug("Checking for Operation using SOAP message body's first child's local name : "
+ + localName);
+ operation = service.getOperation(new QName(localName));
+ if (operation != null)
+ return operation;
+
+ // Of course, the element name most likely uses the suffix
+ // Request or Response, so look for those and strip them.
+ int index = localName.lastIndexOf("Request");
+ if (index + "Request".length() == localName.length()) {
+ return service.getOperation(new QName(localName.substring(0, index)));
+ }
+ index = localName.lastIndexOf("Response");
+ if (index + "Response".length() == localName.length()) {
+ return service.getOperation(new QName(localName.substring(0, index)));
+ }
+ }
+
+ 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();
+ return registry.getService(path);
+ }
+ }
+
+ 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;
+ }
+
+}
Added: incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisService.java
URL: http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisService.java?rev=421429&view=auto
==============================================================================
--- incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisService.java (added)
+++ incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisService.java Wed Jul 12 14:54:59 2006
@@ -0,0 +1,40 @@
+package com.fs.pxe.axis2.hooks;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.WSDL2AxisServiceBuilder;
+import org.apache.axis2.engine.AxisConfiguration;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * Implementation of Axis Service used by PXE iapi to enlist itself
+ * its service. Allows us to build the service using a WSDL definition
+ * using our own receiver.
+ */
+public class PXEAxisService extends AxisService {
+
+ public static AxisService createService(AxisConfiguration axisConfig, Definition wsdlDefinition,
+ QName wsdlServiceName, String portName) throws AxisFault {
+ WSDL2AxisServiceBuilder serviceBuilder =
+ new WSDL2AxisServiceBuilder(wsdlDefinition, wsdlServiceName, portName);
+ serviceBuilder.setServerSide(true);
+ AxisService axisService = serviceBuilder.populateService();
+ axisService.setName(wsdlServiceName.getLocalPart());
+ axisService.setWsdlfound(true);
+ axisService.setClassLoader(axisConfig.getServiceClassLoader());
+
+ Iterator operations = axisService.getOperations();
+ PXEMessageReceiver msgReceiver = new PXEMessageReceiver();
+ while (operations.hasNext()) {
+ AxisOperation operation = (AxisOperation) operations.next();
+ if (operation.getMessageReceiver() == null) {
+ operation.setMessageReceiver(msgReceiver);
+ }
+ }
+ return axisService;
+ }
+}
Added: incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisServlet.java
URL: http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisServlet.java?rev=421429&view=auto
==============================================================================
--- incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisServlet.java (added)
+++ incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEAxisServlet.java Wed Jul 12 14:54:59 2006
@@ -0,0 +1,35 @@
+package com.fs.pxe.axis2.hooks;
+
+import com.fs.pxe.axis2.PXEServer;
+import org.apache.axis2.transport.http.AxisServlet;
+import org.apache.axis2.AxisFault;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+/**
+ * Overrides standard AxisServlet to handle our service configurations and
+ * deployment ourselves.
+ */
+public class PXEAxisServlet extends AxisServlet {
+
+ private PXEServer _pxeServer;
+
+ /**
+ * Initialize the Axis configuration context
+ *
+ * @param config Servlet configuration
+ * @throws ServletException
+ */
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ _pxeServer = new PXEServer();
+ _pxeServer.init(config, axisConfiguration);
+ }
+
+ public void stop() throws AxisFault {
+ super.stop();
+ _pxeServer.shutDown();
+ }
+
+}
Added: incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEMessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEMessageReceiver.java?rev=421429&view=auto
==============================================================================
--- incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEMessageReceiver.java (added)
+++ incubator/ode/scratch/pxe-iapi/axis2/src/main/java/com/fs/pxe/axis2/hooks/PXEMessageReceiver.java Wed Jul 12 14:54:59 2006
@@ -0,0 +1,78 @@
+package com.fs.pxe.axis2.hooks;
+
+import com.fs.pxe.axis2.PXEService;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * Receives messages forwarded by Axis.
+ */
+public class PXEMessageReceiver extends AbstractMessageReceiver {
+
+ private static final Log __log = LogFactory.getLog(PXEMessageReceiver.class);
+
+ private PXEService _service;
+ private ExecutorService _executorService;
+
+ public final void receive(final MessageContext msgContext) throws AxisFault {
+ if (__log.isDebugEnabled())
+ __log.debug("Received message for " + msgContext.getAxisService().getName() +
+ "." + msgContext.getAxisOperation().getName());
+ if (hasResponse(msgContext.getAxisOperation())) {
+ // Client is expecting a response, running in the same thread
+ MessageContext outMsgContext = Utils.createOutMessageContext(msgContext);
+ outMsgContext.getOperationContext().addMessageContext(outMsgContext);
+ invokeBusinessLogic(msgContext, outMsgContext);
+ if (__log.isDebugEnabled()) {
+ __log.debug("Reply for " + msgContext.getAxisService().getName() +
+ "." + msgContext.getAxisOperation().getName());
+ __log.debug("Reply message " + outMsgContext.getEnvelope());
+ }
+ AxisEngine engine = new AxisEngine(
+ msgContext.getOperationContext().getServiceContext().getConfigurationContext());
+ engine.send(outMsgContext);
+ } else {
+ // No response expected, this thread doesn't need us
+ _executorService.submit(new Runnable() {
+ public void run() {
+ try {
+ invokeBusinessLogic(msgContext, null);
+ } catch (AxisFault axisFault) {
+ __log.error("Error process in-only message.", axisFault);
+ }
+ }
+ });
+ }
+ }
+
+ private void invokeBusinessLogic(MessageContext msgContext, MessageContext outMsgContext)
+ throws AxisFault {
+ _service.onAxisMessageExchange(msgContext, outMsgContext, getSOAPFactory(msgContext));
+ }
+
+ public void setService(PXEService service) {
+ _service = service;
+ }
+
+ public void setExecutorService(ExecutorService executorService) {
+ _executorService = executorService;
+ }
+
+ private boolean hasResponse(AxisOperation op) {
+ switch(op.getAxisSpecifMEPConstant()) {
+ case AxisOperation.MEP_CONSTANT_IN_OUT: return true;
+ case AxisOperation.MEP_CONSTANT_OUT_ONLY: return true;
+ case AxisOperation.MEP_CONSTANT_OUT_OPTIONAL_IN: return true;
+ case AxisOperation.MEP_CONSTANT_ROBUST_OUT_ONLY: return true;
+ default: return false;
+ }
+ }
+}
Modified: incubator/ode/scratch/pxe-iapi/bpel-dd/src/main/xsd/dd.xsdconfig
URL: http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/bpel-dd/src/main/xsd/dd.xsdconfig?rev=421429&r1=421428&r2=421429&view=diff
==============================================================================
--- incubator/ode/scratch/pxe-iapi/bpel-dd/src/main/xsd/dd.xsdconfig (original)
+++ incubator/ode/scratch/pxe-iapi/bpel-dd/src/main/xsd/dd.xsdconfig Wed Jul 12 14:54:59 2006
@@ -2,7 +2,7 @@
xmlns:dd="http://pxe.fivesight.com/schemas/2006/06/27/dd">
<xb:namespace uri="http://pxe.fivesight.com/schemas/2006/06/27/dd">
- <xb:package>com.fs.pxe.axis.dd</xb:package>
+ <xb:package>com.fs.pxe.axis2.dd</xb:package>
</xb:namespace>
<xb:namespace uri="##any">
Modified: incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/engine/BpelServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/engine/BpelServerImpl.java?rev=421429&r1=421428&r2=421429&view=diff
==============================================================================
--- incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/engine/BpelServerImpl.java (original)
+++ incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/engine/BpelServerImpl.java Wed Jul 12 14:54:59 2006
@@ -24,7 +24,7 @@
import com.fs.pxe.bpel.pmapi.BpelManagementFacade;
import com.fs.pxe.bpel.runtime.ExpressionLanguageRuntimeRegistry;
import com.fs.pxe.bom.wsdl.Definition4BPEL;
-import com.fs.pxe.axis.dd.TDeployment;
+import com.fs.pxe.axis2.dd.TDeployment;
import com.fs.utils.msg.MessageBundle;
import java.io.*;
Modified: incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/engine/ProcessDDInitializer.java
URL: http://svn.apache.org/viewvc/incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/engine/ProcessDDInitializer.java?rev=421429&r1=421428&r2=421429&view=diff
==============================================================================
--- incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/engine/ProcessDDInitializer.java (original)
+++ incubator/ode/scratch/pxe-iapi/bpel-runtime/src/main/java/com/fs/pxe/bpel/engine/ProcessDDInitializer.java Wed Jul 12 14:54:59 2006
@@ -10,9 +10,9 @@
import com.fs.pxe.bpel.iapi.BpelEngineException;
import com.fs.pxe.bpel.iapi.EndpointReference;
import com.fs.pxe.bom.wsdl.Definition4BPEL;
-import com.fs.pxe.axis.dd.TDeployment;
-import com.fs.pxe.axis.dd.TInvoke;
-import com.fs.pxe.axis.dd.TProvide;
+import com.fs.pxe.axis2.dd.TDeployment;
+import com.fs.pxe.axis2.dd.TInvoke;
+import com.fs.pxe.axis2.dd.TProvide;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Element;