summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-11-03 15:11:49 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-11-03 15:11:49 +0000
commita46f9b3773b5c74da6e03dbac6037474ed75ab60 (patch)
treeb78ce4450709e708e5cbae15c880d50a64e106d2 /java/sca/modules/core
parentda3b5205524e71572a3f650b63c9e46ce4a05e1f (diff)
Add a reference side example of the Request Response Binding in JMS
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@710080 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core')
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java48
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java5
2 files changed, 50 insertions, 3 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 2a4b4d1ec9..842799c277 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
@@ -41,9 +41,13 @@ import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
import org.apache.tuscany.sca.provider.ImplementationProvider;
import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderRRB;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ReferenceBindingProviderRRB;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
import org.apache.tuscany.sca.runtime.EndpointReference;
@@ -118,6 +122,7 @@ public class RuntimeWireImpl implements RuntimeWire {
Contract source = wireSource.getContract();
if (source instanceof RuntimeComponentReference) {
bindingInvocationChain = new InvocationChainImpl(null, null, true);
+ initReferenceBindingInvocationChains();
} else {
bindingInvocationChain = new InvocationChainImpl(null, null, false);
initServiceBindingInvocationChains();
@@ -210,6 +215,38 @@ public class RuntimeWireImpl implements RuntimeWire {
wireProcessor.process(this);
}
+ private void initReferenceBindingInvocationChains() {
+ RuntimeComponentReference reference = (RuntimeComponentReference)wireSource.getContract();
+ Binding referenceBinding = wireSource.getBinding();
+
+ // add the binding interceptors to the reference binding wire
+ ReferenceBindingProvider provider = reference.getBindingProvider(referenceBinding);
+ if ((provider != null) &&
+ (provider instanceof ReferenceBindingProviderRRB)){
+ ((ReferenceBindingProviderRRB)provider).configureBindingChain(this);
+ }
+
+ // add the policy interceptors to the service binding wire
+ // find out which policies are active
+ List<PolicyProvider> pps = ((RuntimeComponentReference)reference).getPolicyProviders(referenceBinding);
+ if (pps != null) {
+ for (PolicyProvider p : pps) {
+ if (p instanceof PolicyProviderRRB) {
+ Interceptor interceptor = ((PolicyProviderRRB)p).createBindingInterceptor();
+ if (interceptor != null) {
+ bindingInvocationChain.addInterceptor(p.getPhase(), interceptor);
+ }
+ }
+ }
+ }
+
+ // 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
+
+
+ }
+
private void initServiceBindingInvocationChains() {
RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
Binding serviceBinding = wireTarget.getBinding();
@@ -222,6 +259,17 @@ public class RuntimeWireImpl implements RuntimeWire {
}
// add the policy interceptors to the service binding wire
+ List<PolicyProvider> pps = ((RuntimeComponentService)service).getPolicyProviders(serviceBinding);
+ if (pps != null) {
+ for (PolicyProvider p : pps) {
+ if (p instanceof PolicyProviderRRB) {
+ Interceptor interceptor = ((PolicyProviderRRB)p).createBindingInterceptor();
+ if (interceptor != null) {
+ bindingInvocationChain.addInterceptor(p.getPhase(), interceptor);
+ }
+ }
+ }
+ }
// TODO - add something on the end of the wire to invoke the
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
index aff89100ca..a3c8429c7b 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
@@ -23,7 +23,6 @@ import static org.apache.tuscany.sca.invocation.Phase.IMPLEMENTATION;
import static org.apache.tuscany.sca.invocation.Phase.IMPLEMENTATION_POLICY;
import static org.apache.tuscany.sca.invocation.Phase.REFERENCE;
import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING;
-import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING_DISPATCHER;
import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING_POLICY;
import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING_TRANSPORT;
import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING_WIREFORMAT;
@@ -70,10 +69,10 @@ public class PhaseManager {
{REFERENCE, REFERENCE_INTERFACE, REFERENCE_POLICY, REFERENCE_BINDING};
private static final String[] SYSTEM_REFERENCE_BINDING_PHASES =
- {REFERENCE_BINDING_DISPATCHER, REFERENCE_BINDING_WIREFORMAT, REFERENCE_BINDING_POLICY, REFERENCE_BINDING_TRANSPORT};
+ {REFERENCE_BINDING_WIREFORMAT, REFERENCE_BINDING_POLICY, REFERENCE_BINDING_TRANSPORT};
private static final String[] SYSTEM_SERVICE_BINDING_PHASES =
- {SERVICE_BINDING_TRANSPORT, SERVICE_BINDING_WIREFORMAT, SERVICE_BINDING_POLICY, SERVICE_BINDING_OPERATION_SELECTOR};
+ {SERVICE_BINDING_TRANSPORT, SERVICE_BINDING_OPERATION_SELECTOR, SERVICE_BINDING_WIREFORMAT, SERVICE_BINDING_POLICY};
private static final String[] SYSTEM_SERVICE_PHASES =
{SERVICE_BINDING, SERVICE_POLICY, SERVICE_INTERFACE, SERVICE};