summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-11-09 20:36:15 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-11-09 20:36:15 +0000
commit80b0aff41c6d21c5faa91f5e37e247b89ca0d404 (patch)
treeed3c13e5ed7788c0f1acd395a2f33714608cc724 /java/sca
parentdce48c2b095af03dd86f3a28e34610de26019166 (diff)
Only use the distributed SCA binding when the endpoint registry is a distributed one. This fixed the problems with osgi launcher using the rmi sca binding it finds in the modules but its a kludge and we need a better way to do this
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@834218 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/RuntimeSCAServiceBindingProvider.java24
1 files changed, 21 insertions, 3 deletions
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 de21974095..220b431e9d 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
@@ -20,6 +20,7 @@
package org.apache.tuscany.sca.binding.sca.provider;
import java.net.URI;
+import java.util.Collection;
import org.apache.tuscany.sca.assembly.DistributedSCABinding;
import org.apache.tuscany.sca.assembly.Endpoint;
@@ -28,10 +29,13 @@ import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
+import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -55,8 +59,7 @@ public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider
private DistributedSCABinding distributedBinding;
- public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints,
- Endpoint endpoint) {
+ public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints, Endpoint endpoint) {
this.component = (RuntimeComponent)endpoint.getComponent();
this.service = (RuntimeComponentService)endpoint.getService();
this.binding = (SCABinding)endpoint.getBinding();
@@ -74,7 +77,7 @@ public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider
(BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
.getProviderFactory(DistributedSCABinding.class);
- if (distributedProviderFactory != null) {
+ if (isDistributed(extensionPoints, endpoint)) {
SCABindingFactory scaBindingFactory =
extensionPoints.getExtensionPoint(FactoryExtensionPoint.class).getFactory(SCABindingFactory.class);
@@ -97,6 +100,21 @@ public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider
}
}
}
+
+ protected boolean isDistributed(ExtensionPointRegistry extensionPoints, Endpoint endpoint) {
+ // find if the node config is for distributed endpoints
+ // TODO: temp, need a much better way to do this
+ if (distributedProviderFactory != null) {
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ DomainRegistryFactory domainRegistryFactory = utilities.getUtility(DomainRegistryFactory.class);
+ Collection<EndpointRegistry> eprs = domainRegistryFactory.getEndpointRegistries();
+ if (eprs.size() > 0) {
+ String eprName = eprs.iterator().next().getClass().getName();
+ return !eprName.equals("org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryImpl");
+ }
+ }
+ return false;
+ }
public InterfaceContract getBindingInterfaceContract() {
if (distributedProvider != null) {