summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-sca-runtime/src/main/java/org
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-06-24 19:57:42 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-06-24 19:57:42 +0000
commitacecdd3410f35e6c3d4a4c386770ba233eb604bc (patch)
tree02e267c4c3dc5293d716d267c0f4de99473b9e18 /java/sca/modules/binding-sca-runtime/src/main/java/org
parent06afc90e64dd5190157b847476bf743c10d1248a (diff)
Simplify the sca binding providers so that no local/remote decision making is not based on binding uri. Next need to add some logic so that only top level composite components are exposed as remote endpoints.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@788161 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-sca-runtime/src/main/java/org')
-rw-r--r--java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java37
-rw-r--r--java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java65
2 files changed, 31 insertions, 71 deletions
diff --git a/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java b/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java
index 301ee86d44..079e7dd283 100644
--- a/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java
+++ b/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAReferenceBindingProvider.java
@@ -90,15 +90,16 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
boolean targetIsRemote = false;
// The decision is based on the results of the wiring process in the assembly model
- // The SCA binding is used to represent unresolved reference targets, i.e. those
- // reference targets that need resolving at run time. We can tell by looking if the
- // service to which this binding refers is resolved or not.
- //
- // TODO - When a callback is in operation. A callback reference bindings sometimes has to
- // act as though there is a local wire and sometimes as if there is a remote wire
- // what are the implications of this here?
+ // and there are three possibilities
+ // 1 - target service is running in a separate node in a separate JVM
+ // 2 - target service is running in a seaprate node in the same JVM
+ // 3 - target service is running in the same node
+
+ // TODO - EPR - the method needs to be able to indicate the three cases
+
if (RemoteBindingHelper.isTargetRemote()) {
+ // TODO - EPR - what is this RemoteBindingHelper for?
if (reference.getInterfaceContract() != null) {
targetIsRemote = reference.getInterfaceContract().getInterface().isRemotable();
} else {
@@ -106,24 +107,14 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
}
} if ( (endpointReference.isRemote()) &&
(endpointReference.getTargetEndpoint().isRemote())){
+ // case 1
targetIsRemote = true;
+ } else if (endpointReference.isRemote()) {
+ // case 2
+ targetIsRemote = false;
} else {
- // the case where the wire is specified by URI, e.g. callbacks or user specified bindings, and
- // look at the provided URI to decide whether it is a local or remote case
- try {
- if (binding.getURI() != null) {
- URI uri = new URI(binding.getURI());
- if (uri.isAbsolute()) {
- targetIsRemote = true;
- } else {
- targetIsRemote = false;
- }
- } else {
- targetIsRemote = false;
- }
- } catch (Exception ex) {
- targetIsRemote = false;
- }
+ // case 3
+ targetIsRemote = false;
}
return targetIsRemote;
}
diff --git a/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java b/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java
index df4305f42a..de21974095 100644
--- a/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java
+++ b/java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java
@@ -62,6 +62,7 @@ public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider
this.binding = (SCABinding)endpoint.getBinding();
// if there is potentially a wire to this service that crosses the node boundary
+ // then we need to create a remote endpoint
if (service.getInterfaceContract().getInterface().isRemotable()) {
// look to see if a distributed SCA binding implementation has
@@ -73,59 +74,27 @@ public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider
(BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
.getProviderFactory(DistributedSCABinding.class);
- // Check the things that will generally be required to set up a
- // distributed sca domain reference provider. I.e. make sure that we have a
- // - distributed implementation of the sca binding available
- // - remotable interface on the service
if (distributedProviderFactory != null) {
- URI serviceURI = null;
- try {
- serviceURI = new URI(binding.getURI());
- } catch(Exception ex) {
+ SCABindingFactory scaBindingFactory =
+ extensionPoints.getExtensionPoint(FactoryExtensionPoint.class).getFactory(SCABindingFactory.class);
+ // create a nested provider to handle the remote case
+ distributedBinding = scaBindingFactory.createDistributedSCABinding();
+ distributedBinding.setSCABinding(binding);
+
+ // create a copy of the endpoint and change the binding
+ Endpoint ep = null;
+ try {
+ ep = (Endpoint)endpoint.clone();
+ } catch (Exception ex) {
+ // we know we can clone endpoint
}
+ ep.setBinding(distributedBinding);
- if (RemoteBindingHelper.isTargetRemote() || ((serviceURI != null) && (serviceURI.isAbsolute()))) {
- SCABindingFactory scaBindingFactory =
- extensionPoints.getExtensionPoint(FactoryExtensionPoint.class).getFactory(SCABindingFactory.class);
-
- // create a nested provider to handle the remote case
- distributedBinding = scaBindingFactory.createDistributedSCABinding();
- distributedBinding.setSCABinding(binding);
-
- // create a copy of the endpoint and change the binding
- Endpoint ep = null;
- try {
- ep = (Endpoint)endpoint.clone();
- } catch (Exception ex) {
- // we know we can clone endpoint
- }
- ep.setBinding(distributedBinding);
-
- distributedProvider =
- distributedProviderFactory.createServiceBindingProvider(ep);
-
-
- } else {
- /* do nothing at the moment as only apps using the node implementation
- * will currently have the distributed domain set.
- *
- throw new IllegalStateException("No distributed domain available for component: "+
- component.getName() +
- " and service: " +
- service.getName());
- */
- }
- } else {
- /* do nothing at the moment as all services with remotable interfaces
- * are marked as remote
- throw new IllegalStateException("No distributed SCA binding available for component: "+
- component.getName() +
- " and service: " +
- service.getName());
- */
- }
+ distributedProvider =
+ distributedProviderFactory.createServiceBindingProvider(ep);
+ }
}
}