summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2011-09-20 20:55:28 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2011-09-20 20:55:28 +0000
commit7b4142b6f4e050a140a1bdd3626791e46b012e62 (patch)
tree05d24feae1abd4023c6afae7fc0d3a69c21e9f8e /sca-java-2.x/trunk
parent8c441278d16941de1ee077ddd18f6b58f14bfe2f (diff)
Use domain info to decide if the binding.sca needs to be distributed
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1173361 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF1
-rw-r--r--sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java33
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java5
-rw-r--r--sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java6
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java5
-rw-r--r--sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java5
6 files changed, 31 insertions, 24 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF
index d141e915f6..487bf21dd7 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Import-Package: javax.xml.namespace,
org.apache.tuscany.sca.assembly.builder;version="2.0.0",
org.apache.tuscany.sca.assembly.xml;version="2.0.0";resolution:=optional,
org.apache.tuscany.sca.common.xml.stax;version="2.0.0",
+ org.apache.tuscany.sca.context;version="2.0.0",
org.apache.tuscany.sca.contribution;version="2.0.0";resolution:=optional,
org.apache.tuscany.sca.contribution.processor;version="2.0.0",
org.apache.tuscany.sca.contribution.resolver;version="2.0.0";resolution:=optional,
diff --git a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
index 0b16117635..a61eb4a594 100644
--- a/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
+++ b/sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java
@@ -20,8 +20,6 @@
package org.apache.tuscany.sca.binding.sca.provider;
import java.io.StringReader;
-import java.util.Arrays;
-import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@@ -46,10 +44,8 @@ import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.provider.ProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.SCABindingMapper;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.DomainRegistry;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
import org.oasisopen.sca.ServiceRuntimeException;
@@ -64,7 +60,7 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
protected StAXArtifactProcessorExtensionPoint processors;
protected QName defaultMappedBinding;
protected QName defaultLocalBinding;
- protected boolean supportsDistributedSCA;
+ // protected boolean supportsDistributedSCA;
public DefaultSCABindingMapper(ExtensionPointRegistry registry, Map<String, String> attributes) {
this.registry = registry;
@@ -72,7 +68,7 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
defaultMappedBinding = getDefaultMappedBinding(attributes);
defaultLocalBinding = new QName(Base.SCA11_TUSCANY_NS, "binding.local");
- supportsDistributedSCA = isDistributed();
+ // supportsDistributedSCA = isDistributed();
}
protected QName getDefaultMappedBinding(Map<String, String> attributes) {
@@ -140,21 +136,6 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
return true;
}
- // FIXME: [rfeng] This is a HACK to check if we should make binding.sca remotable
- // by checking if we have distributed domain registry present
- protected boolean isDistributed() {
- DomainRegistryFactoryExtensionPoint factories =
- registry.getExtensionPoint(DomainRegistryFactoryExtensionPoint.class);
- List<DomainRegistryFactory> list = factories.getDomainRegistryFactories();
- if (list.size() == 1) {
- String[] schemes = list.get(0).getSupportedSchemes();
- if (Arrays.asList(schemes).contains("local")) {
- return false;
- }
- }
- return true;
- }
-
public RuntimeEndpoint map(RuntimeEndpoint endpoint) {
QName bindingType = chooseBinding(endpoint);
if (!isBindingSupported(bindingType)) {
@@ -264,11 +245,13 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
* @return
*/
protected QName chooseBinding(RuntimeEndpoint endpoint) {
+ DomainRegistry domainRegistry = endpoint.getCompositeContext().getEndpointRegistry();
+ boolean distributed = domainRegistry.isDistributed();
InterfaceContract interfaceContract = endpoint.getService().getInterfaceContract();
if(interfaceContract != null
&& interfaceContract.getInterface() != null
&& interfaceContract.getInterface().isRemotable()
- && supportsDistributedSCA
+ && distributed
&& isBindingSupported(defaultMappedBinding)) {
return defaultMappedBinding;
}
@@ -282,6 +265,8 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
* @return
*/
protected QName chooseBinding(RuntimeEndpointReference endpointReference) {
+ DomainRegistry domainRegistry = endpointReference.getCompositeContext().getEndpointRegistry();
+ boolean distributed = domainRegistry.isDistributed();
if(endpointReference.getTargetEndpoint().isRemote()) {
RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
if(ref.getInterfaceContract() != null && !ref.getInterfaceContract().getInterface().isRemotable()) {
@@ -291,7 +276,7 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
+ ref.getName());
}
- if(supportsDistributedSCA && isBindingSupported(defaultMappedBinding)) {
+ if(distributed && isBindingSupported(defaultMappedBinding)) {
return defaultMappedBinding;
}
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
index 3d9d2cb14c..32c53d8c85 100644
--- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
+++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
@@ -195,4 +195,9 @@ public abstract class BaseDomainRegistry implements DomainRegistry, LifeCycleLis
}
return domainComposite;
}
+
+ @Override
+ public boolean isDistributed() {
+ return true;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
index c33d3c1a4b..5fa38943ac 100644
--- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
+++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
@@ -34,6 +34,12 @@ import org.apache.tuscany.sca.assembly.EndpointReference;
*/
public interface DomainRegistry {
/**
+ * Indicate if the domain is distributed
+ * @return
+ */
+ boolean isDistributed();
+
+ /**
* Add an enpoint to the registry. If the endpoint URI is the same as an existing endpoint in the registry,
* the existing one will be updated
* @param endpoint
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
index c8383d3065..08d71fd357 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java
@@ -265,4 +265,9 @@ public class DomainRegistryImpl extends BaseDomainRegistry implements DomainRegi
}
return null;
}
+
+ @Override
+ public boolean isDistributed() {
+ return false;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
index 57b8792932..70e3815f35 100644
--- a/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
+++ b/sca-java-2.x/trunk/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
@@ -939,5 +939,10 @@ public class DeployerImpl implements Deployer {
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public boolean isDistributed() {
+ return false;
+ }
}
}