diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-20 20:55:28 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-09-20 20:55:28 +0000 |
commit | 7b4142b6f4e050a140a1bdd3626791e46b012e62 (patch) | |
tree | 05d24feae1abd4023c6afae7fc0d3a69c21e9f8e /sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany | |
parent | 8c441278d16941de1ee077ddd18f6b58f14bfe2f (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/modules/binding-sca-runtime/src/main/java/org/apache/tuscany')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-sca-runtime/src/main/java/org/apache/tuscany/sca/binding/sca/provider/DefaultSCABindingMapper.java | 33 |
1 files changed, 9 insertions, 24 deletions
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; } } |