summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/core/src')
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java35
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java5
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java21
3 files changed, 53 insertions, 8 deletions
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
index 991aa57abe..2a4b4d1ec9 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
@@ -45,6 +45,7 @@ import org.apache.tuscany.sca.provider.ImplementationProvider;
import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
import org.apache.tuscany.sca.runtime.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -76,7 +77,7 @@ public class RuntimeWireImpl implements RuntimeWire {
private RuntimeWireImpl clonedFrom;
private List<InvocationChain> chains;
- private InvocationChain binidngInvocationChain;
+ private InvocationChain bindingInvocationChain;
/**
* @param source
@@ -113,15 +114,16 @@ public class RuntimeWireImpl implements RuntimeWire {
}
public synchronized InvocationChain getBindingInvocationChain() {
- if (binidngInvocationChain == null) {
+ if (bindingInvocationChain == null) {
Contract source = wireSource.getContract();
if (source instanceof RuntimeComponentReference) {
- binidngInvocationChain = new InvocationChainImpl(null, null, true);
+ bindingInvocationChain = new InvocationChainImpl(null, null, true);
} else {
- binidngInvocationChain = new InvocationChainImpl(null, null, false);
+ bindingInvocationChain = new InvocationChainImpl(null, null, false);
+ initServiceBindingInvocationChains();
}
}
- return binidngInvocationChain;
+ return bindingInvocationChain;
}
public InvocationChain getInvocationChain(Operation operation) {
@@ -180,6 +182,7 @@ public class RuntimeWireImpl implements RuntimeWire {
addReferenceBindingInterceptor(reference, refBinding, chain, operation);
chains.add(chain);
}
+
} else {
// It's the service wire
RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
@@ -202,9 +205,31 @@ public class RuntimeWireImpl implements RuntimeWire {
addImplementationInterceptor(serviceComponent, service, chain, targetOperation);
chains.add(chain);
}
+
}
wireProcessor.process(this);
}
+
+ private void initServiceBindingInvocationChains() {
+ RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
+ Binding serviceBinding = wireTarget.getBinding();
+
+ // add the binding interceptors to the service binding wire
+ ServiceBindingProvider provider = service.getBindingProvider(serviceBinding);
+ if ((provider != null) &&
+ (provider instanceof ServiceBindingProviderRRB)){
+ ((ServiceBindingProviderRRB)provider).configureBindingChain(this);
+ }
+
+ // add the policy interceptors to the service binding wire
+
+
+ // TODO - add something on the end of the wire to invoke the
+ // invocation chain. Need to split out the runtime
+ // wire invoker into conversation, callback interceptors etc
+ bindingInvocationChain.addInvoker(invoker);
+
+ }
public EndpointReference getSource() {
return wireSource;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
index c26501e7d7..c559a42bdc 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
@@ -45,8 +45,9 @@ public class InvocationChainImpl implements InvocationChain {
private boolean allowsPassByReference;
public InvocationChainImpl(Operation sourceOperation, Operation targetOperation, boolean forReference) {
- assert sourceOperation != null;
- assert targetOperation != null;
+ // TODO - binding invocation chain doesn't provide operations
+ //assert sourceOperation != null;
+ //assert targetOperation != null;
this.targetOperation = targetOperation;
this.sourceOperation = sourceOperation;
this.forReference = forReference;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
index c007669bdf..925a7c10a5 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
@@ -47,7 +47,7 @@ import org.osoa.sca.ServiceRuntimeException;
/**
* @version $Rev$ $Date$
*/
-public class RuntimeWireInvoker {
+public class RuntimeWireInvoker implements Invoker{
protected ConversationManager conversationManager;
protected boolean conversational;
protected ExtendedConversation conversation;
@@ -74,6 +74,25 @@ public class RuntimeWireInvoker {
this.conversational = contract.getInterface().isConversational();
}
}
+
+ /*
+ * TODO - Introduced to allow the RuntimeWireInvoker to sit on the end of the
+ * service binding chain. Runtime wire invoke needs splitting up into
+ * separate conversation, callback interceptors etc.
+ */
+ public Message invoke(Message msg) {
+
+ try {
+ Object response = invoke(msg.getOperation(),msg);
+ // Hack to put the response back in a message.
+ // shouldn't take it out of the response message in the first place
+ msg.setBody(response);
+ } catch (InvocationTargetException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ return msg;
+ }
public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
return invoke(wire, operation, msg);