summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java6
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java87
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java16
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java34
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java8
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java73
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java2
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java2
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java11
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java8
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java1
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java6
-rw-r--r--branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java5
-rw-r--r--branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java7
14 files changed, 227 insertions, 39 deletions
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
index 9743117174..13bfbbbeff 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
@@ -19,6 +19,8 @@
package org.apache.tuscany.sca.assembly.builder;
+import java.util.Map;
+import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.builder.impl.EndpointBuilderImpl;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -28,7 +30,7 @@ import org.apache.tuscany.sca.monitor.Monitor;
* @version $Rev$ $Date$
*/
public class DefaultEndpointBuilder extends EndpointBuilderImpl {
- public DefaultEndpointBuilder (Monitor monitor){
- super(monitor);
+ public DefaultEndpointBuilder (Monitor monitor, Map<Binding, Binding> bindingMap){
+ super(monitor, bindingMap);
}
}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
index 7c8de1dd6f..f00b6c6d1d 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
@@ -72,6 +72,7 @@ public abstract class BaseConfigurationBuilderImpl {
private SCADefinitions policyDefinitions;
private DocumentBuilderFactory documentBuilderFactory;
private TransformerFactory transformerFactory;
+ private Map<Binding, Binding> bindingMap;
protected BaseConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
@@ -80,6 +81,18 @@ public abstract class BaseConfigurationBuilderImpl {
InterfaceContractMapper interfaceContractMapper,
SCADefinitions policyDefinitions,
Monitor monitor) {
+ this(assemblyFactory, scaBindingFactory, documentBuilderFactory,
+ transformerFactory, interfaceContractMapper, policyDefinitions, monitor, null);
+ }
+
+ protected BaseConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor,
+ Map<Binding, Binding> bindingMap) {
this.assemblyFactory = assemblyFactory;
this.scaBindingFactory = scaBindingFactory;
this.documentBuilderFactory = documentBuilderFactory;
@@ -87,6 +100,7 @@ public abstract class BaseConfigurationBuilderImpl {
this.interfaceContractMapper = interfaceContractMapper;
this.policyDefinitions = policyDefinitions;
this.monitor = monitor;
+ this.bindingMap = bindingMap;
}
/**
@@ -1034,6 +1048,26 @@ public abstract class BaseConfigurationBuilderImpl {
scaBinding.setName(service.getName() + "Callback");
service.getCallback().getBindings().add(scaBinding);
}
+
+ // Add all SCA bindings for the service callback to the bindingMap
+ // so that BindingConfigurationUtil.matchBinding() can identify the node
+ // for the target component.
+ if (service.getInterfaceContract() != null
+ && service.getInterfaceContract().getCallbackInterface() != null
+ && service.getCallback() != null
+ && bindingMap != null
+ && defaultBindings != null) {
+ for (Binding binding : service.getCallback().getBindings()) {
+ if (binding instanceof SCABinding) {
+ for (Binding nodeBinding : defaultBindings) {
+ if (nodeBinding instanceof SCABinding) {
+ bindingMap.put(binding, nodeBinding);
+ break;
+ }
+ }
+ }
+ }
+ }
// Initialize binding names and URIs
for (Binding binding : service.getBindings()) {
@@ -1044,6 +1078,28 @@ public abstract class BaseConfigurationBuilderImpl {
for (ComponentReference reference : component.getReferences()) {
+ // Create default SCA binding
+ if (reference.getBindings().isEmpty()) {
+ SCABinding scaBinding = createSCABinding();
+ reference.getBindings().add(scaBinding);
+ }
+
+ // Add all SCA bindings for the reference to the bindingMap so that
+ // BindingConfigurationUtil.matchBinding() can identify the node for
+ // the source component.
+ if (bindingMap != null && defaultBindings != null) {
+ for (Binding binding : reference.getBindings()) {
+ if (binding instanceof SCABinding) {
+ for (Binding nodeBinding : defaultBindings) {
+ if (nodeBinding instanceof SCABinding) {
+ bindingMap.put(binding, nodeBinding);
+ break;
+ }
+ }
+ }
+ }
+ }
+
// Create default SCA callback binding
if (reference.getInterfaceContract() != null
&& reference.getInterfaceContract().getCallbackInterface() != null
@@ -1054,6 +1110,26 @@ public abstract class BaseConfigurationBuilderImpl {
reference.getCallback().getBindings().add(scaBinding);
}
+ // Add all SCA bindings for the reference callback to the bindingMap
+ // so that BindingConfigurationUtil.matchBinding() can identify the node
+ // for the source component.
+ if (reference.getInterfaceContract() != null
+ && reference.getInterfaceContract().getCallbackInterface() != null
+ && reference.getCallback() != null
+ && bindingMap != null
+ && defaultBindings != null) {
+ for (Binding binding : reference.getCallback().getBindings()) {
+ if (binding instanceof SCABinding) {
+ for (Binding nodeBinding : defaultBindings) {
+ if (nodeBinding instanceof SCABinding) {
+ bindingMap.put(binding, nodeBinding);
+ break;
+ }
+ }
+ }
+ }
+ }
+
// Initialize binding names and URIs
if (reference.getCallback() != null) {
for (Binding binding : reference.getCallback().getBindings()) {
@@ -1300,7 +1376,16 @@ public abstract class BaseConfigurationBuilderImpl {
if (defaultBindings != null) {
for (Binding defaultBinding : defaultBindings){
if (binding.getClass() == defaultBinding.getClass()){
- baseURI = new URI(addSlashToPath(defaultBinding.getURI()));
+ // if the domain manager is generating a URI for an SCA binding,
+ // tentatively omit the base URI for now. The base URI will be added
+ // to the service URI by BindingConfigurationUtil.matchBinding()
+ // if the service needs a remote SCA binding because it is a
+ // wiring target for a reference running on a different node.
+ if (bindingMap != null && binding instanceof SCABinding) {
+ bindingMap.put(binding, defaultBinding);
+ } else {
+ baseURI = new URI(addSlashToPath(defaultBinding.getURI()));
+ }
break;
}
}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
index b2f662918c..f71fd308df 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
@@ -66,16 +66,18 @@ class BaseWireBuilderImpl {
private AssemblyFactory assemblyFactory;
private EndpointFactory endpointFactory;
private InterfaceContractMapper interfaceContractMapper;
+ private Map<Binding, Binding> bindingMap;
private EndpointBuilder endpointBuilder;
-
- protected BaseWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
+ protected BaseWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory,
+ InterfaceContractMapper interfaceContractMapper, Monitor monitor,
+ Map<Binding, Binding> bindingMap) {
this.assemblyFactory = assemblyFactory;
this.endpointFactory = endpointFactory;
this.interfaceContractMapper = interfaceContractMapper;
this.monitor = monitor;
- this.endpointBuilder = new DefaultEndpointBuilder(monitor);
-
+ this.bindingMap = bindingMap;
+ this.endpointBuilder = new DefaultEndpointBuilder(monitor, bindingMap);
}
/**
@@ -754,14 +756,16 @@ class BaseWireBuilderImpl {
}
// Match the binding against the bindings of the target service
- Binding selected = BindingConfigurationUtil.resolveBindings(componentReference, targetComponent, targetComponentService);
+ Binding selected = BindingConfigurationUtil.resolveBindings(componentReference, targetComponent, targetComponentService,
+ bindingMap);
if (selected == null) {
warning("NoMatchingBinding", componentReference, componentReference.getName(), targetComponentService.getName());
} else {
selectedBindings.add(selected);
}
if (bidirectional) {
- Binding selectedCallback = BindingConfigurationUtil.resolveCallbackBindings(componentReference, targetComponent, targetComponentService);
+ Binding selectedCallback = BindingConfigurationUtil.resolveCallbackBindings(componentReference, targetComponent,
+ targetComponentService, bindingMap);
if (selectedCallback != null) {
selectedCallbackBindings.add(selectedCallback);
}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
index 7f2bd39ddb..2765d1bb90 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
@@ -20,6 +20,7 @@ package org.apache.tuscany.sca.assembly.builder.impl;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Component;
@@ -58,7 +59,9 @@ abstract class BindingConfigurationUtil {
}
- static Binding matchBinding(Component targetComponent, ComponentService targetComponentService, List<Binding> source, List<Binding> target) {
+ static Binding matchBinding(Component targetComponent, ComponentService targetComponentService,
+ List<Binding> source, List<Binding> target,
+ Map<Binding, Binding> bindingMap, boolean isCallback) {
List<Binding> matched = new ArrayList<Binding>();
// Find the corresponding bindings from the service side
for (Binding binding : source) {
@@ -67,6 +70,23 @@ abstract class BindingConfigurationUtil {
hasCompatiblePolicySets(binding, serviceBinding)) {
try {
+ // If the service binding or callback binding was given a tentative URI by
+ // constructBindingURI() and the target component is running on a different node
+ // than the source component, add host/port information to the binding URI
+ if (bindingMap != null) {
+ Binding sourceNodeBinding = bindingMap.get(binding);
+ Binding targetNodeBinding = bindingMap.get(serviceBinding);
+ if (targetNodeBinding != null
+ && sourceNodeBinding != null
+ && targetNodeBinding != sourceNodeBinding) {
+ if (!isCallback) {
+ serviceBinding.setURI(targetNodeBinding.getURI() + serviceBinding.getURI());
+ } else {
+ binding.setURI(sourceNodeBinding.getURI() + binding.getURI());
+ }
+ }
+ }
+
Binding cloned = (Binding)binding.clone();
//Customise the binding name to make it unique
@@ -76,7 +96,7 @@ abstract class BindingConfigurationUtil {
} else {
cloned.setName(binding.getName() + "--" + serviceBinding.getName());
}
-
+
// Set the binding URI to the URI of the target service
// that has been matched
if (binding.getURI() == null) {
@@ -121,11 +141,12 @@ abstract class BindingConfigurationUtil {
* @param service The component service
* @return Resolved binding
*/
- static Binding resolveBindings(ComponentReference reference, Component component, ComponentService service) {
+ static Binding resolveBindings(ComponentReference reference, Component component, ComponentService service,
+ Map<Binding, Binding> bindingMap) {
List<Binding> source = reference.getBindings();
List<Binding> target = service.getBindings();
- return matchBinding(component, service, source, target);
+ return matchBinding(component, service, source, target, bindingMap, false);
}
@@ -135,11 +156,12 @@ abstract class BindingConfigurationUtil {
* @param service
* @return
*/
- static Binding resolveCallbackBindings(ComponentReference reference, Component component, ComponentService service) {
+ static Binding resolveCallbackBindings(ComponentReference reference, Component component, ComponentService service,
+ Map<Binding, Binding> bindingMap) {
List<Binding> source = reference.getCallback().getBindings();
List<Binding> target = service.getCallback().getBindings();
- return matchBinding(component, service, source, target);
+ return matchBinding(component, service, source, target, bindingMap, true);
}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
index 927330b139..723b478889 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
@@ -19,7 +19,9 @@
package org.apache.tuscany.sca.assembly.builder.impl;
+import java.util.Map;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.EndpointFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
@@ -34,8 +36,10 @@ import org.apache.tuscany.sca.monitor.Monitor;
*/
public class ComponentReferenceWireBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
- public ComponentReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ public ComponentReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory,
+ InterfaceContractMapper interfaceContractMapper, Monitor monitor,
+ Map<Binding, Binding> bindingMap) {
+ super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor, bindingMap);
}
public void build(Composite composite) throws CompositeBuilderException {
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
index 282fe032ba..5eedcae190 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
@@ -18,12 +18,14 @@
*/
package org.apache.tuscany.sca.assembly.builder.impl;
+import java.util.Map;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerFactory;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.DefaultEndpointFactory;
import org.apache.tuscany.sca.assembly.EndpointFactory;
@@ -59,13 +61,14 @@ public class CompositeBuilderImpl implements CompositeBuilder {
private CompositeBuilder compositePolicyBuilder;
private CompositeBuilder componentServiceBindingBuilder;
private CompositeBuilder componentReferenceBindingBuilder;
+ private Map<Binding, Binding> bindingMap = null;
/**
* Constructs a new composite builder.
*
* @param assemblyFactory
- * @param scaBindingFactory
* @param endpointFactory
+ * @param scaBindingFactory
* @param intentAttachPointTypeFactory
* @param interfaceContractMapper
* @param policyDefinitions
@@ -80,7 +83,7 @@ public class CompositeBuilderImpl implements CompositeBuilder {
SCADefinitions policyDefinitions,
Monitor monitor) {
this(assemblyFactory, endpointFactory, scaBindingFactory, intentAttachPointTypeFactory,
- null, null, interfaceContractMapper, policyDefinitions, monitor);
+ null, null, interfaceContractMapper, policyDefinitions, monitor, null);
}
/**
@@ -88,10 +91,8 @@ public class CompositeBuilderImpl implements CompositeBuilder {
*
* @param assemblyFactory
* @param scaBindingFactory
- * @param endpointFactory
* @param intentAttachPointTypeFactory
* @param interfaceContractMapper
- * @param policyDefinitions
* @param monitor
*/
@Deprecated
@@ -101,7 +102,7 @@ public class CompositeBuilderImpl implements CompositeBuilder {
InterfaceContractMapper interfaceContractMapper,
Monitor monitor) {
this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
- null, null, interfaceContractMapper, null, monitor);
+ null, null, interfaceContractMapper, null, monitor, null);
}
/**
@@ -123,16 +124,42 @@ public class CompositeBuilderImpl implements CompositeBuilder {
InterfaceContractMapper interfaceContractMapper,
Monitor monitor) {
this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
- documentBuilderFactory, transformerFactory, interfaceContractMapper, null, monitor);
+ documentBuilderFactory, transformerFactory, interfaceContractMapper, null, monitor, null);
}
-
+
/**
* Constructs a new composite builder.
*
* @param assemblyFactory
* @param scaBindingFactory
+ * @param intentAttachPointTypeFactory
+ * @param documentBuilderFactory
+ * @param transformerFactory
+ * @param interfaceContractMapper
+ * @param monitor
+ * @param bindingMap
+ */
+ public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ Monitor monitor,
+ Map<Binding, Binding> bindingMap) {
+ this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
+ documentBuilderFactory, transformerFactory, interfaceContractMapper, null, monitor, bindingMap);
+ }
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
* @param endpointFactory
+ * @param scaBindingFactory
* @param intentAttachPointTypeFactory
+ * @param documentBuilderFactory
+ * @param transformerFactory
* @param interfaceContractMapper
* @param policyDefinitions
* @param monitor
@@ -140,19 +167,47 @@ public class CompositeBuilderImpl implements CompositeBuilder {
public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
EndpointFactory endpointFactory,
SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
InterfaceContractMapper interfaceContractMapper,
SCADefinitions policyDefinitions,
Monitor monitor) {
+ this(assemblyFactory, endpointFactory, scaBindingFactory, intentAttachPointTypeFactory,
+ documentBuilderFactory, transformerFactory, interfaceContractMapper,
+ policyDefinitions, monitor, null);
+ }
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param endpointFactory
+ * @param scaBindingFactory
+ * @param intentAttachPointTypeFactory
+ * @param documentBuilderFactory
+ * @param transformerFactory
+ * @param interfaceContractMapper
+ * @param policyDefinitions
+ * @param bindingMap
+ */
+ public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ EndpointFactory endpointFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor,
+ Map<Binding, Binding> bindingMap) {
if (endpointFactory == null){
endpointFactory = new DefaultEndpointFactory();
}
compositeIncludeBuilder = new CompositeIncludeBuilderImpl(monitor);
- componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor, bindingMap);
componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
compositeCloneBuilder = new CompositeCloneBuilderImpl(monitor);
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
index 76ed861167..a7c9a87038 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
@@ -38,7 +38,7 @@ import org.apache.tuscany.sca.monitor.Monitor;
public class CompositePolicyBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
public CompositePolicyBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor, null);
}
public void build(Composite composite) throws CompositeBuilderException {
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
index 5a6437b3a3..9add794a81 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
@@ -37,7 +37,7 @@ import org.apache.tuscany.sca.monitor.Monitor;
public class CompositePromotionBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
public CompositePromotionBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor, null);
}
public void build(Composite composite) throws CompositeBuilderException {
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
index 1698b1a9c7..7630c4404f 100644
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
+++ b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.assembly.builder.impl;
+import java.util.Map;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.CompositeService;
@@ -36,9 +37,11 @@ import org.apache.tuscany.sca.monitor.Problem.Severity;
public abstract class EndpointBuilderImpl implements EndpointBuilder {
private Monitor monitor;
+ private Map<Binding, Binding> bindingMap;
- public EndpointBuilderImpl (Monitor monitor){
+ public EndpointBuilderImpl (Monitor monitor, Map<Binding, Binding> bindingMap) {
this.monitor = monitor;
+ this.bindingMap = bindingMap;
}
private void warning(String message, Object model, String... messageParameters) {
@@ -98,7 +101,8 @@ public abstract class EndpointBuilderImpl implements EndpointBuilder {
Binding resolvedBinding = BindingConfigurationUtil.matchBinding(endpoint.getTargetComponent(),
endpoint.getTargetComponentService(),
endpoint.getCandidateBindings(),
- endpoint.getTargetComponentService().getBindings());
+ endpoint.getTargetComponentService().getBindings(),
+ bindingMap, false);
if (resolvedBinding == null) {
warning("NoMatchingBinding",
endpoint.getSourceComponentReference(),
@@ -112,7 +116,8 @@ public abstract class EndpointBuilderImpl implements EndpointBuilder {
Binding resolvedCallbackBinding = BindingConfigurationUtil.matchBinding(endpoint.getTargetComponent(),
endpoint.getTargetComponentService(),
endpoint.getSourceComponentReference().getCallback().getBindings(),
- endpoint.getTargetComponentService().getCallback().getBindings());
+ endpoint.getTargetComponentService().getCallback().getBindings(),
+ bindingMap, true);
if (resolvedBinding == null) {
warning("NoMatchingCallbackBinding",
endpoint.getSourceComponentReference(),
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
index 5de0002086..4178a2e8a0 100644
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
+++ b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
@@ -48,6 +48,7 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.TransformerFactory;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
@@ -151,6 +152,7 @@ public class CompositeConfigurationServiceImpl extends HttpServlet implements Se
private DocumentBuilderFactory documentBuilderFactory;
private TransformerFactory transformerFactory;
private InterfaceContractMapper contractMapper;
+ private Map<Binding, Binding> bindingMap;
/**
* Initialize the component.
@@ -202,7 +204,9 @@ public class CompositeConfigurationServiceImpl extends HttpServlet implements Se
intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
contractMapper = utilities.getUtility(InterfaceContractMapper.class);
compositeIncludeBuilder = new CompositeIncludeBuilderImpl(monitor);
- nodeConfigurationBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, contractMapper, null, monitor);
+ bindingMap = new HashMap<Binding, Binding>();
+ nodeConfigurationBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory,
+ transformerFactory, contractMapper, null, monitor, bindingMap);
// Load the definitions.xml
loadSCADefinitions(extensionPoints);
@@ -393,7 +397,7 @@ public class CompositeConfigurationServiceImpl extends HttpServlet implements Se
}
CompositeBuilder compositeBuilder = new CompositeBuilderImpl(assemblyFactory, null, scaBindingFactory,
intentAttachPointTypeFactory, documentBuilderFactory, transformerFactory,
- contractMapper, aggregatedDefinitions, monitor);
+ contractMapper, aggregatedDefinitions, monitor, bindingMap);
try {
compositeBuilder.build(domainComposite);
analyzeProblems();
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
index 23c506446f..cf9e5b67fc 100644
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
+++ b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
@@ -207,6 +207,7 @@ public class QuickStartServiceImpl extends HttpServlet {
" <component name=\"" + nodeName + "\">\n" +
" <t:implementation.node uri=\"" + contributionURI + "\" composite=\"c:" + compositeName.getLocalPart() + "\"/>\n" +
" <service name=\"Node\">\n" +
+ " <binding.sca uri=\"" + nodeURI + "\"/>\n" +
" <binding.ws uri=\"" + nodeURI + "\"/>\n" +
" <t:binding.http uri=\"" + nodeURI + "\"/>\n" +
" <t:binding.jsonrpc uri=\"" + nodeURI + "\"/>\n" +
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
index 736afc13f0..33257a22e4 100644
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
+++ b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.implementation.node.builder.impl;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerFactory;
@@ -65,10 +66,11 @@ public class NodeCompositeBuilderImpl extends BaseConfigurationBuilderImpl imple
TransformerFactory transformerFactory,
InterfaceContractMapper interfaceContractMapper,
SCADefinitions policyDefinitions,
- Monitor monitor) {
+ Monitor monitor,
+ Map<Binding, Binding> bindingMap) {
super(assemblyFactory, scaBindingFactory,
documentBuilderFactory, transformerFactory,
- interfaceContractMapper, policyDefinitions, monitor);
+ interfaceContractMapper, policyDefinitions, monitor, bindingMap);
}
public void build(Composite composite) throws CompositeBuilderException {
diff --git a/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java b/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java
index 67bd07dfb6..83eff15a6a 100644
--- a/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java
+++ b/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java
@@ -157,12 +157,13 @@ public class DistributeAndRunComponents {
SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
+ Map<Binding, Binding> bindingMap = new HashMap<Binding, Binding>();
domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory,
- documentBuilderFactory, transformerFactory, contractMapper, monitor);
+ documentBuilderFactory, transformerFactory, contractMapper, monitor, bindingMap);
// Create a node composite builder
nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory,
- documentBuilderFactory, transformerFactory, contractMapper, null, monitor);
+ documentBuilderFactory, transformerFactory, contractMapper, null, monitor, bindingMap);
}
diff --git a/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java b/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java
index 08ddc8875e..090cd02f43 100644
--- a/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java
+++ b/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java
@@ -25,8 +25,10 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.xml.namespace.QName;
@@ -168,12 +170,13 @@ public class DistributeComponents {
SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
+ Map<Binding, Binding> bindingMap = new HashMap<Binding, Binding>();
domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory,
- documentBuilderFactory, transformerFactory, contractMapper, monitor);
+ documentBuilderFactory, transformerFactory, contractMapper, monitor, bindingMap);
// Create a node composite builder
nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory,
- documentBuilderFactory, transformerFactory, contractMapper, null, monitor);
+ documentBuilderFactory, transformerFactory, contractMapper, null, monitor, bindingMap);
}