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/09/24 21:02:30 UTC

svn commit: r818590 [2/3] - /tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java?rev=818590&r1=818589&r2=818590&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java Thu Sep 24 19:02:28 2009
@@ -70,7 +70,8 @@
      *
      * @param composite
      */
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         this.monitor = monitor;
 
         // process component services
@@ -85,58 +86,67 @@
             // index all of the components in the composite
             Map<String, Component> components = new HashMap<String, Component>();
             indexComponents(composite, components);
-    
+
             // index all of the services in the composite
             Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
             indexServices(composite, componentServices);
-    
+
             // create endpoint references for each component's references
             for (Component component : composite.getComponents()) {
                 monitor.pushContext("Component: " + component.getName());
-                
+
                 try {
                     if (useNew) {
                         for (ComponentReference reference : component.getReferences()) {
-                            createReferenceEndpointReferences2(composite, component, reference, components, componentServices);
+                            createReferenceEndpointReferences2(composite,
+                                                               component,
+                                                               reference,
+                                                               components,
+                                                               componentServices);
                         } // end for
                     }
-        
+
                     // recurse for composite implementations
                     Implementation implementation = component.getImplementation();
                     if (implementation instanceof Composite) {
                         processComponentReferences((Composite)implementation);
                     }
-        
+
                     // create endpoint references to represent the component reference
                     for (ComponentReference reference : component.getReferences()) {
-        
+
                         if (!useNew) {
-                            createReferenceEndpointReferences(composite, component, reference, components, componentServices);
+                            createReferenceEndpointReferences(composite,
+                                                              component,
+                                                              reference,
+                                                              components,
+                                                              componentServices);
                         } // end if
-        
+
                         // fix up links between endpoints and endpoint references that represent callbacks
                         for (ComponentService service : component.getServices()) {
                             if ((service.getInterfaceContract() != null) && (service.getInterfaceContract()
                                 .getCallbackInterface() != null)) {
                                 if (reference.getName().equals(service.getName())) {
                                     for (Endpoint endpoint : service.getEndpoints()) {
-                                        endpoint.getCallbackEndpointReferences().addAll(reference.getEndpointReferences());
+                                        endpoint.getCallbackEndpointReferences().addAll(reference
+                                            .getEndpointReferences());
                                     }
                                     break;
                                 } // end if
                             } // end if
                         } // end for
                     } // end for
-                    
+
                     // Validate that references are wired or promoted, according
                     // to their multiplicity   
                     validateReferenceMultiplicity(composite, component);
-                
+
                 } finally {
                     monitor.popContext();
                 }
             } // end for
-        
+
         } finally {
             monitor.popContext();
         }
@@ -148,9 +158,9 @@
                                                    ComponentReference reference,
                                                    Map<String, Component> components,
                                                    Map<String, ComponentService> componentServices) {
-        
+
         monitor.pushContext("Reference: " + reference.getName());
-        
+
         // Get reference targets
         List<ComponentService> refTargets = getReferenceTargets(reference);
         if (reference.getAutowire() == Boolean.TRUE && reference.getTargets().isEmpty()) {
@@ -159,11 +169,11 @@
             // autowired reference
             Multiplicity multiplicity = reference.getMultiplicity();
             for (Component targetComponent : composite.getComponents()) {
-                
+
                 // Tuscany specific selection of the first autowire reference
                 // when there are more than one (ASM_60025)
-                if ((multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) &&
-                    (reference.getEndpointReferences().size() != 0) ) {
+                if ((multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) && (reference
+                    .getEndpointReferences().size() != 0)) {
                     break;
                 }
 
@@ -190,10 +200,10 @@
 
             if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) {
                 if (reference.getEndpointReferences().size() == 0) {
-                    Monitor.error(monitor, 
-                                  this, 
-                                  "assembly-validation-messages", 
-                                  "NoComponentReferenceTarget", 
+                    Monitor.error(monitor,
+                                  this,
+                                  "assembly-validation-messages",
+                                  "NoComponentReferenceTarget",
                                   reference.getName());
                 }
             }
@@ -214,7 +224,7 @@
                 String targetName = getComponentServiceName(target.getName());
                 String bindingName = getBindingName(target.getName());
                 ComponentService targetComponentService = componentServices.get(targetName);
- 
+
                 Component targetComponent = getComponentFromTargetName(components, targetName);
 
                 if (targetComponentService != null) {
@@ -222,52 +232,53 @@
                     if (reference.getInterfaceContract() == null || interfaceContractMapper.isCompatible(reference
                         .getInterfaceContract(), targetComponentService.getInterfaceContract())) {
 
-                        if (bindingName != null){
+                        if (bindingName != null) {
                             // the user has selected a binding as part of the target name
                             Binding targetBinding = null;
-                             
-                            for (Binding tmp : targetComponentService.getBindings()){
-                                if (tmp.getName().equals(bindingName)){
+
+                            for (Binding tmp : targetComponentService.getBindings()) {
+                                if (tmp.getName().equals(bindingName)) {
                                     targetBinding = tmp;
                                     continue;
                                 }
                             }
-                            
-                            if (targetBinding != null){
+
+                            if (targetBinding != null) {
                                 EndpointReference endpointRef = createEndpointRef(component, reference, false);
-                                endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, targetBinding, true));
+                                endpointRef.setTargetEndpoint(createEndpoint(targetComponent,
+                                                                             targetComponentService,
+                                                                             targetBinding,
+                                                                             true));
                                 endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND);
                                 // relying on the registry here to resolve the real endpoint
                                 reference.getEndpointReferences().add(endpointRef);
-                                
+
                             } else {
                                 EndpointReference endpointRef = createEndpointRef(component, reference, true);
                                 endpointRef.setTargetEndpoint(createEndpoint(component, targetName));
                                 endpointRef.setRemote(true);
                                 endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND);
                                 reference.getEndpointReferences().add(endpointRef);
-                                warning(monitor,
-                                        "ComponentReferenceTargetNotFound",
-                                        composite,
-                                        composite.getName().toString(),
-                                        targetName);
+                                warning(monitor, "ComponentReferenceTargetNotFound", composite, composite.getName()
+                                    .toString(), targetName);
                             }
-                            
+
                         } else {
                             // the user hasn't selected a binding as part of the target name
 
                             EndpointReference endpointRef = createEndpointRef(component, reference, false);
-                            endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true));
+                            endpointRef
+                                .setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true));
                             endpointRef.setStatus(EndpointReference.WIRED_TARGET_FOUND_READY_FOR_MATCHING);
                             reference.getEndpointReferences().add(endpointRef);
                         }
                     } else {
                         error(monitor,
-                                "ReferenceIncompatibleInterface",
-                                composite,
-                                composite.getName().toString(),
-                                component.getName() + "." + reference.getName(),
-                                targetName);
+                              "ReferenceIncompatibleInterface",
+                              composite,
+                              composite.getName().toString(),
+                              component.getName() + "." + reference.getName(),
+                              targetName);
                     }
                 } else {
                     // add an unresolved endpoint reference with an unresolved endpoint to go with it
@@ -324,7 +335,7 @@
                 if (uri.startsWith("/")) {
                     uri = uri.substring(1);
                 }
-                
+
                 String targetName = getComponentServiceName(uri);
                 String bindingName = getBindingName(uri);
 
@@ -341,42 +352,44 @@
                     // a superset of the component reference interface
                     if (reference.getInterfaceContract() == null || interfaceContractMapper.isCompatible(reference
                         .getInterfaceContract(), targetComponentService.getInterfaceContract())) {
-                        if (bindingName != null){
+                        if (bindingName != null) {
                             // the user has selected a binding as part of the target name
                             Binding targetBinding = null;
-                             
-                            for (Binding tmp : targetComponentService.getBindings()){
-                                if (tmp.getName().equals(bindingName)){
+
+                            for (Binding tmp : targetComponentService.getBindings()) {
+                                if (tmp.getName().equals(bindingName)) {
                                     targetBinding = tmp;
                                     continue;
                                 }
                             }
-                            
-                            if (targetBinding != null){
+
+                            if (targetBinding != null) {
                                 EndpointReference endpointRef = createEndpointRef(component, reference, false);
-                                endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, targetBinding, true));
+                                endpointRef.setTargetEndpoint(createEndpoint(targetComponent,
+                                                                             targetComponentService,
+                                                                             targetBinding,
+                                                                             true));
                                 endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND);
                                 // relying on the registry here to resolve the real endpoint
                                 reference.getEndpointReferences().add(endpointRef);
-                                
+
                             } else {
                                 EndpointReference endpointRef = createEndpointRef(component, reference, true);
                                 endpointRef.setTargetEndpoint(createEndpoint(component, targetName));
                                 endpointRef.setRemote(true);
                                 endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND);
                                 reference.getEndpointReferences().add(endpointRef);
-                                warning(monitor,
-                                        "ComponentReferenceTargetNotFound",
-                                        composite,
-                                        composite.getName().toString(),
-                                        targetName);
+                                warning(monitor, "ComponentReferenceTargetNotFound", composite, composite.getName()
+                                    .toString(), targetName);
                             }
-                            
+
                         } else {
                             // create endpoint reference with dummy endpoint which will be replaced when policies
                             // are matched and bindings are configured later
-                            EndpointReference endpointRef = createEndpointRef(component, reference, binding, null, false);
-                            endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true));
+                            EndpointReference endpointRef =
+                                createEndpointRef(component, reference, binding, null, false);
+                            endpointRef
+                                .setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true));
                             endpointRef.setStatus(EndpointReference.WIRED_TARGET_FOUND_READY_FOR_MATCHING);
                             reference.getEndpointReferences().add(endpointRef);
                         }
@@ -402,12 +415,12 @@
                 } // end if
             }
         }
-        
+
         monitor.popContext();
-        
+
     } // end method
-    
-    private void validateReferenceMultiplicity(Composite composite, Component component){
+
+    private void validateReferenceMultiplicity(Composite composite, Component component) {
         for (ComponentReference componentReference : component.getReferences()) {
             if (!ReferenceConfigurationUtil.validateMultiplicityAndTargets(componentReference.getMultiplicity(),
                                                                            componentReference.getEndpointReferences())) {
@@ -430,25 +443,25 @@
                                       composite.getName().toString(),
                                       componentReference.getName());
                     }
-                } else {             
+                } else {
                     // no error if reference is autowire and more targets
                     // than multiplicity have been found 
-                    if (componentReference.getAutowire() == Boolean.TRUE){
+                    if (componentReference.getAutowire() == Boolean.TRUE) {
                         break;
                     }
-                    
+
                     // TUSCANY-3132  first example of updated error handling                  
                     Monitor.error(monitor,
                                   this,
                                   "assembly-validation-messages",
-                                  "TooManyReferenceTargets", 
-                                  componentReference.getName());                  
+                                  "TooManyReferenceTargets",
+                                  componentReference.getName());
                 }
             }
         }
 
     }
-    
+
     /**
      * Create Endpoint References for a component reference inside a given composite
      * @param composite - the composite
@@ -982,7 +995,7 @@
         } // end if
         return theTargets;
     } // end method getReferenceTargets
-    
+
     /**
      * Target names can take the form 
      *   component/service/binding
@@ -993,14 +1006,14 @@
      */
     private String getComponentServiceName(String targetName) {
         String[] parts = targetName.split("/");
-        
-        if (parts.length > 1){
+
+        if (parts.length > 1) {
             return parts[0] + "/" + parts[1];
         } else {
             return parts[0];
         }
-    } 
-    
+    }
+
     /**
      * Target names can take the form 
      *   component/service/binding
@@ -1012,13 +1025,13 @@
      */
     private String getBindingName(String targetName) {
         String[] parts = targetName.split("/");
-        
-        if (parts.length == 3){
+
+        if (parts.length == 3) {
             return parts[2];
         } else {
             return null;
         }
-    } 
+    }
 
     /**
      * Helper method that finds the Component given a target name
@@ -1086,7 +1099,7 @@
         endpoint.setUnresolved(unresolved);
         return endpoint;
     } // end method createEndpoint
-    
+
     /**
      * Helper method to create an endpoint
      * @param component
@@ -1170,26 +1183,27 @@
      * declares a single target service,  the reference is wired only to 
      * the single service identified by the <wire/> element
      */
-	private void setSingleAutoWireTarget(ComponentReference reference) {
-        if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null && reference.getBindings().size() == 1) {
-    		String uri = reference.getBindings().get(0).getURI();
-    		if (uri != null) {
-        		if (uri.indexOf('/') > -1) {
-        			// TODO: must be a way to avoid this fiddling
-        			int i = uri.indexOf('/');
-        			String c = uri.substring(0, i);
-        			String s = uri.substring(i+1);
-        			uri = c + "#service(" + s + ")";
-        		}
-    			for (EndpointReference er : reference.getEndpointReferences()) {
-    				if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) {
-    					reference.getEndpointReferences().clear();
-    					reference.getEndpointReferences().add(er);
-    					return;
-    				}
-    			}
-    		}
+    private void setSingleAutoWireTarget(ComponentReference reference) {
+        if (reference.getEndpointReferences().size() > 1 && reference.getBindings() != null
+            && reference.getBindings().size() == 1) {
+            String uri = reference.getBindings().get(0).getURI();
+            if (uri != null) {
+                if (uri.indexOf('/') > -1) {
+                    // TODO: must be a way to avoid this fiddling
+                    int i = uri.indexOf('/');
+                    String c = uri.substring(0, i);
+                    String s = uri.substring(i + 1);
+                    uri = c + "#service(" + s + ")";
+                }
+                for (EndpointReference er : reference.getEndpointReferences()) {
+                    if (er.getTargetEndpoint() != null && uri.equals(er.getTargetEndpoint().getURI())) {
+                        reference.getEndpointReferences().clear();
+                        reference.getEndpointReferences().add(er);
+                        return;
+                    }
+                }
+            }
         }
-	}
-    
+    }
+
 } // end class

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -49,7 +49,8 @@
         this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         configureNestedCompositeReferences(composite, monitor);
         return composite;
     }

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -46,7 +46,8 @@
         this.assemblyFactory = assemblyFactory;
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         wireCompositeReferences(composite, monitor);
         return composite;
     }

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -50,7 +50,8 @@
         return "org.apache.tuscany.sca.assembly.builder.ComponentReferenceWireBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         wireComponentReferences(composite, monitor);
         return composite;
     }
@@ -64,37 +65,36 @@
     protected void wireComponentReferences(Composite composite, Monitor monitor) {
 
         monitor.pushContext(composite.getName().toString());
-        
+
         try {
             // Wire nested composites recursively
             for (Component component : composite.getComponents()) {
                 Implementation implementation = component.getImplementation();
                 if (implementation instanceof Composite) {
-    
-                        wireComponentReferences((Composite)implementation, monitor);
-                           
+
+                    wireComponentReferences((Composite)implementation, monitor);
+
                 }
             }
-    
+
             // Index components, services and references
             Map<String, Component> components = new HashMap<String, Component>();
             Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
             Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
             indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
-    
+
             // Connect component references as described in wires
             connectWires(composite, componentServices, componentReferences, monitor);
-    
-    
+
             // Finally clear the original reference target lists as we now have
             // bindings to represent the targets
             //  for (ComponentReference componentReference : componentReferences.values()) {
             //      componentReference.getTargets().clear();
             //  }
-        
+
         } finally {
             monitor.popContext();
-        }         
+        }
 
     }
 
@@ -156,9 +156,9 @@
                     .isCompatible(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) {
 
                     //resolvedReference.getTargets().add(resolvedService);
-                	if (wire.isReplace()) {
-                		resolvedReference.getTargets().clear();
-                	}
+                    if (wire.isReplace()) {
+                        resolvedReference.getTargets().clear();
+                    }
                     resolvedReference.getTargets().add(wire.getTarget());
                 } else {
                     warning(monitor, "WireIncompatibleInterface", composite, source.getName(), target.getName());

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -40,7 +40,7 @@
  */
 public class ComponentServiceBindingBuilderImpl implements CompositeBuilder {
     private BuilderExtensionPoint builders;
-    
+
     public ComponentServiceBindingBuilderImpl(ExtensionPointRegistry registry) {
         this.builders = registry.getExtensionPoint(BuilderExtensionPoint.class);
     }
@@ -49,7 +49,8 @@
         return "org.apache.tuscany.sca.assembly.builder.ComponentServiceBindingBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         buildServiceBindings(composite, monitor);
         return composite;
     }

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -66,7 +66,8 @@
      * @param definitions
      * @param monitor - a Monitor for logging errors
      */
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
 
         // process component services
         if (!useNew) {

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -47,7 +47,8 @@
         return "org.apache.tuscany.sca.assembly.builder.ComponentServicePromotionBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
 
         // Process nested composites recursively
         configureNestedCompositeServices(composite);

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -49,7 +49,8 @@
         return "org.apache.tuscany.sca.assembly.builder.CompositeServiceBindingBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         List<Binding> defaultBindings = null;
         for (Object x : composite.getExtensions()) {
             if (x instanceof List) {

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -50,7 +50,8 @@
  *
  * @version $Rev$ $Date$
  */
-public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements CompositeBuilder, DeployedCompositeBuilder {
+public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements CompositeBuilder,
+    DeployedCompositeBuilder {
 
     public CompositeBindingURIBuilderImpl(ExtensionPointRegistry registry) {
         super(registry);
@@ -60,15 +61,16 @@
         return "org.apache.tuscany.sca.assembly.builder.CompositeBindingURIBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         configureBindingURIsAndNames(composite, definitions, monitor);
         return composite;
     }
 
     public Composite build(Composite composite,
-                      Definitions definitions,
-                      Map<QName, List<String>> bindingBaseURIs,
-                      Monitor monitor) throws CompositeBuilderException {
+                           Definitions definitions,
+                           Map<QName, List<String>> bindingBaseURIs,
+                           Monitor monitor) throws CompositeBuilderException {
         configureBindingURIs(composite, null, definitions, bindingBaseURIs, monitor);
         configureBindingNames(composite, monitor);
         return composite;
@@ -125,14 +127,14 @@
                                       Definitions definitions,
                                       Map<QName, List<String>> defaultBindings,
                                       Monitor monitor) throws CompositeBuilderException {
-        
+
         String parentComponentURI = uri;
-        
+
         monitor.pushContext("Composite: " + composite.getName().toString());
-        try {        
+        try {
             // Process nested composites recursively
             for (Component component : composite.getComponents()) {
-    
+
                 // Initialize component URI
                 String componentURI;
                 if (parentComponentURI == null) {
@@ -141,42 +143,46 @@
                     componentURI = URI.create(parentComponentURI + '/').resolve(component.getName()).toString();
                 }
                 component.setURI(componentURI);
-    
+
                 Implementation implementation = component.getImplementation();
                 if (implementation instanceof Composite) {
                     // Process nested composite
-                    configureBindingURIs((Composite)implementation, componentURI, definitions, defaultBindings, monitor);  
+                    configureBindingURIs((Composite)implementation, componentURI, definitions, defaultBindings, monitor);
                 }
             }
-    
+
             // Initialize composite service binding URIs
             List<Service> compositeServices = composite.getServices();
             for (Service service : compositeServices) {
                 // Set default binding names
-    
+
                 // Create default SCA binding
                 attachSCABinding(service, definitions);
-    
+
                 constructBindingNames(service, monitor);
-                
+
                 // Initialize binding names and URIs
                 for (Binding binding : service.getBindings()) {
                     constructBindingURI(parentComponentURI, composite, service, binding, defaultBindings, monitor);
                 }
             }
-    
+
             // Initialize component service binding URIs
             for (Component component : composite.getComponents()) {
-                
+
                 monitor.pushContext("Component: " + component.getName());
-                
+
                 try {
                     // Index properties, services and references
                     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>();
@@ -187,7 +193,7 @@
                                                                   componentReferences,
                                                                   componentProperties,
                                                                   monitor);
-        
+
                     // Reconcile component services/references/properties and
                     // implementation services/references and create component
                     // services/references/properties for the services/references
@@ -195,14 +201,14 @@
                     reconcileServices(component, services, componentServices, monitor);
                     reconcileReferences(component, references, componentReferences, monitor);
                     reconcileProperties(component, properties, componentProperties, monitor);
-        
+
                     for (ComponentService service : component.getServices()) {
-        
+
                         // Create default SCA binding
                         attachSCABinding(service, definitions);
-        
+
                         constructBindingNames(service, monitor);
-                        
+
                         // Initialize binding names and URIs
                         for (Binding binding : service.getBindings()) {
                             constructBindingURI(component, service, binding, defaultBindings, monitor);
@@ -214,7 +220,7 @@
             }
         } finally {
             monitor.popContext();
-        }         
+        }
     }
 
     /**
@@ -283,7 +289,7 @@
                     : "MultipleBindingsForReference", binding, contract.getName(), binding.getName());
             }
         }
-        
+
         if (contract.getCallback() != null) {
             bindings = contract.getCallback().getBindings();
             bindingMap.clear();
@@ -361,9 +367,9 @@
                                      Monitor monitor) throws CompositeBuilderException {
 
         try {
-            
+
             boolean includeBindingName = !service.getName().equals(binding.getName());
-            
+
             // calculate the service binding URI
             URI bindingURI;
             if (binding.getURI() != null) {

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -64,7 +64,6 @@
     private CompositeBuilder componentServiceEndpointBuilder;
 
     private BuilderExtensionPoint builders;
-    
 
     /**
      * Constructs a new composite builder.
@@ -72,23 +71,21 @@
      *  @param registry
      */
     public CompositeBuilderImpl(ExtensionPointRegistry registry) {
-        
+
         FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
         this.builders = registry.getExtensionPoint(BuilderExtensionPoint.class);
         AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
- 
+
         compositeIncludeBuilder = new CompositeIncludeBuilderImpl();
         componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(registry);
         //componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory);
         componentReferencePromotionBuilder = new ComponentReferencePromotionBuilderImpl(registry);
         //compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory);
         compositeCloneBuilder = new CompositeCloneBuilderImpl();
-        componentConfigurationBuilder =
-            new ComponentConfigurationBuilderImpl(registry);
+        componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(registry);
         compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(registry);
         compositeReferenceConfigurationBuilder = new CompositeReferenceConfigurationBuilderImpl(registry);
-        compositeBindingURIBuilder =
-            new CompositeBindingURIBuilderImpl(registry);
+        compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(registry);
         //componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory);
         //compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory);
         compositePromotionBuilder = new CompositePromotionBuilderImpl(registry);
@@ -96,8 +93,7 @@
         componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl(registry);
         componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl(registry);
 
-        componentReferenceEndpointReferenceBuilder =
-            new ComponentReferenceEndpointReferenceBuilderImpl(registry);
+        componentReferenceEndpointReferenceBuilder = new ComponentReferenceEndpointReferenceBuilderImpl(registry);
         componentServiceEndpointBuilder = new ComponentServiceEndpointBuilderImpl(assemblyFactory);
         //endpointReferenceBuilder = new EndpointReference2BuilderImpl(assemblyFactory, interfaceContractMapper);
     }
@@ -106,18 +102,19 @@
         return "org.apache.tuscany.sca.assembly.builder.CompositeBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         build(composite, definitions, null, monitor);
         return composite;
     }
 
     public Composite build(Composite composite,
-                      Definitions definitions,
-                      Map<QName, List<String>> bindingBaseURIs,
-                      Monitor monitor) throws CompositeBuilderException {
+                           Definitions definitions,
+                           Map<QName, List<String>> bindingBaseURIs,
+                           Monitor monitor) throws CompositeBuilderException {
 
         try {
-    		
+
             // Collect and fuse includes
             composite = compositeIncludeBuilder.build(composite, definitions, monitor);
 
@@ -140,7 +137,11 @@
 
             // Configure service binding URIs and names. Creates an SCA defined URI based
             // on the scheme base URI, the component name and the binding name
-            composite = ((DeployedCompositeBuilder)compositeBindingURIBuilder).build(composite, definitions, bindingBaseURIs, monitor);
+            composite =
+                ((DeployedCompositeBuilder)compositeBindingURIBuilder).build(composite,
+                                                                             definitions,
+                                                                             bindingBaseURIs,
+                                                                             monitor);
 
             // Create $promoted$ component services on bottom level components
             // to represent promoted services
@@ -185,11 +186,11 @@
 
             // Compute the policies across the model hierarchy
             composite = compositePolicyBuilder.build(composite, definitions, monitor);
-            
+
             return composite;
         } catch (Exception e) {
             throw new CompositeBuilderException("Exception while building composite " + composite.getName(), e);
-    	} // end try
+        } // end try
 
     } // end method build
 

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -41,7 +41,8 @@
     public CompositeCloneBuilderImpl() {
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         expandCompositeImplementations(composite);
         return composite;
     }

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeComponentTypeBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeComponentTypeBuilderImpl.java?rev=818590&r1=818589&r2=818590&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeComponentTypeBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeComponentTypeBuilderImpl.java Thu Sep 24 19:02:28 2009
@@ -60,11 +60,11 @@
 
 public class CompositeComponentTypeBuilderImpl {
     private static final Logger logger = Logger.getLogger(CompositeComponentTypeBuilderImpl.class.getName());
-    
+
     protected static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903";
     protected static final String BINDING_SCA = "binding.sca";
-    protected static final QName BINDING_SCA_QNAME = new QName(SCA11_NS, BINDING_SCA);    
-    
+    protected static final QName BINDING_SCA_QNAME = new QName(SCA11_NS, BINDING_SCA);
+
     private ComponentBuilderImpl componentBuilder;
     private Monitor monitor;
     private AssemblyFactory assemblyFactory;
@@ -72,21 +72,20 @@
     private InterfaceContractMapper interfaceContractMapper;
     private BuilderExtensionPoint builders;
 
-
-    public CompositeComponentTypeBuilderImpl(ExtensionPointRegistry registry){
+    public CompositeComponentTypeBuilderImpl(ExtensionPointRegistry registry) {
         UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
         MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
         monitor = monitorFactory.createMonitor();
-        
+
         FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class);
         assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
-        scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);       
+        scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
 
         interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
         builders = registry.getExtensionPoint(BuilderExtensionPoint.class);
     }
-    
-    public void setComponentBuilder(ComponentBuilderImpl componentBuilder){
+
+    public void setComponentBuilder(ComponentBuilderImpl componentBuilder) {
         this.componentBuilder = componentBuilder;
     }
 
@@ -96,34 +95,30 @@
      * @param implementation
      * @return component type
      */
-    public void createComponentType(Implementation implementation){
-        if (!(implementation instanceof Composite)){
+    public void createComponentType(Implementation implementation) {
+        if (!(implementation instanceof Composite)) {
             // component type will have been calculated at resolve time
             return;
         }
-        
+
         // create the composite component type as this was not
         // calculated at resolve time
         Composite composite = (Composite)implementation;
-        
+
         // first make sure that each child component has been properly configured based
         // on its own component type
         for (Component component : composite.getComponents()) {
-            
+
             // Check for duplicate component names
             if (composite.getComponent(component.getName()) == null) {
-                Monitor.error(monitor, 
-                              this, 
-                              "assembly-validation-messages", 
-                              "DuplicateComponentName", 
-                              composite.getName().toString(),
-                              component.getName());
-            } 
-            
+                Monitor.error(monitor, this, "assembly-validation-messages", "DuplicateComponentName", composite
+                    .getName().toString(), component.getName());
+            }
+
             // do any work we need to do before we configure the component
             // Anything that needs to be pushed down the promotion
             // hierarchy must be done before we configure the component
-            
+
             // Push down the autowire flag from the composite to components
             if (component.getAutowire() == null) {
                 component.setAutowire(composite.getAutowire());
@@ -135,29 +130,28 @@
 
         // create the composite component type based on the promoted artifacts
         // from the components that it contains
-        
+
         // index all the components, services and references in the
         // component type so that they are easy to find
         Map<String, Component> components = new HashMap<String, Component>();
         Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
         Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
         indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
-        
+
         // services
         calculateServices(composite, components, componentServices);
-        
+
         // references
         calculateReferences(composite, components, componentReferences);
-        
+
         // properties
         // Properties on the composite component are unaffected by properties 
         // on child components. Instead child component properties might take their
         // values from component properties. Hence there is nothing to do here.
         //calculateProperties(composite, components);
-        
-        
+
     }
-    
+
     /**
      * Index components, services and references inside a composite.
      * 
@@ -208,9 +202,8 @@
                 componentReferences.put(uri, componentReference);
             }
         }
-    }    
-    
-    
+    }
+
     /**
      * Connect the services in the component type to the component services that
      * they promote
@@ -220,34 +213,32 @@
      */
     private void calculateServices(ComponentType componentType,
                                    Map<String, Component> components,
-                                   Map<String, ComponentService> componentServices){
+                                   Map<String, ComponentService> componentServices) {
 
         // Connect this component type's services to the 
         // services from child components which it promotes
-        connectPromotedServices(componentType,
-                                components,
-                                componentServices);
-        
+        connectPromotedServices(componentType, components, componentServices);
+
         // look at each component type service in turn and 
         // calculate its configuration based on OASIS rules
         for (Service service : componentType.getServices()) {
             CompositeService compositeService = (CompositeService)service;
             ComponentService promotedComponentService = compositeService.getPromotedService();
-            
+
             // promote interface contracts
             calculatePromotedInterfaceContract(compositeService, promotedComponentService);
-           
+
             // promote bindings
             calculatePromotedBindings(compositeService, promotedComponentService);
-            
+
             // promote intents - done later in CompositePolicyBuilder - discuss with RF
             // calculatePromotedIntents(compositeService, promotedComponentService);
-            
+
             // promote policy sets - done later in CompositePolicyBuilder - discuss with RF
             // calculatePromotedPolicySets(compositeService, promotedComponentService);
-        }        
+        }
     }
-    
+
     /**
      * Connect the references in the component type to the component references that
      * they promote
@@ -257,39 +248,37 @@
      */
     private void calculateReferences(ComponentType componentType,
                                      Map<String, Component> components,
-                                     Map<String, ComponentReference> componentReferences){
+                                     Map<String, ComponentReference> componentReferences) {
 
         // Connect this component type's references to the 
         // references from child components which it promotes
-        connectPromotedReferences(componentType,
-                                  components,
-                                  componentReferences);
-        
+        connectPromotedReferences(componentType, components, componentReferences);
+
         // look at each component type reference in turn and 
         // calculate its configuration based on OASIS rules
         for (Reference reference : componentType.getReferences()) {
             CompositeReference compositeReference = (CompositeReference)reference;
             List<ComponentReference> promotedReferences = compositeReference.getPromotedReferences();
-            
-            for(ComponentReference promotedComponentReference : promotedReferences){
-                
+
+            for (ComponentReference promotedComponentReference : promotedReferences) {
+
                 // promote interface contracts
                 calculatePromotedInterfaceContract(compositeReference, promotedComponentReference);
-               
+
                 // promote bindings
                 // Don't need to promote reference bindings as any lower level binding will
                 // already be targeting the correct service without need for promotion
                 //calculatePromotedBindings(compositeReference, promotedComponentReference);
-                
+
                 // promote intents - done later in CompositePolicyBuilder - discuss with RF
                 // calculatePromotedIntents(compositeService, promotedComponentService);
-                
+
                 // promote policy sets - done later in CompositePolicyBuilder - discuss with RF
                 // calculatePromotedPolicySets(compositeService, promotedComponentService);
             }
-        }        
-    }  
-    
+        }
+    }
+
     /**
      * Connect the services in the component type to the component services that
      * they promote
@@ -299,7 +288,7 @@
      */
     private void connectPromotedServices(ComponentType componentType,
                                          Map<String, Component> components,
-                                         Map<String, ComponentService> componentServices){
+                                         Map<String, ComponentService> componentServices) {
 
         for (Service service : componentType.getServices()) {
             // Connect composite (component type) services to the component services 
@@ -320,10 +309,10 @@
                 } else {
                     promotedServiceName = promotedComponentName;
                 }
-                
+
                 // find the promoted service
                 ComponentService promotedService = componentServices.get(promotedServiceName);
-                
+
                 if (promotedService != null) {
 
                     // Point to the resolved component
@@ -333,17 +322,17 @@
                     // Point to the resolved component service
                     compositeService.setPromotedService(promotedService);
                 } else {
-                    Monitor.error(monitor, 
-                                  this, 
-                                  "assembly-validation-messages", 
-                                  "PromotedServiceNotFound", 
+                    Monitor.error(monitor,
+                                  this,
+                                  "assembly-validation-messages",
+                                  "PromotedServiceNotFound",
                                   ((Composite)componentType).getName().toString(),
                                   promotedServiceName);
-                }                
+                }
             }
-        }      
-    } 
-    
+        }
+    }
+
     /**
      * Connect the references in the component type to the component references that
      * they promote
@@ -353,8 +342,8 @@
      */
     private void connectPromotedReferences(ComponentType componentType,
                                            Map<String, Component> components,
-                                           Map<String, ComponentReference> componentReferences){
-        
+                                           Map<String, ComponentReference> componentReferences) {
+
         // Connect composite (component type) references to the component references that they promote
         for (Reference reference : componentType.getReferences()) {
             CompositeReference compositeReference = (CompositeReference)reference;
@@ -373,7 +362,7 @@
                         componentReference.setPromoted(true);
 
                         // Point to the resolved component reference
-                        promotedReferences.set(i, componentReference);                        
+                        promotedReferences.set(i, componentReference);
                     } else {
                         Monitor.error(monitor,
                                       this,
@@ -384,9 +373,9 @@
                     }
                 }
             }
-        }        
+        }
     }
-    
+
     /**
      * Create a default SCA binding in the case that no binding
      * is specified by the user
@@ -408,41 +397,39 @@
 
         contract.getBindings().add(scaBinding);
         contract.setOverridingBindings(false);
-    }    
-    
+    }
+
     /**
      * The following methods implement rules that the OASIS specification defined explicitly
      * to control how configuration from a component type is inherited by a component
-     */    
-    
+     */
+
     /**
      * OASIS RULE: Interface contract from higher in the implementation hierarchy takes precedence
      * 
      * @param topContract the top contract 
      * @param bottomContract the bottom contract
-     */   
-    private void calculatePromotedInterfaceContract(Contract topContract,
-                                                    Contract bottomContract) {
+     */
+    private void calculatePromotedInterfaceContract(Contract topContract, Contract bottomContract) {
         // Use the interface contract from the bottom level contract if
         // none is specified on the top level contract
         InterfaceContract topInterfaceContract = topContract.getInterfaceContract();
         InterfaceContract bottomInterfaceContract = bottomContract.getInterfaceContract();
-        
+
         if (topInterfaceContract == null) {
             topContract.setInterfaceContract(bottomInterfaceContract);
         } else if (bottomInterfaceContract != null) {
             // Check that the top and bottom interface contracts are compatible
-            boolean isCompatible = interfaceContractMapper.isCompatible(topInterfaceContract,
-                                                                        bottomInterfaceContract);
+            boolean isCompatible = interfaceContractMapper.isCompatible(topInterfaceContract, bottomInterfaceContract);
             if (!isCompatible) {
                 if (topContract instanceof Reference) {
-                    Monitor.error(monitor, 
+                    Monitor.error(monitor,
                                   this,
                                   "assembly-validation-messages",
                                   "ReferenceInterfaceNotSubSet",
                                   topContract.getName());
                 } else {
-                    Monitor.error(monitor, 
+                    Monitor.error(monitor,
                                   this,
                                   "assembly-validation-messages",
                                   "ServiceInterfaceNotSubSet",
@@ -450,16 +437,15 @@
                 }
             }
         }
-    } 
-    
+    }
+
     /**
      * OASIS RULE: Bindings from higher in the implementation hierarchy take precedence
      * 
      * @param compositeService
      * @param promotedComponentService
-     */    
-    private void calculatePromotedBindings(CompositeService compositeService,
-                                           ComponentService promotedComponentService){  
+     */
+    private void calculatePromotedBindings(CompositeService compositeService, ComponentService promotedComponentService) {
         // forward bindings
         if (compositeService.getBindings().isEmpty()) {
             for (Binding binding : promotedComponentService.getBindings()) {
@@ -470,28 +456,27 @@
                 }
             }
         }
-        
+
         if (compositeService.getBindings().isEmpty()) {
             createSCABinding(compositeService, null);
         }
 
         // callback bindings
-        if (promotedComponentService.getCallback() != null){
+        if (promotedComponentService.getCallback() != null) {
             if (compositeService.getCallback() != null) {
                 compositeService.getCallback().getBindings().clear();
             } else {
                 compositeService.setCallback(assemblyFactory.createCallback());
             }
-            
+
             for (Binding binding : promotedComponentService.getCallback().getBindings()) {
                 try {
                     compositeService.getCallback().getBindings().add((Binding)binding.clone());
                 } catch (CloneNotSupportedException ex) {
                     // this binding can't be used in the promoted service
                 }
-            }  
-        }        
-    }    
-    
+            }
+        }
+    }
 
 } //end class

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=818590&r1=818589&r2=818590&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 Thu Sep 24 19:02:28 2009
@@ -46,7 +46,8 @@
         return "org.apache.tuscany.sca.assembly.builder.CompositeIncludeBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         fuseIncludes(composite, monitor);
         return composite;
     }
@@ -57,22 +58,18 @@
      * @param composite
      */
     private void fuseIncludes(Composite composite, Monitor monitor) {
-        
+
         monitor.pushContext("Composite: " + composite.getName().toString());
-        
+
         try {
             Set<Composite> visited = new HashSet<Composite>();
             visited.add(composite);
-    
+
             for (Composite included : composite.getIncludes()) {
-                if(included.isLocal() && !composite.isLocal()) {
+                if (included.isLocal() && !composite.isLocal()) {
                     // ASM60041
-                    Monitor.error(monitor, 
-                                    this, 
-                                    "assembly-validation-messages", 
-                                    "IllegalCompositeIncusion", 
-                                    composite.getName().toString(),
-                                    included.getName().toString());
+                    Monitor.error(monitor, this, "assembly-validation-messages", "IllegalCompositeIncusion", composite
+                        .getName().toString(), included.getName().toString());
                 }
                 Composite fusedComposite = fuseInclude(included, visited, monitor);
                 if (fusedComposite != null) {
@@ -83,16 +80,16 @@
                     composite.getWires().addAll(fusedComposite.getWires());
                 }
             }
-    
+
             // Clear the list of includes as all of the included components 
             // have now been added into the top level composite
             composite.getIncludes().clear();
-            
+
             // process any composites referenced through implementation.composite 
             for (Component component : composite.getComponents()) {
                 monitor.pushContext("Component: " + component.getName());
-                
-                try {       
+
+                try {
                     // recurse for composite implementations
                     Implementation implementation = component.getImplementation();
                     if (implementation instanceof Composite) {
@@ -101,11 +98,11 @@
                 } finally {
                     monitor.popContext();
                 }
-            }             
-        
+            }
+
         } finally {
             monitor.popContext();
-        }        
+        }
     }
 
     private Composite fuseInclude(Composite include, Set<Composite> visited, Monitor monitor) {
@@ -113,11 +110,8 @@
         if (visited.contains(include)) {
             // FIXME: [rfeng] Do we need to have a warning? I think it is fine to have Composite A 
             // include B and C while both B and C include D.
-            Monitor.warning(monitor, 
-                            this, 
-                            "assembly-validation-messages", 
-                            "CompositeAlreadyIncluded", 
-                            include.getName().toString());
+            Monitor.warning(monitor, this, "assembly-validation-messages", "CompositeAlreadyIncluded", include
+                .getName().toString());
             return null;
         }
 
@@ -132,17 +126,13 @@
 
         // get the components etc. from any included composites
         for (Composite included : include.getIncludes()) {
-            if(included.isLocal() && !include.isLocal()) {
+            if (included.isLocal() && !include.isLocal()) {
                 // ASM60041
-                Monitor.error(monitor, 
-                                this, 
-                                "assembly-validation-messages", 
-                                "IllegalCompositeIncusion", 
-                                include.getName().toString(),
-                                included.getName().toString());
-                return null;                    
+                Monitor.error(monitor, this, "assembly-validation-messages", "IllegalCompositeIncusion", include
+                    .getName().toString(), included.getName().toString());
+                return null;
             }
-            
+
             Composite fusedComposite = fuseInclude(included, visited, monitor);
             if (fusedComposite != null) {
                 clone.getComponents().addAll(fusedComposite.getComponents());
@@ -167,24 +157,24 @@
                 }
             }
         }
-        
+
         // Merge the intents and policySets from the included composite into 
         // component/service/reference elements under the composite
-        for(Component component : clone.getComponents()) {
+        for (Component component : clone.getComponents()) {
             component.getRequiredIntents().addAll(include.getRequiredIntents());
             component.getPolicySets().addAll(include.getPolicySets());
         }
-        
-        for(Service service: clone.getServices()) {
+
+        for (Service service : clone.getServices()) {
             service.getRequiredIntents().addAll(include.getRequiredIntents());
             service.getPolicySets().addAll(include.getPolicySets());
         }
 
-        for(Reference reference: clone.getReferences()) {
+        for (Reference reference : clone.getReferences()) {
             reference.getRequiredIntents().addAll(include.getRequiredIntents());
             reference.getPolicySets().addAll(include.getPolicySets());
         }
-        
+
         // process any composites referenced through implementation.composite 
         for (Component component : clone.getComponents()) {
 
@@ -199,7 +189,7 @@
                 }
             }
         }
-        
+
         clone.getIncludes().clear();
 
         // return the fused composite we have built up so far

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java?rev=818590&r1=818589&r2=818590&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java Thu Sep 24 19:02:28 2009
@@ -56,12 +56,13 @@
     public CompositePolicyBuilderImpl(ExtensionPointRegistry registry) {
         super(registry);
     }
-    
+
     public String getID() {
         return "org.apache.tuscany.sca.assembly.builder.CompositePolicyBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         computePolicies(composite, definitions, monitor);
         return composite;
     }
@@ -181,14 +182,14 @@
             return name2.equals(name1);
         }
     }
-    
+
     private Intent resolve(Definitions definitions, Intent proxy) {
-        for(Intent i: definitions.getIntents()) {
-            if(i.equals(proxy)) {
+        for (Intent i : definitions.getIntents()) {
+            if (i.equals(proxy)) {
                 return i;
             }
-            for(Intent qi: i.getQualifiedIntents()) {
-                if(qi.equals(proxy)) {
+            for (Intent qi : i.getQualifiedIntents()) {
+                if (qi.equals(proxy)) {
                     return qi;
                 }
             }
@@ -279,7 +280,7 @@
                 }
             }
         }
-        
+
         subject.getPolicySets().clear();
         subject.getPolicySets().addAll(policySets);
 

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java?rev=818590&r1=818589&r2=818590&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java Thu Sep 24 19:02:28 2009
@@ -55,7 +55,8 @@
         return "org.apache.tuscany.sca.assembly.builder.CompositePromotionBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         connectCompositeReferencesAndServices(composite, monitor);
         return composite;
     }
@@ -68,9 +69,9 @@
      * @param problems
      */
     protected void connectCompositeReferencesAndServices(Composite composite, Monitor monitor) {
-        
+
         monitor.pushContext("Composite: " + composite.getName().toString());
-        
+
         try {
             // Wire nested composites recursively
             for (Component component : composite.getComponents()) {
@@ -79,13 +80,13 @@
                     connectCompositeReferencesAndServices((Composite)implementation, monitor);
                 }
             }
-    
+
             // Index components, services and references
             Map<String, Component> components = new HashMap<String, Component>();
             Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
             Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
             indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
-    
+
             // Connect composite services and references to the component
             // services and references that they promote
             connectCompositeServices(composite, components, componentServices, monitor);

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java?rev=818590&r1=818589&r2=818590&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java Thu Sep 24 19:02:28 2009
@@ -55,7 +55,8 @@
         return "org.apache.tuscany.sca.assembly.builder.CompositeReferenceConfigurationBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
 
         // Process nested composites recursively
         configureNestedCompositeReferences(composite);
@@ -87,7 +88,7 @@
                     if (compositeReference.getInterfaceContract() != null && compositeReference.getInterfaceContract()
                         .getCallbackInterface() != null) {
                         if (isCallbackOverridingBindings(compositeReference)) {
-                        compositeReference.setPromotionOverride(true);
+                            compositeReference.setPromotionOverride(true);
                         } else if (isCallbackOverridingBindings(promotedReference)) {
                             if (compositeReference.getCallback() != null) {
                                 compositeReference.getCallback().getBindings().clear();
@@ -108,8 +109,8 @@
                     // Because the component reference bindings can all be different, we don't
                     // copy any of them up to this composite reference, which will therefore always
                     // have its own binding, even if it's only the default SCA binding.
-                    if (compositeReference.isOverridingBindings() || (compositeReference
-                        .getCallback() != null && !compositeReference.getCallback().getBindings().isEmpty())) {
+                    if (compositeReference.isOverridingBindings() || (compositeReference.getCallback() != null && !compositeReference
+                        .getCallback().getBindings().isEmpty())) {
                         compositeReference.setPromotionOverride(true);
                     }
                 }
@@ -160,8 +161,7 @@
                                 }
                                 if (componentReference.getInterfaceContract() != null && componentReference
                                     .getInterfaceContract().getCallbackInterface() != null) {
-                                    if (!isCallbackOverridingBindings(compositeReference) 
-                                        && isCallbackOverridingBindings(promotedReference)) {
+                                    if (!isCallbackOverridingBindings(compositeReference) && isCallbackOverridingBindings(promotedReference)) {
                                         if (compositeReference.getCallback() != null) {
                                             compositeReference.getCallback().getBindings().clear();
                                         } else {
@@ -170,8 +170,8 @@
                                         compositeReference.getCallback().getBindings().addAll(promotedReference
                                             .getCallback().getBindings());
                                     }
-                                    if (componentReference.getCallback() != null && !componentReference
-                                        .getCallback().getBindings().isEmpty()) {
+                                    if (componentReference.getCallback() != null && !componentReference.getCallback()
+                                        .getBindings().isEmpty()) {
                                         componentReference.setPromotionOverride(true);
                                     } else if (isCallbackOverridingBindings(compositeReference)) {
                                         if (componentReference.getCallback() != null) {
@@ -194,8 +194,7 @@
                                 // Because the lower-level component reference bindings can all be different,
                                 // we don't copy any of them up to this component reference, which will therefore
                                 // always have its own binding, even if it's only the default SCA binding.
-                                if (componentReference.isOverridingBindings() 
-                                    || isCallbackOverridingBindings(componentReference)) {
+                                if (componentReference.isOverridingBindings() || isCallbackOverridingBindings(componentReference)) {
                                     componentReference.setPromotionOverride(true);
                                 }
                             }
@@ -205,7 +204,7 @@
             }
         }
     }
-    
+
     private boolean isCallbackOverridingBindings(Contract contract) {
         Callback callback = contract.getCallback();
         return callback != null && !callback.getBindings().isEmpty();

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java?rev=818590&r1=818589&r2=818590&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java Thu Sep 24 19:02:28 2009
@@ -53,7 +53,8 @@
      * 
      * @param composite
      */
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
 
         // Process composite references declared in this composite
         for (Reference reference : composite.getReferences()) {

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java?rev=818590&r1=818589&r2=818590&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java Thu Sep 24 19:02:28 2009
@@ -50,7 +50,8 @@
         return "org.apache.tuscany.sca.assembly.builder.CompositeServiceBindingBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
         buildServiceBindings(composite, monitor);
         return composite;
     }

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java?rev=818590&r1=818589&r2=818590&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java Thu Sep 24 19:02:28 2009
@@ -53,7 +53,8 @@
         return "org.apache.tuscany.sca.assembly.builder.CompositeServiceConfigurationBuilder";
     }
 
-    public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
+    public Composite build(Composite composite, Definitions definitions, Monitor monitor)
+        throws CompositeBuilderException {
 
         // Process nested composites recursively
         configureNestedCompositeServices(composite);
@@ -80,8 +81,7 @@
                 }
                 if (compositeService.getInterfaceContract() != null && compositeService.getInterfaceContract()
                     .getCallbackInterface() != null) {
-                    if (!isCallbackOverridingBindings(compositeService) 
-                        && isCallbackOverridingBindings(promotedService)) {
+                    if (!isCallbackOverridingBindings(compositeService) && isCallbackOverridingBindings(promotedService)) {
                         if (compositeService.getCallback() != null) {
                             compositeService.getCallback().getBindings().clear();
                         } else {
@@ -138,8 +138,7 @@
                             }
                             if (componentService.getInterfaceContract() != null && componentService
                                 .getInterfaceContract().getCallbackInterface() != null) {
-                                if (!isCallbackOverridingBindings(compositeService) 
-                                    && isCallbackOverridingBindings(promotedService)) {
+                                if (!isCallbackOverridingBindings(compositeService) && isCallbackOverridingBindings(promotedService)) {
                                     if (compositeService.getCallback() != null) {
                                         compositeService.getCallback().getBindings().clear();
                                     } else {
@@ -169,7 +168,7 @@
             }
         }
     }
-    
+
     private boolean isCallbackOverridingBindings(Contract contract) {
         Callback callback = contract.getCallback();
         return callback != null && !callback.getBindings().isEmpty();