You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2009/07/06 19:39:46 UTC

svn commit: r791550 [3/5] - in /tuscany/java/sca/modules/assembly/src: main/java/org/apache/tuscany/sca/assembly/ main/java/org/apache/tuscany/sca/assembly/builder/ main/java/org/apache/tuscany/sca/assembly/builder/impl/ main/java/org/apache/tuscany/sc...

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -61,7 +61,7 @@
      * @param problems
      */
     private void configureNestedCompositeReferences(Composite composite, Monitor monitor) {
-    
+
         // Process nested composites recursively
         for (Component component : composite.getComponents()) {
             Implementation implementation = component.getImplementation();
@@ -69,7 +69,7 @@
                 configureNestedCompositeReferences((Composite)implementation, monitor);
             }
         }
-    
+
         // Process component references declared on components in this composite
         for (Component component : composite.getComponents()) {
             Implementation implementation = component.getImplementation();
@@ -82,7 +82,7 @@
                         if (!componentReference.getEndpointReferences().isEmpty()) {
                             componentReference.setPromotionOverride(true);
                         }
-     
+
                         // If the component reference is a promotion override, override the
                         // configuration of the promoted reference  
                         if (componentReference.isPromotionOverride()) {
@@ -90,11 +90,14 @@
                             List<ComponentReference> promotedReferences =
                                 ReferenceConfigurationUtil.getPromotedComponentReferences(compositeReference);
                             for (ComponentReference promotedReference : promotedReferences) {
-                                ReferenceConfigurationUtil.reconcileReferenceBindings(
-                                        componentReference, promotedReference, assemblyFactory, monitor);
+                                ReferenceConfigurationUtil.reconcileReferenceBindings(componentReference,
+                                                                                      promotedReference,
+                                                                                      assemblyFactory,
+                                                                                      monitor);
                                 if (componentReference.getInterfaceContract() != null && // can be null in unit tests
-                                    componentReference.getInterfaceContract().getCallbackInterface() != null) {
-                                    SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
+                                componentReference.getInterfaceContract().getCallbackInterface() != null) {
+                                    SCABinding scaCallbackBinding =
+                                        promotedReference.getCallbackBinding(SCABinding.class);
                                     if (promotedReference.getCallback() != null) {
                                         promotedReference.getCallback().getBindings().clear();
                                     } else {
@@ -108,56 +111,56 @@
                                             .getCallback().getBindings());
                                     }
                                 }
- /* TODO - let endpoint references worry about target service
-                                // Wire the promoted reference to the actual non-composite component services
-                                if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE) {
-                                    // promotedReference.getTargets().clear();
-                                }
-                                for (ComponentService target : componentReference.getTargets()) {
-                                    if (target.getService() instanceof CompositeService) {
-        
-                                        // Wire to the actual component service
-                                        // promoted by a composite service
-                                        CompositeService compositeService = (CompositeService)target.getService();
-                                        // Find the promoted component service
-                                        ComponentService componentService =
-                                            ServiceConfigurationUtil.getPromotedComponentService(compositeService);
-                                        if (componentService != null) {
-                                            promotedReference.getTargets().add(componentService);
-                                        }
-                                    } else {
-        
-                                        // Wire to a non-composite target service
-                                        promotedReference.getTargets().add(target);
-                                    }
-                                }
-*/
+                                /* TODO - let endpoint references worry about target service
+                                                               // Wire the promoted reference to the actual non-composite component services
+                                                               if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE) {
+                                                                   // promotedReference.getTargets().clear();
+                                                               }
+                                                               for (ComponentService target : componentReference.getTargets()) {
+                                                                   if (target.getService() instanceof CompositeService) {
+                                       
+                                                                       // Wire to the actual component service
+                                                                       // promoted by a composite service
+                                                                       CompositeService compositeService = (CompositeService)target.getService();
+                                                                       // Find the promoted component service
+                                                                       ComponentService componentService =
+                                                                           ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+                                                                       if (componentService != null) {
+                                                                           promotedReference.getTargets().add(componentService);
+                                                                       }
+                                                                   } else {
+                                       
+                                                                       // Wire to a non-composite target service
+                                                                       promotedReference.getTargets().add(target);
+                                                                   }
+                                                               }
+                                */
                             }
                         }
                     }
                 }
             } else {
-/* TODO - let endpoint references worry about target servicep
-                for (ComponentReference componentReference : component.getReferences()) {
-    
-                    // Wire the component reference to the actual
-                    // non-composite component services
-                    List<ComponentService> targets = componentReference.getTargets();
-                    for (int i = 0, n = targets.size(); i < n; i++) {
-                        ComponentService target = targets.get(i);
-                        if (target.getService() instanceof CompositeService) {
-    
-                            // Wire to the actual component service
-                            // promoted by a composite service
-                            CompositeService compositeService = (CompositeService)target.getService();
-                            ComponentService componentService = compositeService.getPromotedService();
-                            if (componentService != null) {
-                                targets.set(i, componentService);
-                            }
-                        }
-                    }
-                }
-*/
+                /* TODO - let endpoint references worry about target servicep
+                                for (ComponentReference componentReference : component.getReferences()) {
+                    
+                                    // Wire the component reference to the actual
+                                    // non-composite component services
+                                    List<ComponentService> targets = componentReference.getTargets();
+                                    for (int i = 0, n = targets.size(); i < n; i++) {
+                                        ComponentService target = targets.get(i);
+                                        if (target.getService() instanceof CompositeService) {
+                    
+                                            // Wire to the actual component service
+                                            // promoted by a composite service
+                                            CompositeService compositeService = (CompositeService)target.getService();
+                                            ComponentService componentService = compositeService.getPromotedService();
+                                            if (componentService != null) {
+                                                targets.set(i, componentService);
+                                            }
+                                        }
+                                    }
+                                }
+                */
             }
         }
     }

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -61,7 +61,7 @@
      * @param problems
      */
     private void wireCompositeReferences(Composite composite, Monitor monitor) {
-    
+
         // Process nested composites recursively
         for (Component component : composite.getComponents()) {
             Implementation implementation = component.getImplementation();
@@ -69,7 +69,7 @@
                 wireCompositeReferences((Composite)implementation, monitor);
             }
         }
-    
+
         // Process component references declared on components in this composite
         for (Component component : composite.getComponents()) {
             Implementation implementation = component.getImplementation();
@@ -82,7 +82,7 @@
                         if (!componentReference.getEndpointReferences().isEmpty()) {
                             componentReference.setPromotionOverride(true);
                         }
-     
+
                         // If the component reference is a promotion override, override the
                         // configuration of the promoted reference  
                         if (componentReference.isPromotionOverride()) {
@@ -90,11 +90,14 @@
                             List<ComponentReference> promotedReferences =
                                 ReferenceConfigurationUtil.getPromotedComponentReferences(compositeReference);
                             for (ComponentReference promotedReference : promotedReferences) {
-                                ReferenceConfigurationUtil.reconcileReferenceBindings(
-                                        componentReference, promotedReference, assemblyFactory, monitor);
+                                ReferenceConfigurationUtil.reconcileReferenceBindings(componentReference,
+                                                                                      promotedReference,
+                                                                                      assemblyFactory,
+                                                                                      monitor);
                                 if (componentReference.getInterfaceContract() != null && // can be null in unit tests
-                                    componentReference.getInterfaceContract().getCallbackInterface() != null) {
-                                    SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
+                                componentReference.getInterfaceContract().getCallbackInterface() != null) {
+                                    SCABinding scaCallbackBinding =
+                                        promotedReference.getCallbackBinding(SCABinding.class);
                                     if (promotedReference.getCallback() != null) {
                                         promotedReference.getCallback().getBindings().clear();
                                     } else {
@@ -108,56 +111,56 @@
                                             .getCallback().getBindings());
                                     }
                                 }
- /* TODO - let endpoint references worry about target service
-                                // Wire the promoted reference to the actual non-composite component services
-                                if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE) {
-                                    // promotedReference.getTargets().clear();
-                                }
-                                for (ComponentService target : componentReference.getTargets()) {
-                                    if (target.getService() instanceof CompositeService) {
-        
-                                        // Wire to the actual component service
-                                        // promoted by a composite service
-                                        CompositeService compositeService = (CompositeService)target.getService();
-                                        // Find the promoted component service
-                                        ComponentService componentService =
-                                            ServiceConfigurationUtil.getPromotedComponentService(compositeService);
-                                        if (componentService != null) {
-                                            promotedReference.getTargets().add(componentService);
-                                        }
-                                    } else {
-        
-                                        // Wire to a non-composite target service
-                                        promotedReference.getTargets().add(target);
-                                    }
-                                }
-*/
+                                /* TODO - let endpoint references worry about target service
+                                                               // Wire the promoted reference to the actual non-composite component services
+                                                               if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE) {
+                                                                   // promotedReference.getTargets().clear();
+                                                               }
+                                                               for (ComponentService target : componentReference.getTargets()) {
+                                                                   if (target.getService() instanceof CompositeService) {
+                                       
+                                                                       // Wire to the actual component service
+                                                                       // promoted by a composite service
+                                                                       CompositeService compositeService = (CompositeService)target.getService();
+                                                                       // Find the promoted component service
+                                                                       ComponentService componentService =
+                                                                           ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+                                                                       if (componentService != null) {
+                                                                           promotedReference.getTargets().add(componentService);
+                                                                       }
+                                                                   } else {
+                                       
+                                                                       // Wire to a non-composite target service
+                                                                       promotedReference.getTargets().add(target);
+                                                                   }
+                                                               }
+                                */
                             }
                         }
                     }
                 }
             } else {
-/* TODO - let endpoint references worry about target servicep
-                for (ComponentReference componentReference : component.getReferences()) {
-    
-                    // Wire the component reference to the actual
-                    // non-composite component services
-                    List<ComponentService> targets = componentReference.getTargets();
-                    for (int i = 0, n = targets.size(); i < n; i++) {
-                        ComponentService target = targets.get(i);
-                        if (target.getService() instanceof CompositeService) {
-    
-                            // Wire to the actual component service
-                            // promoted by a composite service
-                            CompositeService compositeService = (CompositeService)target.getService();
-                            ComponentService componentService = compositeService.getPromotedService();
-                            if (componentService != null) {
-                                targets.set(i, componentService);
-                            }
-                        }
-                    }
-                }
-*/
+                /* TODO - let endpoint references worry about target servicep
+                                for (ComponentReference componentReference : component.getReferences()) {
+                    
+                                    // Wire the component reference to the actual
+                                    // non-composite component services
+                                    List<ComponentService> targets = componentReference.getTargets();
+                                    for (int i = 0, n = targets.size(); i < n; i++) {
+                                        ComponentService target = targets.get(i);
+                                        if (target.getService() instanceof CompositeService) {
+                    
+                                            // Wire to the actual component service
+                                            // promoted by a composite service
+                                            CompositeService compositeService = (CompositeService)target.getService();
+                                            ComponentService componentService = compositeService.getPromotedService();
+                                            if (componentService != null) {
+                                                targets.set(i, componentService);
+                                            }
+                                        }
+                                    }
+                                }
+                */
             }
         }
     }

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -44,8 +44,9 @@
  * @version $Rev$ $Date$
  */
 public class ComponentReferenceWireBuilderImpl extends BaseBuilderImpl implements CompositeBuilder {
-   
-    public ComponentReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper) {
+
+    public ComponentReferenceWireBuilderImpl(AssemblyFactory assemblyFactory,
+                                             InterfaceContractMapper interfaceContractMapper) {
         super(assemblyFactory, null, null, null, interfaceContractMapper);
     }
 
@@ -56,7 +57,7 @@
     public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
         wireComponentReferences(composite, monitor);
     }
-    
+
     /**
      * Wire component references to component services and connect promoted
      * services/references to component services/references inside a composite.
@@ -82,12 +83,12 @@
         // Connect component references as described in wires
         connectWires(composite, componentServices, componentReferences, monitor);
 
-
         // Validate that references are wired or promoted, according
         // to their multiplicity
         for (ComponentReference componentReference : componentReferences.values()) {
-            if (!ReferenceConfigurationUtil.validateMultiplicityAndTargets(componentReference.getMultiplicity(), componentReference
-                .getTargets(), componentReference.getBindings())) {
+            if (!ReferenceConfigurationUtil.validateMultiplicityAndTargets(componentReference.getMultiplicity(),
+                                                                           componentReference.getTargets(),
+                                                                           componentReference.getBindings())) {
                 if (componentReference.getTargets().isEmpty()) {
 
                     // No warning if the reference is promoted out of the current composite
@@ -100,22 +101,25 @@
                         }
                     }
                     if (!promoted && !componentReference.isCallback()) {
-                        warning(monitor, "ReferenceWithoutTargets", composite, composite.getName().toString(), 
-                        		componentReference.getName());
+                        warning(monitor,
+                                "ReferenceWithoutTargets",
+                                composite,
+                                composite.getName().toString(),
+                                componentReference.getName());
                     }
                 } else {
                     warning(monitor, "TooManyReferenceTargets", composite, componentReference.getName());
                 }
             }
         }
-        
+
         // Finally clear the original reference target lists as we now have
         // bindings to represent the targets
-      //  for (ComponentReference componentReference : componentReferences.values()) {
-      //      componentReference.getTargets().clear();
-      //  }
-    }  
-    
+        //  for (ComponentReference componentReference : componentReferences.values()) {
+        //      componentReference.getTargets().clear();
+        //  }
+    }
+
     /**
      * Resolve wires and connect the sources to their targets
      * 
@@ -128,16 +132,16 @@
                               Map<String, ComponentService> componentServices,
                               Map<String, ComponentReference> componentReferences,
                               Monitor monitor) {
-    
+
         // For each wire, resolve the source reference, the target service, and
         // add it to the list of targets of the reference
         List<Wire> wires = composite.getWires();
         for (int i = 0, n = wires.size(); i < n; i++) {
             Wire wire = wires.get(i);
-    
+
             ComponentReference resolvedReference;
             ComponentService resolvedService;
-    
+
             // Resolve the source reference
             ComponentReference source = wire.getSource();
             if (source != null && source.isUnresolved()) {
@@ -150,7 +154,7 @@
             } else {
                 resolvedReference = wire.getSource();
             }
-    
+
             // Resolve the target service
             ComponentService target = wire.getTarget();
             if (target != null && target.isUnresolved()) {
@@ -163,7 +167,7 @@
             } else {
                 resolvedService = wire.getTarget();
             }
-    
+
             // Add the target service to the list of targets of the
             // reference
             if (resolvedReference != null && resolvedService != null) {
@@ -172,7 +176,7 @@
                 // the component reference interface
                 if (resolvedReference.getInterfaceContract() == null || interfaceContractMapper
                     .isCompatible(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) {
-    
+
                     //resolvedReference.getTargets().add(resolvedService);
                     resolvedReference.getTargets().add(wire.getTarget());
                 } else {
@@ -180,9 +184,9 @@
                 }
             }
         }
-    
+
         // Clear the list of wires
         composite.getWires().clear();
     }
-    
+
 }

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -49,9 +49,9 @@
     public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
         buildServiceBindings(composite, monitor);
     }
-    
+
     private void buildServiceBindings(Composite composite, Monitor monitor) {
-        
+
         // build bindings recursively
         for (Component component : composite.getComponents()) {
             Implementation implementation = component.getImplementation();

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -29,9 +29,7 @@
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.CompositeService;
 import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
 import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Reference;
 import org.apache.tuscany.sca.assembly.Service;
 import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
@@ -48,10 +46,10 @@
  */
 public class ComponentServiceEndpointBuilderImpl implements CompositeBuilder {
     private AssemblyFactory assemblyFactory;
-    
-	// Testing
-	//boolean useNew = true;
-	boolean useNew = false;
+
+    // Testing
+    //boolean useNew = true;
+    boolean useNew = false;
 
     public ComponentServiceEndpointBuilderImpl(AssemblyFactory assemblyFactory) {
         this.assemblyFactory = assemblyFactory;
@@ -69,19 +67,19 @@
      * @param monitor - a Monitor for logging errors
      */
     public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
-    
+
         // process component services
-    	if( !useNew ) {
-    		processComponentServices(composite);
-    	} // end if
-        processComponentServices2( composite );
- 
+        if (!useNew) {
+            processComponentServices(composite);
+        } // end if
+        processComponentServices2(composite);
+
     } // end method build
-       
+
     private void processComponentServices(Composite composite) {
 
         for (Component component : composite.getComponents()) {
-           
+
             // recurse for composite implementations
             Implementation implementation = component.getImplementation();
             if (implementation instanceof Composite) {
@@ -90,10 +88,10 @@
 
             // create an endpoint for each component service binding
             for (ComponentService service : component.getServices()) {
-                
+
                 Component endpointComponent = component;
                 ComponentService endpointService = service;
-                
+
                 // TODO - EPR - We maintain all endpoints at the right level now
                 //              but endpoints for promoting services must point down
                 //              to the services they promote. 
@@ -102,8 +100,8 @@
                     endpointService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
                     endpointComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
                 } // end if
-                               
-                for (Binding binding : service.getBindings()){
+
+                for (Binding binding : service.getBindings()) {
                     Endpoint endpoint = assemblyFactory.createEndpoint();
                     endpoint.setComponent(endpointComponent);
                     endpoint.setService(endpointService);
@@ -114,20 +112,20 @@
             }
         }
     } // end method processComponentServices
-    
+
     /**
      * @param composite - the composite which contains the component services
      */
     private void processComponentServices2(Composite composite) {
-    	for( Component component : composite.getComponents() ) {
-    		for( ComponentService service : component.getServices() ) {
-    			EndpointInfo theInfo = scanComponentService( component, service, null );
-            	
-            	List<Binding> theBindings = theInfo.getBindings();
-            	// Create an endpoint for each binding which applies to this service
-            	// and copy across the information relating to the endpoint.
-            	for( Binding binding : theBindings ) {
-        			Endpoint endpoint = assemblyFactory.createEndpoint();
+        for (Component component : composite.getComponents()) {
+            for (ComponentService service : component.getServices()) {
+                EndpointInfo theInfo = scanComponentService(component, service, null);
+
+                List<Binding> theBindings = theInfo.getBindings();
+                // Create an endpoint for each binding which applies to this service
+                // and copy across the information relating to the endpoint.
+                for (Binding binding : theBindings) {
+                    Endpoint endpoint = assemblyFactory.createEndpoint();
                     endpoint.setComponent(theInfo.getComponent());
                     endpoint.setService(theInfo.getComponentService());
                     endpoint.setBinding(binding);
@@ -136,28 +134,28 @@
                     endpoint.getPolicySets().addAll(theInfo.getPolicySets());
                     endpoint.setUnresolved(false);
                     // Add the endpoint to the component service
-                    if( useNew ) {
-                    	// Add to top level and leaf level services, if different
-                    	service.getEndpoints().add(endpoint);
-                    	ComponentService leafService = theInfo.getComponentService();
-                    	if( service != leafService ) {
-                    		leafService.getEndpoints().add(endpoint);
-                    	} // end if 
+                    if (useNew) {
+                        // Add to top level and leaf level services, if different
+                        service.getEndpoints().add(endpoint);
+                        ComponentService leafService = theInfo.getComponentService();
+                        if (service != leafService) {
+                            leafService.getEndpoints().add(endpoint);
+                        } // end if 
                     } // end if
                     // debug
                     // disabled for the time being - SL
                     //System.out.println( "Endpoint created for Component = " + component.getName() + " Leaf component = " + 
                     //		endpoint.getComponent().getName() + " service = " + 
                     //		endpoint.getService().getName() + " binding = " + endpoint.getBinding() );
-            	} // end for	
-    		} // end for
-    		// Handle composites as implementations
-    		if( component.getImplementation() instanceof Composite ) {
-    			processComponentServices2( (Composite) component.getImplementation() );
-    		} // end if
-    	} // end for
+                } // end for	
+            } // end for
+            // Handle composites as implementations
+            if (component.getImplementation() instanceof Composite) {
+                processComponentServices2((Composite)component.getImplementation());
+            } // end if
+        } // end for
     } // end method processComponentServices2
-    
+
     /**
      * Scan a component service for endpoint information, recursing down to the leafmost promoted service if the component service is
      * implemented by a Composite service
@@ -166,102 +164,101 @@
      * @param theInfo - an EndpointInfo object in which the endpoint information is accumulated. If null on entry, a new EndpointInfo object is created
      * @return - the EndpointInfo object containing the information about the component service
      */
-    private EndpointInfo scanComponentService( Component component, ComponentService service, EndpointInfo theInfo ) {
-    	if( theInfo == null ) { 
-    		theInfo = new EndpointInfo(); 
-    	} // end if
-    	
+    private EndpointInfo scanComponentService(Component component, ComponentService service, EndpointInfo theInfo) {
+        if (theInfo == null) {
+            theInfo = new EndpointInfo();
+        } // end if
+
         theInfo.setBindings(service.getBindings());
-    	theInfo.setInterfaceContract(service.getInterfaceContract());
-    	theInfo.setIntents(service.getRequiredIntents());
-    	theInfo.setPolicySets(service.getPolicySets());
-    	
-    	Service implService = service.getService();
-    	if( implService instanceof CompositeService ) {
-    		// If it is implemented by a Composite, scan through the promoted service
+        theInfo.setInterfaceContract(service.getInterfaceContract());
+        theInfo.setIntents(service.getRequiredIntents());
+        theInfo.setPolicySets(service.getPolicySets());
+
+        Service implService = service.getService();
+        if (implService instanceof CompositeService) {
+            // If it is implemented by a Composite, scan through the promoted service
             ComponentService promotedService = ((CompositeService)implService).getPromotedService();
             Component promotedComponent = ((CompositeService)implService).getPromotedComponent();
             if (promotedService != null) {
-            	scanComponentService( promotedComponent, promotedService, theInfo );
+                scanComponentService(promotedComponent, promotedService, theInfo);
             } else {
-            	// If its a composite service with no promoted component service, it's an error
+                // If its a composite service with no promoted component service, it's an error
             } // end if
-    	} else {
-    		// Otherwise the component and service are the ones at this level
-        	theInfo.setComponent(component);
-        	theInfo.setComponentService(service);
-    	} //end if
-    	
+        } else {
+            // Otherwise the component and service are the ones at this level
+            theInfo.setComponent(component);
+            theInfo.setComponentService(service);
+        } //end if
+
         return theInfo;
     } // end method scanPromotedComponentService
-    
+
     private class EndpointInfo {
-    	private Component 			leafComponent = null;
-    	private ComponentService 	leafComponentService = null;
-    	private List<Binding>		bindings = null;
-    	private InterfaceContract	contract;
-    	private List<Intent>		intents = new Vector<Intent>();
-    	private List<PolicySet>		policySets = null;
-    	
-    	void setComponent( Component component ){
-    		leafComponent = component;
-    	} // end method
-    	
-    	Component getComponent() {
-    		return leafComponent;
-    	} // end method
-    	
-    	void setComponentService( ComponentService service ) {
-    		leafComponentService = service;
-    	} // end method
-    	
-    	ComponentService getComponentService() {
-    		return leafComponentService;
-    	} // end method
-    	
-    	void setBindings( List<Binding> theBindings ) {
-    		// RULE: Bindings from higher in the hierarchy take precedence
-    		if( bindings == null ) {
-    			bindings = theBindings;
-    		} // end if
-    	} // end method
-    	
-    	List<Binding> getBindings() {
-    		return bindings;
-    	} // end method
-    	
-    	void setInterfaceContract( InterfaceContract theInterface ) {
-    		// RULE: Interface contract from higher in the hierarchy takes precedence
-    		if( contract == null ) {
-    			contract = theInterface;
-    		} // end if
-    	} // end method
-    	
-    	InterfaceContract getInterfaceContract() {
-    		return contract;
-    	} // end method
-
-		List<Intent> getIntents() {
-			return intents;
-		} // end method
-
-		void setIntents(List<Intent> intents) {
-			// RULE: Intents accumulate from all levels in the hierarchy
-			this.intents.addAll( intents );
-		} // end method
-
-		List<PolicySet> getPolicySets() {
-			return policySets;
-		} // end method
-
-		void setPolicySets(List<PolicySet> policySets) {
-			// RULE: Policy Sets from higher in the hierarchy override those lower
-			if( this.policySets == null ) {
-				this.policySets = policySets;
-			} // end if
-		} // end method
-    	
-    	
+        private Component leafComponent = null;
+        private ComponentService leafComponentService = null;
+        private List<Binding> bindings = null;
+        private InterfaceContract contract;
+        private List<Intent> intents = new Vector<Intent>();
+        private List<PolicySet> policySets = null;
+
+        void setComponent(Component component) {
+            leafComponent = component;
+        } // end method
+
+        Component getComponent() {
+            return leafComponent;
+        } // end method
+
+        void setComponentService(ComponentService service) {
+            leafComponentService = service;
+        } // end method
+
+        ComponentService getComponentService() {
+            return leafComponentService;
+        } // end method
+
+        void setBindings(List<Binding> theBindings) {
+            // RULE: Bindings from higher in the hierarchy take precedence
+            if (bindings == null) {
+                bindings = theBindings;
+            } // end if
+        } // end method
+
+        List<Binding> getBindings() {
+            return bindings;
+        } // end method
+
+        void setInterfaceContract(InterfaceContract theInterface) {
+            // RULE: Interface contract from higher in the hierarchy takes precedence
+            if (contract == null) {
+                contract = theInterface;
+            } // end if
+        } // end method
+
+        InterfaceContract getInterfaceContract() {
+            return contract;
+        } // end method
+
+        List<Intent> getIntents() {
+            return intents;
+        } // end method
+
+        void setIntents(List<Intent> intents) {
+            // RULE: Intents accumulate from all levels in the hierarchy
+            this.intents.addAll(intents);
+        } // end method
+
+        List<PolicySet> getPolicySets() {
+            return policySets;
+        } // end method
+
+        void setPolicySets(List<PolicySet> policySets) {
+            // RULE: Policy Sets from higher in the hierarchy override those lower
+            if (this.policySets == null) {
+                this.policySets = policySets;
+            } // end if
+        } // end method
+
     } // end class EndpointInfo
 
 } // end class

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -73,22 +73,25 @@
                         ComponentService promotedService =
                             ServiceConfigurationUtil.getPromotedComponentService(compositeService);
                         if (promotedService != null) {
-                            Component promotedComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
+                            Component promotedComponent =
+                                ServiceConfigurationUtil.getPromotedComponent(compositeService);
 
                             // Create a new component service to represent this
                             // component service on the promoted component
                             ComponentService newComponentService = assemblyFactory.createComponentService();
-                            newComponentService.setName("$promoted$" + component.getName() + "$slash$" + componentService.getName());
+                            newComponentService.setName("$promoted$" + component.getName()
+                                + "$slash$"
+                                + componentService.getName());
                             promotedComponent.getServices().add(newComponentService);
                             newComponentService.setService(promotedService.getService());
                             newComponentService.getBindings().addAll(componentService.getBindings());
                             newComponentService.setInterfaceContract(componentService.getInterfaceContract());
-                            
-                            if (componentService.getInterfaceContract() != null && 
-                                componentService.getInterfaceContract().getCallbackInterface() != null) {
+
+                            if (componentService.getInterfaceContract() != null && componentService
+                                .getInterfaceContract().getCallbackInterface() != null) {
                                 newComponentService.setCallback(assemblyFactory.createCallback());
-                                newComponentService.getCallback().getBindings()
-                                        .addAll(componentService.getCallback().getBindings());
+                                newComponentService.getCallback().getBindings().addAll(componentService.getCallback()
+                                    .getBindings());
                             }
 
                             // Change the composite service to now promote the

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingConfigurationBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingConfigurationBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingConfigurationBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -41,31 +41,27 @@
  *
  * @version $Rev$ $Date$
  */
-public class CompositeBindingConfigurationBuilderImpl extends CompositeBindingURIBuilderImpl implements CompositeBuilder {
+public class CompositeBindingConfigurationBuilderImpl extends CompositeBindingURIBuilderImpl implements
+    CompositeBuilder {
 
     public CompositeBindingConfigurationBuilderImpl(FactoryExtensionPoint factories, InterfaceContractMapper mapper) {
-        super(factories.getFactory(AssemblyFactory.class),
-              factories.getFactory(SCABindingFactory.class),
-              null, null,
+        super(factories.getFactory(AssemblyFactory.class), factories.getFactory(SCABindingFactory.class), null, null,
               mapper);
     }
-    
+
     public CompositeBindingConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
-                                    SCABindingFactory scaBindingFactory,
-                                    InterfaceContractMapper interfaceContractMapper) {
-        super(assemblyFactory,
-              scaBindingFactory,
-              null, null,
-              interfaceContractMapper);
+                                                    SCABindingFactory scaBindingFactory,
+                                                    InterfaceContractMapper interfaceContractMapper) {
+        super(assemblyFactory, scaBindingFactory, null, null, interfaceContractMapper);
     }
-    
+
     public String getID() {
         return "org.apache.tuscany.sca.assembly.builder.CompositeServiceBindingBuilder";
     }
 
     public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
         List<Binding> defaultBindings = null;
-        for (Object x: composite.getExtensions()) {
+        for (Object x : composite.getExtensions()) {
             if (x instanceof List) {
                 defaultBindings = (List<Binding>)x;
             }
@@ -73,5 +69,5 @@
         // TODO - EPR - is this ever used?
         //configureBindingURIs(composite, definitions, defaultBindings, monitor);
     }
-    
+
 }

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -61,9 +61,7 @@
     public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
                                           SCABindingFactory scaBindingFactory,
                                           InterfaceContractMapper interfaceContractMapper) {
-        super(assemblyFactory, scaBindingFactory,
-              null, null,
-              interfaceContractMapper);
+        super(assemblyFactory, scaBindingFactory, null, null, interfaceContractMapper);
     }
 
     public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
@@ -71,8 +69,7 @@
                                           DocumentBuilderFactory documentBuilderFactory,
                                           TransformerFactory transformerFactory,
                                           InterfaceContractMapper interfaceContractMapper) {
-        super(assemblyFactory, scaBindingFactory,
-              documentBuilderFactory, transformerFactory, interfaceContractMapper);
+        super(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper);
     }
 
     public String getID() {
@@ -83,8 +80,10 @@
         configureBindingURIsAndNames(composite, definitions, monitor);
     }
 
-    public void build(Composite composite, Definitions definitions, Map<QName, List<String>> bindingBaseURIs, Monitor monitor)
-    		throws CompositeBuilderException {
+    public void build(Composite composite,
+                      Definitions definitions,
+                      Map<QName, List<String>> bindingBaseURIs,
+                      Monitor monitor) throws CompositeBuilderException {
         configureBindingURIs(composite, null, definitions, bindingBaseURIs, monitor);
         configureBindingNames(composite, monitor);
     }
@@ -94,7 +93,8 @@
      *
      * @param composite the composite to be configured
      */
-    protected void configureBindingURIsAndNames(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    protected void configureBindingURIsAndNames(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         configureBindingURIs(composite, null, definitions, null, monitor);
         configureBindingNames(composite, monitor);
     }
@@ -108,33 +108,36 @@
      * @param defaultBindings list of default binding configurations
      */
     protected void configureBindingURIs(Composite composite,
-                                        Definitions definitions, Map<QName, List<String>> defaultBindings,
+                                        Definitions definitions,
+                                        Map<QName, List<String>> defaultBindings,
                                         Monitor monitor) throws CompositeBuilderException {
         configureBindingURIs(composite, null, definitions, defaultBindings, monitor);
     }
 
-     /**
-      * Fully resolve the binding URIs based on available information. This includes information
-      * from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
-      * from any associated policies and from the default information for each binding type.
-      *
-      * NOTE: This method repeats some of the processing performed by the configureComponents()
-      *       method above.  The duplication is needed because NodeConfigurationServiceImpl
-      *       calls this method without previously calling configureComponents().  In the
-      *       normal builder sequence used by CompositeBuilderImpl, both of these methods
-      *       are called.
-      *
-      * TODO: Share the URL calculation algorithm with the configureComponents() method above
-      *       although keeping the configureComponents() methods signature as is because when
-      *       a composite is actually build in a node the node default information is currently
-      *       available
-      *
-      * @param composite the composite to be configured
-      * @param uri the path to the composite provided through any nested composite component implementations
-      * @param defaultBindings list of default binding configurations
-      */
-    private void configureBindingURIs(Composite composite, String uri,
-                                      Definitions definitions, Map<QName, List<String>> defaultBindings,
+    /**
+     * Fully resolve the binding URIs based on available information. This includes information
+     * from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
+     * from any associated policies and from the default information for each binding type.
+     *
+     * NOTE: This method repeats some of the processing performed by the configureComponents()
+     *       method above.  The duplication is needed because NodeConfigurationServiceImpl
+     *       calls this method without previously calling configureComponents().  In the
+     *       normal builder sequence used by CompositeBuilderImpl, both of these methods
+     *       are called.
+     *
+     * TODO: Share the URL calculation algorithm with the configureComponents() method above
+     *       although keeping the configureComponents() methods signature as is because when
+     *       a composite is actually build in a node the node default information is currently
+     *       available
+     *
+     * @param composite the composite to be configured
+     * @param uri the path to the composite provided through any nested composite component implementations
+     * @param defaultBindings list of default binding configurations
+     */
+    private void configureBindingURIs(Composite composite,
+                                      String uri,
+                                      Definitions definitions,
+                                      Map<QName, List<String>> defaultBindings,
                                       Monitor monitor) throws CompositeBuilderException {
 
         String parentComponentURI = uri;
@@ -184,20 +187,13 @@
             Map<String, Service> services = new HashMap<String, Service>();
             Map<String, Reference> references = new HashMap<String, Reference>();
             Map<String, Property> properties = new HashMap<String, Property>();
-            indexImplementationPropertiesServicesAndReferences(component,
-                                                               services,
-                                                               references,
-                                                               properties,
-                                                               monitor);
+            indexImplementationPropertiesServicesAndReferences(component, services, references, properties, monitor);
 
             // Index component services, references and properties
             // Also check for duplicates
-            Map<String, ComponentService> componentServices =
-                new HashMap<String, ComponentService>();
-            Map<String, ComponentReference> componentReferences =
-                new HashMap<String, ComponentReference>();
-            Map<String, ComponentProperty> componentProperties =
-                new HashMap<String, ComponentProperty>();
+            Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+            Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
+            Map<String, ComponentProperty> componentProperties = new HashMap<String, ComponentProperty>();
             indexComponentPropertiesServicesAndReferences(component,
                                                           componentServices,
                                                           componentReferences,
@@ -313,7 +309,7 @@
 
         // set the default binding name if one is required
         // if there is no name on the binding then set it to the service or reference name
-        if (binding.getName() == null){
+        if (binding.getName() == null) {
             binding.setName(contract.getName());
         }
 
@@ -328,8 +324,8 @@
                 continue;
             }
             if (binding.getName().equals(otherBinding.getName())) {
-                warning(monitor, contract instanceof Service ? "MultipleBindingsForService" : "MultipleBindingsForReference",
-                        binding, contract.getName(), binding.getName());
+                warning(monitor, contract instanceof Service ? "MultipleBindingsForService"
+                    : "MultipleBindingsForReference", binding, contract.getName(), binding.getName());
             }
         }
     }
@@ -346,28 +342,33 @@
      * @param binding
      * @param defaultBindings
      */
-    private void constructBindingURI(String parentComponentURI, Composite composite, Service service,
-                                     Binding binding, Map<QName, List<String>> defaultBindings, Monitor monitor)
-    throws CompositeBuilderException{
+    private void constructBindingURI(String parentComponentURI,
+                                     Composite composite,
+                                     Service service,
+                                     Binding binding,
+                                     Map<QName, List<String>> defaultBindings,
+                                     Monitor monitor) throws CompositeBuilderException {
         // This is a composite service so there is no component to provide a component URI
         // The path to this composite (through nested composites) is used.
         boolean includeBindingName = composite.getServices().size() != 1;
         constructBindingURI(parentComponentURI, service, binding, includeBindingName, defaultBindings, monitor);
     }
 
-     /**
-      * URI construction for component bindings based on Assembly Specification section 1.7.2. This method
-      * calculates the component URI part based on component information before calling the generic
-      * constructBindingURI method
-      *
-      * @param component the component that holds the service
-      * @param service the service that holds the binding
-      * @param binding the binding for which the URI is being constructed
-      * @param defaultBindings the list of default binding configurations
-      */
-    private void constructBindingURI(Component component, Service service,
-                                     Binding binding, Map<QName, List<String>> defaultBindings, Monitor monitor)
-        throws CompositeBuilderException{
+    /**
+     * URI construction for component bindings based on Assembly Specification section 1.7.2. This method
+     * calculates the component URI part based on component information before calling the generic
+     * constructBindingURI method
+     *
+     * @param component the component that holds the service
+     * @param service the service that holds the binding
+     * @param binding the binding for which the URI is being constructed
+     * @param defaultBindings the list of default binding configurations
+     */
+    private void constructBindingURI(Component component,
+                                     Service service,
+                                     Binding binding,
+                                     Map<QName, List<String>> defaultBindings,
+                                     Monitor monitor) throws CompositeBuilderException {
         boolean includeBindingName = component.getServices().size() != 1;
         constructBindingURI(component.getURI(), service, binding, includeBindingName, defaultBindings, monitor);
     }
@@ -382,18 +383,21 @@
      * @param defaultBindings the list of default binding configurations
      * @throws CompositeBuilderException
      */
-    private void constructBindingURI(String componentURIString, Service service, Binding binding,
-                                     boolean includeBindingName, Map<QName, List<String>> defaultBindings, Monitor monitor)
-        throws CompositeBuilderException{
+    private void constructBindingURI(String componentURIString,
+                                     Service service,
+                                     Binding binding,
+                                     boolean includeBindingName,
+                                     Map<QName, List<String>> defaultBindings,
+                                     Monitor monitor) throws CompositeBuilderException {
 
         try {
             // calculate the service binding URI
             URI bindingURI;
-            if (binding.getURI() != null){
+            if (binding.getURI() != null) {
                 bindingURI = new URI(binding.getURI());
 
                 // if the user has provided an absolute binding URI then use it
-                if (bindingURI.isAbsolute()){
+                if (bindingURI.isAbsolute()) {
                     binding.setURI(bindingURI.toString());
                     return;
                 }
@@ -419,8 +423,13 @@
             }
 
             // if the user has provided an absolute component URI then use it
-            if (componentURI != null && componentURI.isAbsolute()){
-                binding.setURI(constructBindingURI(null, componentURI, bindingURI, serviceName, includeBindingName, bindingName));
+            if (componentURI != null && componentURI.isAbsolute()) {
+                binding.setURI(constructBindingURI(null,
+                                                   componentURI,
+                                                   bindingURI,
+                                                   serviceName,
+                                                   includeBindingName,
+                                                   bindingName));
                 return;
             }
 
@@ -433,7 +442,12 @@
                 }
             }
 
-            binding.setURI(constructBindingURI(baseURI, componentURI, bindingURI, serviceName, includeBindingName, bindingName));
+            binding.setURI(constructBindingURI(baseURI,
+                                               componentURI,
+                                               bindingURI,
+                                               serviceName,
+                                               includeBindingName,
+                                               bindingName));
         } catch (URISyntaxException ex) {
             error(monitor, "URLSyntaxException", binding, componentURIString, service.getName(), binding.getName());
         }
@@ -447,8 +461,8 @@
      * @param path the path string to which the "/" is to be added
      * @return the resulting path with a "/" added if it not already there
      */
-    private static String addSlashToPath(String path){
-        if (path.endsWith("/") || path.endsWith("#")){
+    private static String addSlashToPath(String path) {
+        if (path.endsWith("/") || path.endsWith("#")) {
             return path;
         } else {
             return path + "/";
@@ -475,14 +489,14 @@
         String uriString;
 
         if (baseURI == null) {
-            if (componentURI == null){
-                if (bindingURI != null ) {
+            if (componentURI == null) {
+                if (bindingURI != null) {
                     uriString = bindingURI.toString();
                 } else {
                     uriString = name;
                 }
             } else {
-                if (bindingURI != null ) {
+                if (bindingURI != null) {
                     uriString = componentURI.resolve(bindingURI).toString();
                 } else {
                     uriString = componentURI.resolve(name).toString();
@@ -490,13 +504,13 @@
             }
         } else {
             if (componentURI == null) {
-                if (bindingURI != null ) {
+                if (bindingURI != null) {
                     uriString = basedURI(baseURI, bindingURI).toString();
                 } else {
                     uriString = basedURI(baseURI, URI.create(name)).toString();
                 }
             } else {
-                if (bindingURI != null ) {
+                if (bindingURI != null) {
                     uriString = basedURI(baseURI, componentURI.resolve(bindingURI)).toString();
                 } else {
                     uriString = basedURI(baseURI, componentURI.resolve(name)).toString();
@@ -505,8 +519,8 @@
         }
 
         // tidy up by removing any trailing "/"
-        if (uriString.endsWith("/")){
-            uriString = uriString.substring(0, uriString.length()-1);
+        if (uriString.endsWith("/")) {
+            uriString = uriString.substring(0, uriString.length() - 1);
         }
 
         URI uri = URI.create(uriString);

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -62,21 +62,18 @@
     private CompositeBuilder compositePolicyBuilder;
     private CompositeBuilder componentServiceBindingBuilder;
     private CompositeBuilder componentReferenceBindingBuilder;
-    
+
     private CompositeBuilder componentReferenceEndpointReferenceBuilder;
     private CompositeBuilder componentServiceEndpointBuilder;
+
     //private CompositeBuilder endpointReferenceBuilder;
-    
+
     public CompositeBuilderImpl(FactoryExtensionPoint factories, InterfaceContractMapper mapper) {
-        this(factories.getFactory(AssemblyFactory.class),
-               factories.getFactory(SCABindingFactory.class),
-               factories.getFactory(PolicyFactory.class),
-               factories.getFactory(DocumentBuilderFactory.class),
-               factories.getFactory(TransformerFactory.class),
-               mapper);
+        this(factories.getFactory(AssemblyFactory.class), factories.getFactory(SCABindingFactory.class), factories
+            .getFactory(PolicyFactory.class), factories.getFactory(DocumentBuilderFactory.class), factories
+            .getFactory(TransformerFactory.class), mapper);
     }
 
-        
     /**
      * Constructs a new composite builder.
      * 
@@ -91,12 +88,11 @@
     @Deprecated
     public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
                                 SCABindingFactory scaBindingFactory,
-                                PolicyFactory  intentAttachPointTypeFactory,
+                                PolicyFactory intentAttachPointTypeFactory,
                                 InterfaceContractMapper interfaceContractMapper) {
-        this(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory,
-             null, null, interfaceContractMapper);
+        this(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, null, null, interfaceContractMapper);
     }
-          
+
     /**
      * Constructs a new composite builder.
      * 
@@ -110,30 +106,34 @@
      */
     public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
                                 SCABindingFactory scaBindingFactory,
-                                PolicyFactory  intentAttachPointTypeFactory,
+                                PolicyFactory intentAttachPointTypeFactory,
                                 DocumentBuilderFactory documentBuilderFactory,
                                 TransformerFactory transformerFactory,
                                 InterfaceContractMapper interfaceContractMapper) {
-           
-        
-        compositeIncludeBuilder = new CompositeIncludeBuilderImpl(assemblyFactory); 
+
+        compositeIncludeBuilder = new CompositeIncludeBuilderImpl(assemblyFactory);
         componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, interfaceContractMapper);
         //componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory);
         componentReferencePromotionBuilder = new ComponentReferencePromotionBuilderImpl(assemblyFactory);
         //compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory);
         compositeCloneBuilder = new CompositeCloneBuilderImpl();
-        componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper);
+        componentConfigurationBuilder =
+            new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory,
+                                                  transformerFactory, interfaceContractMapper);
         compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory);
         compositeReferenceConfigurationBuilder = new CompositeReferenceConfigurationBuilderImpl(assemblyFactory);
-        compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper);
+        compositeBindingURIBuilder =
+            new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory,
+                                               transformerFactory, interfaceContractMapper);
         //componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory);
         //compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory);
         compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, interfaceContractMapper);
         compositePolicyBuilder = new CompositePolicyBuilderImpl(assemblyFactory, interfaceContractMapper);
         componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl();
         componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl();
-        
-        componentReferenceEndpointReferenceBuilder = new ComponentReferenceEndpointReferenceBuilderImpl(assemblyFactory, interfaceContractMapper);
+
+        componentReferenceEndpointReferenceBuilder =
+            new ComponentReferenceEndpointReferenceBuilderImpl(assemblyFactory, interfaceContractMapper);
         componentServiceEndpointBuilder = new ComponentServiceEndpointBuilderImpl(assemblyFactory);
         //endpointReferenceBuilder = new EndpointReference2BuilderImpl(assemblyFactory, interfaceContractMapper);
     }
@@ -141,85 +141,88 @@
     public String getID() {
         return "org.apache.tuscany.sca.assembly.builder.CompositeBuilder";
     }
-    
+
     public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
-    	build(composite, definitions, null, monitor);
+        build(composite, definitions, null, monitor);
     }
-    
-    public void build(Composite composite, Definitions definitions, Map<QName, List<String>> bindingBaseURIs, Monitor monitor) throws CompositeBuilderException {
 
-    	try {
-	    	// Collect and fuse includes
-	        compositeIncludeBuilder.build(composite, definitions, monitor);
-	
-	        // Expand nested composites
-	        compositeCloneBuilder.build(composite, definitions, monitor);
-	
-	        // Configure all components
-	        componentConfigurationBuilder.build(composite, definitions, monitor);
-	
-	        // Connect composite services/references to promoted services/references
-	        compositePromotionBuilder.build(composite, definitions, monitor);
-	
-	        // Configure composite services by copying bindings up the promotion
-	        // hierarchy overwriting automatic bindings with those added manually
-	        compositeServiceConfigurationBuilder.build(composite, definitions, monitor);
-	        
-	        // Configure composite references by copying bindings down promotion
-	        // hierarchy overwriting automatic bindings with those added manually
-	        compositeReferenceConfigurationBuilder.build(composite, definitions, monitor);
-	
-	        // Configure service binding URIs and names. Creates an SCA defined URI based
-	        // on the scheme base URI, the component name and the binding name
-	        ((CompositeBuilderTmp)compositeBindingURIBuilder).build(composite, definitions, bindingBaseURIs, monitor);
-	
-	        // Create $promoted$ component services on bottom level components
-	        // to represent promoted services
-	        // TODO - EPR replaced by endpoints on the promoted services
-	        //componentServicePromotionBuilder.build(composite, definitions, monitor);
-
-	        // Create $promoted$ component services on bottom level components
-	        // to represent promoted composite services
-	        // TODO - EPR OASIS doesn't deploy top level composite services
-	        //        if it did it would be replaced by endpoints
-	        //compositeServicePromotionBuilder.build(composite, definitions, monitor);
-	
-	        // Perform and service binding related build activities. The binding
-	        // will provide the builder. 
-	        componentServiceBindingBuilder.build(composite, definitions, monitor);
-	
-	        // create endpoints on component services. 
-	        componentServiceEndpointBuilder.build(composite, definitions, monitor);
-	        
-	        // Apply any wires in the composite to create new component reference targets
-	        componentReferenceWireBuilder.build(composite, definitions, monitor);
-	        
-	        // create reference endpoint reference models
-	        componentReferenceEndpointReferenceBuilder.build(composite, definitions, monitor);
-	        
-	        // Push down configuration from promoted references to the 
-	        // references they promote
-	        componentReferencePromotionBuilder.build(composite, definitions, monitor);
-	
-	        // Push down configuration from promoted references to the 
-	        // references they promote
-	        // TODO - EPR Seems to be a repeat of compositeReferenceConfigurationBuilder
-	        // componentReferencePromotionWireBuilder.build(composite, definitions, monitor);
-	
-	        // Wire the composite references
-	        // TODO - EPR OASIS doesn't deploy top level composite references
-	        // compositeReferenceWireBuilder.build(composite, definitions, monitor);
-	
-	        // Perform and reference binding related build activities. The binding
-	        // will provide the builder.
-	        componentReferenceBindingBuilder.build(composite, definitions, monitor);
-	        
-	        // Compute the policies across the model hierarchy
-	        compositePolicyBuilder.build(composite, definitions, monitor);
-    	} catch (Exception e) {
-    		throw new CompositeBuilderException("Exception while building composite " + composite.getName(), e);
-    	} // end try
-    	
+    public void build(Composite composite,
+                      Definitions definitions,
+                      Map<QName, List<String>> bindingBaseURIs,
+                      Monitor monitor) throws CompositeBuilderException {
+
+        try {
+            // Collect and fuse includes
+            compositeIncludeBuilder.build(composite, definitions, monitor);
+
+            // Expand nested composites
+            compositeCloneBuilder.build(composite, definitions, monitor);
+
+            // Configure all components
+            componentConfigurationBuilder.build(composite, definitions, monitor);
+
+            // Connect composite services/references to promoted services/references
+            compositePromotionBuilder.build(composite, definitions, monitor);
+
+            // Configure composite services by copying bindings up the promotion
+            // hierarchy overwriting automatic bindings with those added manually
+            compositeServiceConfigurationBuilder.build(composite, definitions, monitor);
+
+            // Configure composite references by copying bindings down promotion
+            // hierarchy overwriting automatic bindings with those added manually
+            compositeReferenceConfigurationBuilder.build(composite, definitions, monitor);
+
+            // Configure service binding URIs and names. Creates an SCA defined URI based
+            // on the scheme base URI, the component name and the binding name
+            ((CompositeBuilderTmp)compositeBindingURIBuilder).build(composite, definitions, bindingBaseURIs, monitor);
+
+            // Create $promoted$ component services on bottom level components
+            // to represent promoted services
+            // TODO - EPR replaced by endpoints on the promoted services
+            //componentServicePromotionBuilder.build(composite, definitions, monitor);
+
+            // Create $promoted$ component services on bottom level components
+            // to represent promoted composite services
+            // TODO - EPR OASIS doesn't deploy top level composite services
+            //        if it did it would be replaced by endpoints
+            //compositeServicePromotionBuilder.build(composite, definitions, monitor);
+
+            // Perform and service binding related build activities. The binding
+            // will provide the builder. 
+            componentServiceBindingBuilder.build(composite, definitions, monitor);
+
+            // create endpoints on component services. 
+            componentServiceEndpointBuilder.build(composite, definitions, monitor);
+
+            // Apply any wires in the composite to create new component reference targets
+            componentReferenceWireBuilder.build(composite, definitions, monitor);
+
+            // create reference endpoint reference models
+            componentReferenceEndpointReferenceBuilder.build(composite, definitions, monitor);
+
+            // Push down configuration from promoted references to the 
+            // references they promote
+            componentReferencePromotionBuilder.build(composite, definitions, monitor);
+
+            // Push down configuration from promoted references to the 
+            // references they promote
+            // TODO - EPR Seems to be a repeat of compositeReferenceConfigurationBuilder
+            // componentReferencePromotionWireBuilder.build(composite, definitions, monitor);
+
+            // Wire the composite references
+            // TODO - EPR OASIS doesn't deploy top level composite references
+            // compositeReferenceWireBuilder.build(composite, definitions, monitor);
+
+            // Perform and reference binding related build activities. The binding
+            // will provide the builder.
+            componentReferenceBindingBuilder.build(composite, definitions, monitor);
+
+            // Compute the policies across the model hierarchy
+            compositePolicyBuilder.build(composite, definitions, monitor);
+        } catch (Exception e) {
+            throw new CompositeBuilderException("Exception while building composite " + composite.getName(), e);
+        } // end try
+
     } // end method build
 
 } //end class

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -37,10 +37,10 @@
  * @version $Rev$ $Date$
  */
 public class CompositeCloneBuilderImpl implements CompositeBuilder {
-    
+
     public CompositeCloneBuilderImpl() {
     }
-    
+
     public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
         expandCompositeImplementations(composite);
     }
@@ -59,7 +59,7 @@
         for (Component component : composite.getComponents()) {
             Implementation implementation = component.getImplementation();
             if (implementation instanceof Composite) {
-    
+
                 Composite compositeImplementation = (Composite)implementation;
                 Composite clone;
                 try {
@@ -96,21 +96,21 @@
      * @param composite
      */
     private void fuseCompositeImplementations(Composite composite) {
-    
+
         // First collect all nested composites
         List<Composite> nested = new ArrayList<Composite>();
         collectNestedComposites(composite, nested);
-    
+
         // Then add all the non-composite components they contain 
         for (Composite nestedComposite : nested) {
-            for (Component component: nestedComposite.getComponents()) {
+            for (Component component : nestedComposite.getComponents()) {
                 Implementation implementation = component.getImplementation();
                 if (!(implementation instanceof Composite)) {
                     composite.getComponents().add(component);
                 }
             }
         }
-    
+
         // Clear the initial list of composite components
         for (Iterator<Component> i = composite.getComponents().iterator(); i.hasNext();) {
             Component component = i.next();

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java?rev=791550&r1=791549&r2=791550&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java Mon Jul  6 17:39:44 2009
@@ -19,9 +19,7 @@
 
 package org.apache.tuscany.sca.assembly.builder.impl;
 
-import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
@@ -29,9 +27,7 @@
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
 import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.definitions.Definitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.Problem;
 import org.apache.tuscany.sca.monitor.Problem.Severity;
@@ -42,13 +38,13 @@
  * @version $Rev$ $Date$
  */
 public class CompositeIncludeBuilderImpl implements CompositeBuilder {
-    
+
     private AssemblyFactory assemblyFactory;
-        
+
     public CompositeIncludeBuilderImpl(AssemblyFactory assemblyFactory) {
         this.assemblyFactory = assemblyFactory;
     }
-            
+
     public String getID() {
         return "org.apache.tuscany.sca.assembly.builder.CompositeIncludeBuilder";
     }
@@ -58,8 +54,14 @@
     }
 
     private void warning(Monitor monitor, String message, Object model, String... messageParameters) {
-        if (monitor != null){
-            Problem problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+        if (monitor != null) {
+            Problem problem =
+                monitor.createProblem(this.getClass().getName(),
+                                      "assembly-validation-messages",
+                                      Severity.WARNING,
+                                      model,
+                                      message,
+                                      (Object[])messageParameters);
             monitor.problem(problem);
         }
     }
@@ -70,10 +72,10 @@
      * @param composite
      */
     private void fuseIncludes(Composite composite, Monitor monitor) {
-        
+
         Set<Composite> visited = new HashSet<Composite>();
         visited.add(composite);
-        
+
         for (Composite included : composite.getIncludes()) {
             Composite fusedComposite = fuseInclude(included, visited, monitor);
             if (fusedComposite != null) {
@@ -86,30 +88,28 @@
                 composite.getRequiredIntents().addAll(fusedComposite.getRequiredIntents());
             }
         }
-        
+
         // Clear the list of includes as all of the included components 
         // have now been added into the top level composite
         composite.getIncludes().clear();
     }
-    
-    private Composite fuseInclude(Composite include,
-                                  Set<Composite> visited, 
-                                  Monitor monitor) {
-        
+
+    private Composite fuseInclude(Composite include, Set<Composite> visited, Monitor monitor) {
+
         if (visited.contains(include)) {
             warning(monitor, "CompositeAlreadyIncluded", include, include.getName().toString());
             return null;
         }
-        
+
         visited.add(include);
-        
+
         Composite clone;
         try {
             clone = (Composite)include.clone();
         } catch (CloneNotSupportedException e) {
             throw new RuntimeException(e);
         }
-        
+
         // get the components etc. from any included composites
         for (Composite included : include.getIncludes()) {
             Composite fusedComposite = fuseInclude(included, visited, monitor);
@@ -123,17 +123,17 @@
                 clone.getRequiredIntents().addAll(fusedComposite.getRequiredIntents());
             }
         }
-        
+
         // apply the autowire flag on this composite to any inline 
         // components - Assembly 5.6 point 4
-        if (include.getAutowire() == Boolean.TRUE){
-            for ( Component component : clone.getComponents()){
-                if (component.getAutowire() == null){
+        if (include.getAutowire() == Boolean.TRUE) {
+            for (Component component : clone.getComponents()) {
+                if (component.getAutowire() == null) {
                     component.setAutowire(true);
                 }
             }
         }
-        
+
         // return the fused composite we have built up so far
         return clone;
     }