Author: heiko.braun(a)jboss.com
Date: 2009-11-06 08:30:21 -0500 (Fri, 06 Nov 2009)
New Revision: 245
Added:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationContext.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationContext.java
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationContext.java
Modified:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
branches/hbraun/runtime/jbossesb-bpel/src/test/java/org/jboss/soa/esb/actions/bpel/TestBPELEngine.java
Log:
test drive InvocationContext API
Modified:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java
===================================================================
---
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java 2009-11-06
09:29:25 UTC (rev 244)
+++
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/BPELEngine.java 2009-11-06
13:30:21 UTC (rev 245)
@@ -17,13 +17,11 @@
*/
package org.jboss.soa.bpel.runtime.engine;
-import org.apache.ode.bpel.iapi.Message;
-import org.w3c.dom.Element;
-
/**
* This interface represents a BPEL engine.
*
* @author gbrown
+ * @author Heiko Braun
*
*/
public interface BPELEngine {
@@ -36,22 +34,15 @@
*
* @throws Exception Failed to initialize
*/
- public void init() throws Exception;
-
- /**
- * This method invokes a BPEL process, associated with the supplied
- * service and operation, using the supplied message.
- *
- * @param operation The operation name
- * @param service The service QName
- * @param message The message
- * @return A response to the message, or null if no response is
- * required.
- * @throws BPELFault Process raised a fault
- * @throws Exception Failed to invoke the operation
- */
- public Element invoke(String operation, javax.xml.namespace.QName service,
- org.w3c.dom.Element message) throws BPELFault, Exception;
+ public void init() throws Exception;
+
+ /**
+ *
+ * @param invocationContext
+ * @throws BPELFault
+ * @throws Exception
+ */
+ public void invoke(InvocationContext invocationContext) throws BPELFault, Exception;
/**
* This method closes the BPEL engine.
Added:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationContext.java
===================================================================
---
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationContext.java
(rev 0)
+++
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/InvocationContext.java 2009-11-06
13:30:21 UTC (rev 245)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.soa.bpel.runtime.engine;
+
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public interface InvocationContext<T>
+{
+ String getOperationName();
+ QName getServiceName();
+
+ void parseRequest(MyRoleMessageExchange mex, Message request);
+ void parseResponse(MyRoleMessageExchange mex);
+
+ T getInvocationResult();
+
+}
Modified:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
---
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-06
09:29:25 UTC (rev 244)
+++
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2009-11-06
13:30:21 UTC (rev 245)
@@ -41,18 +41,12 @@
import org.jboss.soa.bpel.runtime.engine.BPELEngine;
import org.jboss.soa.bpel.runtime.engine.BPELFault;
import org.jboss.soa.bpel.runtime.engine.IntegrationLayer;
-import org.jboss.soa.bpel.runtime.ws.MessageContext;
-import org.jboss.soa.bpel.runtime.ws.MessageContextAssoc;
-import org.jboss.soa.bpel.runtime.ws.SOAPMessageAdapter;
+import org.jboss.soa.bpel.runtime.engine.InvocationContext;
import org.w3c.dom.Element;
import javax.sql.DataSource;
import javax.transaction.*;
import javax.transaction.xa.XAResource;
-import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
import java.util.StringTokenizer;
import java.util.concurrent.*;
@@ -102,56 +96,30 @@
* required.
* @throws Exception Failed to invoke the operation
*/
- public Element invoke(String operation, QName service, Element message)
+ public void invoke(InvocationContext invocationContext)
throws BPELFault, Exception
{
- Element ret = null;
-
boolean success = true;
MyRoleMessageExchange odeMex = null;
Future responseFuture = null;
- boolean wsInvocation = (message instanceof SOAPEnvelope);
-
+
try
{
// start TX
_txMgr.begin();
if (__log.isDebugEnabled()) __log.debug("Starting transaction.");
-
- // Creating message exchange
- String messageId = new GUID().toString();
- odeMex = _bpelServer.getEngine().createMessageExchange(messageId, service,
operation);
- __log.debug("ODE routed to operation " + odeMex.getOperation() + "
from service " + service);
-
+
+ odeMex = createMessageExchange(invocationContext);
//odeMex.setProperty("isTwoWay",
Boolean.toString(msgContext.getAxisOperation() instanceof TwoChannelAxisOperation));
+
if (odeMex.getOperation() != null)
{
-
// Preparing message to send to ODE
Message odeRequest =
odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
- //_converter.parseSoapRequest(odeRequest, msgContext.getEnvelope(),
odeMex.getOperation());
-
+
// distinguish WS and ESB invocation
- if(wsInvocation)
- {
- MessageContext inboundMessageContext = MessageContextAssoc.getInbound();
- SOAPMessage soapMessage = inboundMessageContext.getMessage();
- SOAPMessageAdapter soapAdapter =
- new SOAPMessageAdapter(
- inboundMessageContext.getWsdlDefinition(),
- inboundMessageContext.getServiceName(),
- inboundMessageContext.getPortName()
- );
- soapAdapter.parseSoapRequest(odeRequest, soapMessage, odeMex.getOperation());
+ invocationContext.parseRequest(odeMex, odeRequest);
-
//odeRequest.setMessage(AbstractWebServiceEndpoint.getMessagePayload((SOAPEnvelope)message));
- }
- else
- {
- wsInvocation = false;
- odeRequest.setMessage(message);
- }
-
// TODO: Might need to store session id/epr of caller?
//readHeader(msgContext, odeMex);
@@ -216,9 +184,9 @@
try {
// Refreshing the message exchange
odeMex = (MyRoleMessageExchange)
_bpelServer.getEngine().getMessageExchange(odeMex.getMessageExchangeId());
- ret = onResponse(odeMex, wsInvocation);
+ onResponse(odeMex, invocationContext);
- __log.debug("Returning: "+ret);
+ __log.debug("Returning: "+invocationContext.getInvocationResult());
commit = true;
@@ -255,10 +223,19 @@
odeMex.release(true);
}
- return(ret);
}
- private Element onResponse(MyRoleMessageExchange mex, boolean wsInvocation) throws
BPELFault, Exception {
+ private MyRoleMessageExchange createMessageExchange(InvocationContext context)
+ {
+ // Creating message exchange
+ String messageId = new GUID().toString();
+ MyRoleMessageExchange odeMex = _bpelServer.getEngine()
+ .createMessageExchange(messageId, context.getServiceName(),
context.getOperationName());
+ __log.debug("ODE routed to operation " + odeMex.getOperation() + "
from service " + context.getServiceName());
+ return odeMex;
+ }
+
+ private void onResponse(MyRoleMessageExchange mex, InvocationContext invocationContext)
throws BPELFault, Exception {
Element ret=null;
switch (mex.getStatus()) {
@@ -269,32 +246,11 @@
case ASYNC:
case RESPONSE:
- if(wsInvocation)
+ if(true)
{
- // create SOAPEnvelope
- SOAPMessage soapResponse = MessageFactory.newInstance().createMessage();
- /*SOAPBody responseBody = soapResponse.getSOAPBody();
- SOAPFactory soapFactory = SOAPFactory.newInstance();
- SOAPElement responseElement =
soapFactory.createElement(mex.getResponse().getMessage());
- responseBody.appendChild(responseElement);
- ret = soapResponse.getSOAPPart().getEnvelope();*/
+ invocationContext.parseResponse(mex);
+ }
- MessageContext inboundMessageContext = MessageContextAssoc.getInbound();
- SOAPMessageAdapter soapAdapter =
- new SOAPMessageAdapter(
- inboundMessageContext.getWsdlDefinition(),
- inboundMessageContext.getServiceName(),
- inboundMessageContext.getPortName()
- );
- soapAdapter.createSoapResponse(soapResponse, mex.getResponse(),
mex.getOperation());
- ret = soapResponse.getSOAPPart().getEnvelope();
- MessageContextAssoc.createOutbound().setMessage(soapResponse);
- }
- else
- {
- // ESB response
- ret = mex.getResponse().getMessage();
- }
if (__log.isDebugEnabled())
__log.debug("Response message " + ret);
break;
@@ -306,9 +262,7 @@
throw new Exception("Failure response message: "+mex.getFault()+"
: "+mex.getFaultExplanation());
default:
throw new Exception("Received ODE message exchange in unexpected state:
" + mex.getStatus());
- }
-
- return(ret);
+ }
}
/**
Modified:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java
===================================================================
---
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-06
09:29:25 UTC (rev 244)
+++
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/AbstractWebServiceEndpoint.java 2009-11-06
13:30:21 UTC (rev 245)
@@ -51,25 +51,30 @@
{
protected final Log log = LogFactory.getLog(getClass());
- private Definition wsdlDefinition = null;
- private boolean isInit;
+ private SOAPMessageAdapter soapAdapter;
+ private QName serviceQName;
+ private boolean isInitialized;
+
private void init()
{
- if(!isInit)
+ if(!isInitialized)
{
try
{
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdlDefinition = wsdlReader.readWSDL(getWsdlLocation());
+ Definition wsdlDefinition = wsdlReader.readWSDL(getWsdlLocation());
+ this.serviceQName = QName.valueOf(getServiceName());
+ this.soapAdapter = new SOAPMessageAdapter(wsdlDefinition, serviceQName,
getPortName());
}
catch (WSDLException e)
{
throw new RuntimeException("Failed to parse WSDL", e);
}
- isInit = true;
+ isInitialized = true;
}
}
+
public SOAPMessage invoke(SOAPMessage soapMessage)
{
log.debug("Invoking endpoint "+getEndpointId());
@@ -81,53 +86,34 @@
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
Element messageElement = getMessagePayload(soapEnvelope);
- // make sure namespaces are preserved
- //DOMUtils.pancakeNamespaces(soapEnvelope);
-
if(log.isDebugEnabled())
log.debug( "ODE inbound message: \n" +DOMWriter.printNode(soapEnvelope,
true) );
- MessageContext context = MessageContextAssoc.createInbound();
- context.setMessage(soapMessage);
- context.setServiceName(QName.valueOf(getServiceName()));
- context.setPortName(getPortName());
- context.setWsdlDefinition(wsdlDefinition);
-
- Element odeResponse = getEngine().invoke(
+ // Create invocation context
+ WSInvocationContext invocationContext = new WSInvocationContext(
messageElement.getLocalName(),
- QName.valueOf(getServiceName()),
- soapEnvelope
+ serviceQName,
+ soapAdapter
);
+ invocationContext.setSOAPMessage(soapMessage);
- if(!(odeResponse instanceof SOAPEnvelope))
- throw new IllegalArgumentException("Expected SOAPEnvelope, got
"+odeResponse.getClass());
+ // Invoke ODE
+ getEngine().invoke(invocationContext);
- if(null==MessageContextAssoc.getOutbound())
- throw new IllegalArgumentException("No outbound MessageContext");
+ // Handle response
+ SOAPMessage responseMessage = invocationContext.getInvocationResult();
- SOAPMessage responseMessage = MessageContextAssoc.getOutbound().getMessage();
-
if(log.isDebugEnabled())
log.debug( "ODE outbound message: \n" +
DOMWriter.printNode(responseMessage.getSOAPPart().getEnvelope(), true)
);
- /* SOAPBody responseBody = soapResponse.getSOAPBody();
- SOAPFactory soapFactory = SOAPFactory.newInstance();
- SOAPElement responseElement = soapFactory.createElement(odeResponse);
- responseBody.appendChild(responseElement);*/
-
return responseMessage;
}
catch (Exception e)
{
throw new RuntimeException("Failed to invoke BPEL process", e);
}
- finally
- {
- MessageContextAssoc.clearAll();
- }
-
}
public static Element getMessagePayload(SOAPEnvelope soapEnvelope)
Added:
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationContext.java
===================================================================
---
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationContext.java
(rev 0)
+++
branches/hbraun/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/WSInvocationContext.java 2009-11-06
13:30:21 UTC (rev 245)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.bpel.runtime.ws;
+
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.jboss.soa.bpel.runtime.engine.InvocationContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public final class WSInvocationContext implements InvocationContext<SOAPMessage>
+{
+ private final String operationName;
+ private final QName serviceName;
+
+ private SOAPMessage soapRequestMessage;
+ private SOAPMessage soapResponseMessage;
+
+ private final SOAPMessageAdapter soapAdapter;
+
+ public WSInvocationContext(String operationName,
+ QName serviceName, SOAPMessageAdapter soapAdapter)
+ {
+ this.operationName = operationName;
+ this.serviceName = serviceName;
+ this.soapAdapter = soapAdapter;
+ }
+
+ public String getOperationName()
+ {
+ return operationName;
+ }
+
+ public QName getServiceName()
+ {
+ return serviceName;
+ }
+
+ public void parseRequest(MyRoleMessageExchange mex, Message request)
+ {
+ if(null==soapRequestMessage)
+ throw new IllegalArgumentException("No request SOAPMessage set");
+
+ soapAdapter.parseSoapRequest(request, soapRequestMessage, mex.getOperation());
+ }
+
+ public void parseResponse(MyRoleMessageExchange mex)
+ {
+ try
+ {
+ // create SOAPEnvelope
+ soapResponseMessage = MessageFactory.newInstance().createMessage();
+ soapAdapter.createSoapResponse(soapResponseMessage, mex.getResponse(),
mex.getOperation());
+ }
+ catch (SOAPException e)
+ {
+ throw new RuntimeException("Failed to parse SOAP response", e);
+ }
+ }
+
+ public SOAPMessage getInvocationResult()
+ {
+ if(null==soapResponseMessage)
+ throw new IllegalArgumentException("No response SOAPMessage set");
+
+ return soapResponseMessage;
+ }
+
+ public void setSOAPMessage(SOAPMessage soapMessage)
+ {
+ this.soapRequestMessage = soapMessage;
+ }
+}
Modified:
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java
===================================================================
---
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2009-11-06
09:29:25 UTC (rev 244)
+++
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/BPELInvoke.java 2009-11-06
13:30:21 UTC (rev 245)
@@ -28,6 +28,7 @@
import org.jboss.soa.esb.message.format.MessageFactory;
import javax.naming.*;
+import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
@@ -174,11 +175,21 @@
org.w3c.dom.Element resp=null;
javax.xml.namespace.QName faultName=null;
- try {
- resp = engine.invoke(_config.getAttribute(OPERATION),
- new javax.xml.namespace.QName(getNamespace(serviceName),
- getLocalPart(serviceName)), mesgElem);
- } catch(BPELFault fault) {
+ try
+ {
+ QName serviceQName = new QName(getNamespace(serviceName),
getLocalPart(serviceName));
+
+ // Create invocationContext
+ ESBInvocationContext invocationContext =
+ new ESBInvocationContext(_config.getAttribute(OPERATION), serviceQName);
+ invocationContext.setRequestXML(mesgElem);
+
+ // invoke ODE
+ engine.invoke(invocationContext);
+ resp = invocationContext.getInvocationResult();
+ }
+ catch(BPELFault fault)
+ {
resp = fault.getFaultMessage();
faultName = fault.getFaultName();
}
Added:
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationContext.java
===================================================================
---
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationContext.java
(rev 0)
+++
branches/hbraun/runtime/jbossesb-bpel/src/main/java/org/jboss/soa/esb/actions/bpel/ESBInvocationContext.java 2009-11-06
13:30:21 UTC (rev 245)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.soa.esb.actions.bpel;
+
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.jboss.soa.bpel.runtime.engine.InvocationContext;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Heiko Braun <hbraun(a)redhat.com>
+ */
+public class ESBInvocationContext implements InvocationContext<Element>
+{
+ private String operationName;
+ private QName serviceName;
+ private Element requestXML;
+ private Element responseXML;
+
+ public ESBInvocationContext(String operationName, QName serviceName)
+ {
+ this.operationName = operationName;
+ this.serviceName = serviceName;
+ }
+
+ public String getOperationName()
+ {
+ return operationName;
+ }
+
+ public QName getServiceName()
+ {
+ return serviceName;
+ }
+
+ public void setRequestXML(Element requestXML)
+ {
+ this.requestXML = requestXML;
+ }
+
+ public void parseRequest(MyRoleMessageExchange mex, Message request)
+ {
+ if(null==this.requestXML)
+ throw new IllegalArgumentException("request XML not set");
+ request.setMessage(this.requestXML);
+ }
+
+ public void parseResponse(MyRoleMessageExchange mex)
+ {
+ this.responseXML = mex.getResponse().getMessage();
+ }
+
+ public Element getInvocationResult()
+ {
+ return this.responseXML;
+ }
+
+ // test methods
+ Element getRequestXML()
+ {
+ return requestXML;
+ }
+
+ void setResponseXML(Element responseXML)
+ {
+ this.responseXML = responseXML;
+ }
+}
+
Modified:
branches/hbraun/runtime/jbossesb-bpel/src/test/java/org/jboss/soa/esb/actions/bpel/TestBPELEngine.java
===================================================================
---
branches/hbraun/runtime/jbossesb-bpel/src/test/java/org/jboss/soa/esb/actions/bpel/TestBPELEngine.java 2009-11-06
09:29:25 UTC (rev 244)
+++
branches/hbraun/runtime/jbossesb-bpel/src/test/java/org/jboss/soa/esb/actions/bpel/TestBPELEngine.java 2009-11-06
13:30:21 UTC (rev 245)
@@ -17,16 +17,19 @@
*/
package org.jboss.soa.esb.actions.bpel;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.jboss.soa.bpel.runtime.engine.BPELEngine;
import org.jboss.soa.bpel.runtime.engine.BPELFault;
import org.jboss.soa.bpel.runtime.engine.IntegrationLayer;
+import org.jboss.soa.bpel.runtime.engine.InvocationContext;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
public class TestBPELEngine implements BPELEngine {
public TestBPELEngine() {
@@ -51,38 +54,35 @@
m_response = doc.getDocumentElement();
}
-
- @Override
+
public void addIntegrationLayer(IntegrationLayer il) {
// TODO Auto-generated method stub
}
- @Override
public void close() throws Exception {
// TODO Auto-generated method stub
}
- @Override
public void init() throws Exception {
// TODO Auto-generated method stub
}
- @Override
- public Element invoke(String operation, QName service, Element message)
+ public void invoke(InvocationContext invocationContext)
throws BPELFault, Exception {
if (m_fault != null) {
throw m_fault;
}
-
- m_request = message;
- return(m_response);
+
+
+ ESBInvocationContext esbCtx = (ESBInvocationContext) invocationContext;
+ m_request = esbCtx.getRequestXML();
+ esbCtx.setResponseXML(m_response);
}
- @Override
public void removeIntegrationLayer(IntegrationLayer il) {
// TODO Auto-generated method stub