Allows the distributed flag to be overriden

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1173364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
rfeng 2011-09-20 20:55:39 +00:00
parent cca68a5ef9
commit 792e596a1a
2 changed files with 7 additions and 13 deletions

View file

@ -60,7 +60,7 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
protected StAXArtifactProcessorExtensionPoint processors;
protected QName defaultMappedBinding;
protected QName defaultLocalBinding;
// protected boolean supportsDistributedSCA;
protected boolean alwaysDistributed;
public DefaultSCABindingMapper(ExtensionPointRegistry registry, Map<String, String> attributes) {
this.registry = registry;
@ -68,7 +68,9 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
defaultMappedBinding = getDefaultMappedBinding(attributes);
defaultLocalBinding = new QName(Base.SCA11_TUSCANY_NS, "binding.local");
// supportsDistributedSCA = isDistributed();
if (attributes != null && "true".equalsIgnoreCase(attributes.get("alwaysDistributed"))) {
alwaysDistributed = true;
}
}
protected QName getDefaultMappedBinding(Map<String, String> attributes) {
@ -246,7 +248,7 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
*/
protected QName chooseBinding(RuntimeEndpoint endpoint) {
DomainRegistry domainRegistry = endpoint.getCompositeContext().getEndpointRegistry();
boolean distributed = domainRegistry.isDistributed();
boolean distributed = alwaysDistributed || domainRegistry.isDistributed();
InterfaceContract interfaceContract = endpoint.getService().getInterfaceContract();
if(interfaceContract != null
&& interfaceContract.getInterface() != null
@ -266,7 +268,7 @@ public class DefaultSCABindingMapper implements SCABindingMapper {
*/
protected QName chooseBinding(RuntimeEndpointReference endpointReference) {
DomainRegistry domainRegistry = endpointReference.getCompositeContext().getEndpointRegistry();
boolean distributed = domainRegistry.isDistributed();
boolean distributed = alwaysDistributed || domainRegistry.isDistributed();
if(endpointReference.getTargetEndpoint().isRemote()) {
RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
if(ref.getInterfaceContract() != null && !ref.getInterfaceContract().getInterface().isRemotable()) {

View file

@ -38,6 +38,7 @@ public class MyMapper extends DefaultSCABindingMapper {
public MyMapper(ExtensionPointRegistry registry, Map<String, String> attributes) {
super(registry, attributes);
alwaysDistributed = true;
}
@Override
@ -68,13 +69,4 @@ public class MyMapper extends DefaultSCABindingMapper {
return bindingType;
}
/*
* Probably others don't need to override this is they have a remotable endpoint registry, this itest
* doesn't so just fiddle the test
*/
@Override
protected boolean isDistributed() {
return true;
}
}