From e932b4b558015ee1e771321786666cf1b3be5361 Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 17 Dec 2008 14:35:59 +0000 Subject: Allow for multiple references from a BPEL script. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@727399 13f79535-47bb-0310-9956-ffa450edef68 --- .../implementation/bpel/ode/ODEExternalService.java | 20 +++++++++++++++++--- .../sca/implementation/bpel/ode/TuscanyPRC.java | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'branches/sca-java-1.x/modules/implementation-bpel-ode') diff --git a/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java b/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java index 15e9229601..6ce6a727af 100644 --- a/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java +++ b/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java @@ -30,11 +30,13 @@ import org.apache.ode.bpel.iapi.MessageExchange; import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange; import org.apache.ode.bpel.iapi.Scheduler; import org.apache.ode.utils.DOMUtils; +import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeWire; +import org.osoa.sca.ServiceRuntimeException; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -86,8 +88,21 @@ public class ODEExternalService { TuscanyPRC channel = (TuscanyPRC) partnerRoleMessageExchange.getChannel(); RuntimeComponent tuscanyRuntimeComponent = _server.getTuscanyRuntimeComponent(channel.getProcessName()); - RuntimeComponentReference runtimeComponentReference = - (RuntimeComponentReference)tuscanyRuntimeComponent.getReferences().get(0); + // get the right reference based on the partner link name + String referenceName = channel.getEndpoint().serviceName.getLocalPart(); + RuntimeComponentReference runtimeComponentReference = null; + + for (ComponentReference reference : tuscanyRuntimeComponent.getReferences()){ + if (reference.getName().equals(referenceName)){ + runtimeComponentReference = (RuntimeComponentReference)reference; + break; + } + } + + if (runtimeComponentReference == null){ + throw new ServiceRuntimeException("Can't find component reference for partner link " + referenceName); + } + RuntimeWire runtimeWire = runtimeComponentReference.getRuntimeWire(runtimeComponentReference.getBindings().get(0)); @@ -95,7 +110,6 @@ public class ODEExternalService { Operation operation = findOperation(partnerRoleMessageExchange.getOperation().getName(), runtimeComponentReference); - /* This is how a request looks like (payload is wrapped with extra info) diff --git a/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java b/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java index 8f8f608217..c2c16a24ca 100644 --- a/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java +++ b/branches/sca-java-1.x/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java @@ -50,6 +50,10 @@ public class TuscanyPRC implements PartnerRoleChannel { public QName getProcessName() { return this.processName; } + + public Endpoint getEndpoint() { + return endpoint; + } public void close() { -- cgit v1.2.3