summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/implementation-bpel-runtime/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-11-13 21:49:15 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-11-13 21:49:15 +0000
commit4dcff7533534e4b634b349a1105c7862d1655405 (patch)
tree61674abfb88ba63870bec8576101dc3d222454fa /java/sca/modules/implementation-bpel-runtime/src
parentc6a1c369e49090b6b9a6f2448045740a368c7ca3 (diff)
Replace RuntimeWire with RuntimeEnpoint/RuntimeEndpointReference as the owner of invocaiton chains
(http://www.mail-archive.com/dev@tuscany.apache.org/msg07856.html) git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@836009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-bpel-runtime/src')
-rw-r--r--java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java61
-rw-r--r--java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java18
2 files changed, 41 insertions, 38 deletions
diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java
index 55bde26c08..dc73ab044a 100644
--- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java
+++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java
@@ -26,7 +26,6 @@ import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
@@ -38,7 +37,7 @@ 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.apache.tuscany.sca.runtime.RuntimeEndpointReference;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -89,10 +88,10 @@ public class ODEExternalService {
// Fetching the reference based on the data held in the PRC / Endpoint
String refName = channel.getEndpoint().serviceName.getLocalPart();
RuntimeComponentReference runtimeComponentReference = getReferenceByName( tuscanyRuntimeComponent, refName );
- RuntimeWire runtimeWire = getRuntimeWire( runtimeComponentReference, partnerRoleMessageExchange );
+ RuntimeEndpointReference epr = getEndpointReference( runtimeComponentReference, partnerRoleMessageExchange );
// convert operations
Operation operation =
- findOperation(partnerRoleMessageExchange.getOperation().getName(), runtimeComponentReference);
+ findOperation(partnerRoleMessageExchange.getOperation().getName(), epr);
/*
This is how a request looks like (payload is wrapped with extra info)
@@ -122,7 +121,7 @@ public class ODEExternalService {
boolean success = false;
try {
- result = runtimeWire.invoke(operation, args);
+ result = epr.invoke(operation, args);
success = true;
} catch (Exception e) {
e.printStackTrace();
@@ -194,7 +193,7 @@ public class ODEExternalService {
* @param componentReference - the reference
* @return - the RuntimeWire - null if it cannot be found
*/
- private RuntimeWire getRuntimeWire( RuntimeComponentReference componentReference,
+ private RuntimeEndpointReference getEndpointReference( RuntimeComponentReference componentReference,
PartnerRoleMessageExchange mex) {
if( componentReference.isForCallback() ) {
// Where there is a callback, it is necessary to create a specialized wire, based on callback information
@@ -205,42 +204,42 @@ public class ODEExternalService {
Long processID = _server.getProcessIDFromMex(mex.getMessageExchangeId());
org.apache.tuscany.sca.assembly.EndpointReference callbackEPR =
_server.getCallbackMetadata(processID, componentReference.getName());
- RuntimeWire wire = selectCallbackWire( callbackEPR.getTargetEndpoint(), componentReference );
+ RuntimeEndpointReference wire = selectCallbackWire( callbackEPR.getTargetEndpoint(), componentReference );
wire = clone_bind( componentReference, callbackEPR.getCallbackEndpoint() );
return wire;
} else {
// No callback case...
//TODO - fix the x..n multiplicity case, which needs to select the correct ONE of multiple
// EndpointReferences here
- return componentReference.getRuntimeWire(componentReference.getEndpointReferences().get(0));
+ return (RuntimeEndpointReference) componentReference.getEndpointReferences().get(0);
} // end if
- } // end method getRuntimeWire
+ } // end method getEndpointReference
- private RuntimeWire selectCallbackWire( org.apache.tuscany.sca.assembly.Endpoint endpoint,
+ private RuntimeEndpointReference selectCallbackWire( org.apache.tuscany.sca.assembly.Endpoint endpoint,
RuntimeComponentReference componentReference) {
// Look for callback binding with same name as service binding
if (endpoint == null) {
throw new RuntimeException("Destination for forward call is not available");
}
- for (RuntimeWire wire : componentReference.getRuntimeWires()) {
- if (wire.getEndpointReference().getBinding().getName().equals(endpoint.getBinding().getName())) {
- return wire;
+ for (EndpointReference epr : componentReference.getEndpointReferences()) {
+ if (epr.getBinding().getName().equals(endpoint.getBinding().getName())) {
+ return (RuntimeEndpointReference) epr;
}
- } // end for
+ }
// if no match, look for callback binding with same type as service binding
- for (RuntimeWire wire : componentReference.getRuntimeWires()) {
- if (wire.getEndpointReference().getBinding().getClass() == endpoint.getBinding().getClass()) {
- return wire;
+ for (EndpointReference epr : componentReference.getEndpointReferences()) {
+ if (epr.getBinding().getType().equals(endpoint.getBinding().getType())) {
+ return (RuntimeEndpointReference) epr;
}
- } // end for
+ }
// no suitable callback wire was found
return null;
} // end method selectCallbackWire
- private RuntimeWire clone_bind(RuntimeComponentReference reference,
+ private RuntimeEndpointReference clone_bind(RuntimeComponentReference reference,
org.apache.tuscany.sca.assembly.Endpoint callbackEndpoint) {
try {
@@ -258,9 +257,7 @@ public class ODEExternalService {
// The callback endpoint will be resolved when the wire chains are created
ref.getEndpointReferences().add(callbackEndpointReference);
- RuntimeWire wire = ref.getRuntimeWires().get(0);
-
- return wire;
+ return (RuntimeEndpointReference) ref.getEndpointReferences().get(0);
} catch ( CloneNotSupportedException e ) {
return null;
} // end try clone_bind
@@ -274,16 +271,16 @@ public class ODEExternalService {
* @param runtimeComponentReference
* @return
*/
- private Operation findOperation(String operationName, RuntimeComponentReference runtimeComponentReference) {
- Operation reseultOperation = null;
-
- for(Operation operation : runtimeComponentReference.getInterfaceContract().getInterface().getOperations()) {
- if (operationName.equalsIgnoreCase(operation.getName())) {
- reseultOperation = operation;
- break;
- }
- }
- return reseultOperation;
+ private Operation findOperation(String operationName, RuntimeEndpointReference epr) {
+ Operation reseultOperation = null;
+
+ for (Operation operation : epr.getReferenceInterfaceContract().getInterface().getOperations()) {
+ if (operationName.equalsIgnoreCase(operation.getName())) {
+ reseultOperation = operation;
+ break;
+ }
+ }
+ return reseultOperation;
}
/**
diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java
index 93409c837f..ef35f4cd66 100644
--- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java
+++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java
@@ -28,11 +28,11 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.dao.jpa.ProcessDAOImpl;
import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
import org.apache.tuscany.sca.extensibility.ClassLoaderContext;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
@@ -42,6 +42,8 @@ import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.ImplementationProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* BPEL Implementation provider
@@ -86,16 +88,20 @@ public class BPELImplementationProvider implements ImplementationProvider {
// contract and leave it to the Endpoints only
service.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
for( Endpoint endpoint : service.getEndpoints() ) {
- if (endpoint.getInterfaceContract() != null) {
- endpoint.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
+ RuntimeEndpoint ep = (RuntimeEndpoint) endpoint;
+ if (ep.getServiceInterfaceContract() != null) {
+ ep.getServiceInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
}
} // end for
} // end for
- for (Reference reference: component.getReferences()) {
+ for (Reference reference : component.getReferences()) {
reference.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
- /* for( EndpointReference epr : reference.getEndpointReferences() ) {
- epr.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
+ for (EndpointReference endpointReference : reference.getEndpointReferences()) {
+ RuntimeEndpointReference epr = (RuntimeEndpointReference)endpointReference;
+ if (epr.getReferenceInterfaceContract() != null) {
+ epr.getReferenceInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
+ }
} // end for */
} // end for