tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r800411 - in /tuscany/branches/sca-java-1.5.1: modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ modules/domain-manager/src/main/java/org/apa...
Date Mon, 03 Aug 2009 14:41:00 GMT
Author: nash
Date: Mon Aug  3 14:41:00 2009
New Revision: 800411

URL: http://svn.apache.org/viewvc?rev=800411&view=rev
Log:
Fix TUSCANY-3193 (fully support binding.sca in the domain manager)

Modified:
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
    tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
    tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
    tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
    tuscany/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
    tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java
    tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
Mon Aug  3 14:41:00 2009
@@ -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 @@
  * @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);
     }
 }

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
Mon Aug  3 14:41:00 2009
@@ -72,6 +72,7 @@
     private SCADefinitions policyDefinitions;
     private DocumentBuilderFactory documentBuilderFactory;
     private TransformerFactory transformerFactory;
+    private Map<Binding, Binding> bindingMap;
 
     protected BaseConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
                                              SCABindingFactory scaBindingFactory,
@@ -80,6 +81,18 @@
                                              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 @@
         this.interfaceContractMapper = interfaceContractMapper;
         this.policyDefinitions = policyDefinitions;
         this.monitor = monitor;
+        this.bindingMap = bindingMap;
     }
 
     /**
@@ -1034,6 +1048,26 @@
                     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 @@
             
             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 @@
                     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 @@
             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;
                     }
                 }

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
Mon Aug  3 14:41:00 2009
@@ -66,16 +66,18 @@
     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 @@
                 }
 
                 // 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);
                     }

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
Mon Aug  3 14:41:00 2009
@@ -20,6 +20,7 @@
 
 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 @@
     }
     
     
-    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 @@
                     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 @@
                         } 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 @@
      * @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 @@
      * @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);
     }
     
   

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
Mon Aug  3 14:41:00 2009
@@ -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 @@
  */
 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 {

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
Mon Aug  3 14:41:00 2009
@@ -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 @@
     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 @@
                                 SCADefinitions policyDefinitions,
                                 Monitor monitor) {
         this(assemblyFactory, endpointFactory, scaBindingFactory, intentAttachPointTypeFactory,
-             null, null, interfaceContractMapper, policyDefinitions, monitor);
+             null, null, interfaceContractMapper, policyDefinitions, monitor, null);
     }
         
     /**
@@ -88,10 +91,8 @@
      * 
      * @param assemblyFactory
      * @param scaBindingFactory
-     * @param endpointFactory
      * @param intentAttachPointTypeFactory
      * @param interfaceContractMapper
-     * @param policyDefinitions
      * @param monitor
      */
     @Deprecated
@@ -101,7 +102,7 @@
                                 InterfaceContractMapper interfaceContractMapper,
                                 Monitor monitor) {
         this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
-             null, null, interfaceContractMapper, null, monitor);
+             null, null, interfaceContractMapper, null, monitor, null);
     }
         
     /**
@@ -123,16 +124,42 @@
                                 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 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);

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
Mon Aug  3 14:41:00 2009
@@ -38,7 +38,7 @@
 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 {

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
Mon Aug  3 14:41:00 2009
@@ -37,7 +37,7 @@
 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 {

Modified: tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
Mon Aug  3 14:41:00 2009
@@ -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 @@
 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 @@
         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 @@
             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(),

Modified: tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
Mon Aug  3 14:41:00 2009
@@ -48,6 +48,7 @@
 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 @@
     private DocumentBuilderFactory documentBuilderFactory;
     private TransformerFactory transformerFactory;
     private InterfaceContractMapper contractMapper;
+    private Map<Binding, Binding> bindingMap;
     
     /**
      * Initialize the component.
@@ -202,7 +204,9 @@
         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 @@
         }
         CompositeBuilder compositeBuilder = new CompositeBuilderImpl(assemblyFactory, null,
scaBindingFactory,
                                      intentAttachPointTypeFactory, documentBuilderFactory,
transformerFactory,
-                                     contractMapper, aggregatedDefinitions, monitor);
+                                     contractMapper, aggregatedDefinitions, monitor, bindingMap);
         try {
             compositeBuilder.build(domainComposite);
             analyzeProblems();

Modified: tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
Mon Aug  3 14:41:00 2009
@@ -207,6 +207,7 @@
                                 "       <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" +

Modified: tuscany/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
(original)
+++ tuscany/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
Mon Aug  3 14:41:00 2009
@@ -21,6 +21,7 @@
 
 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 @@
                                                   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 {

Modified: tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java
(original)
+++ tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java
Mon Aug  3 14:41:00 2009
@@ -157,12 +157,13 @@
         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);
     }
     
 

Modified: tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java?rev=800411&r1=800410&r2=800411&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java
(original)
+++ tuscany/branches/sca-java-1.5.1/samples/domain-management/src/main/java/manager/DistributeComponents.java
Mon Aug  3 14:41:00 2009
@@ -25,8 +25,10 @@
 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 @@
         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);
     }
     
 



Mime
View raw message