You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2009/08/17 14:57:15 UTC

svn commit: r804958 - in /tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl: ComponentConfigurationBuilderImpl.java CompositeBuilderImpl.java

Author: edwardsmj
Date: Mon Aug 17 12:57:15 2009
New Revision: 804958

URL: http://svn.apache.org/viewvc?rev=804958&view=rev
Log:
Add extra error reporting context through the Monitor

Modified:
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java?rev=804958&r1=804957&r2=804958&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java (original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java Mon Aug 17 12:57:15 2009
@@ -98,111 +98,118 @@
      * @param problems
      */
     private void configureComponents(Composite composite, String uri, Definitions definitions, Monitor monitor) {
-        String parentURI = uri;
+        String parentURI = uri;		
 
-        // Process nested composites recursively
-        for (Component component : composite.getComponents()) {
-
-            // Initialize component URI
-            String componentURI;
-            if (parentURI == null) {
-                componentURI = component.getName();
-            } else {
-                componentURI = URI.create(parentURI + '/').resolve(component.getName()).toString();
-            }
-            component.setURI(componentURI);
-
-            Implementation implementation = component.getImplementation();
-            if (implementation instanceof Composite) {
-
-                // Process nested composite
-                configureComponents((Composite)implementation, componentURI, definitions, monitor);
-            }
-        }
-
-        // Initialize service bindings
-        List<Service> compositeServices = composite.getServices();
-        for (Service service : compositeServices) {
-            // Set default binding names 
-
-            // Create default SCA binding
-            attachSCABinding(service, definitions);
-        }
-
-        // Initialize reference bindings
-        for (Reference reference : composite.getReferences()) {
-            // Create default SCA binding
-            attachSCABinding(reference, definitions);
-        }
-
-        // Initialize all component services and references
-        Map<String, Component> components = new HashMap<String, Component>();
-        for (Component component : composite.getComponents()) {
+	        // Process nested composites recursively
+	        for (Component component : composite.getComponents()) {
+	
+	            // Initialize component URI
+	            String componentURI;
+	            if (parentURI == null) {
+	                componentURI = component.getName();
+	            } else {
+	                componentURI = URI.create(parentURI + '/').resolve(component.getName()).toString();
+	            }
+	            component.setURI(componentURI);
+	
+	            Implementation implementation = component.getImplementation();
+	            if (implementation instanceof Composite) {
+	            	try {
+	            		monitor.pushContext("Composite: " + ((Composite)implementation).getURI());
+	
+		                // Process nested composite
+		                configureComponents((Composite)implementation, componentURI, definitions, monitor);
+	            	
+	            	} finally {
+	            		monitor.popContext();
+	            	} // end try
+	            }
+	        } // end for
+	
+	        // Initialize service bindings
+	        List<Service> compositeServices = composite.getServices();
+	        for (Service service : compositeServices) {
+	            // Set default binding names 
+	
+	            // Create default SCA binding
+	            attachSCABinding(service, definitions);
+	        }
+	
+	        // Initialize reference bindings
+	        for (Reference reference : composite.getReferences()) {
+	            // Create default SCA binding
+	            attachSCABinding(reference, definitions);
+	        }
+	
+	        // Initialize all component services and references
+	        Map<String, Component> components = new HashMap<String, Component>();
+	        for (Component component : composite.getComponents()) {
+	
+	            // Index all components and check for duplicates
+	            if (components.containsKey(component.getName())) {
+	                error(monitor, "DuplicateComponentName", component, composite.getName().toString(), component.getName());
+	            } else {
+	                components.put(component.getName(), component);
+	            }
+	
+	            // Propagate the autowire flag from the composite to components
+	            if (component.getAutowire() == null) {
+	                component.setAutowire(composite.getAutowire());
+	            }
+	
+	            if (component.getImplementation() instanceof ComponentPreProcessor) {
+	                ((ComponentPreProcessor)component.getImplementation()).preProcess(component);
+	            }
+	
+	            // Index implementation 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);
+	
+	            // 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>();
+	            indexComponentPropertiesServicesAndReferences(component,
+	                                                          componentServices,
+	                                                          componentReferences,
+	                                                          componentProperties,
+	                                                          monitor);
+	
+	            // Reconcile component services/references/properties and
+	            // implementation services/references and create component
+	            // services/references/properties for the services/references
+	            // declared by the implementation
+	            reconcileServices(component, services, componentServices, monitor);
+	            reconcileReferences(component, references, componentReferences, monitor);
+	            reconcileProperties(component, properties, componentProperties, monitor);
+	
+	            // Configure or create callback services for component's references
+	            // with callbacks
+	            configureCallbackServices(component, componentServices);
+	
+	            // Configure or create callback references for component's services
+	            // with callbacks
+	            configureCallbackReferences(component, componentReferences);
+	
+	            // Initialize service bindings
+	            for (ComponentService componentService : component.getServices()) {
+	
+	                // Create default SCA binding
+	                attachSCABinding(componentService, definitions);
+	            }
+	
+	            // Initialize reference bindings
+	            for (ComponentReference componentReference : component.getReferences()) {
+	
+	                // Create default SCA binding
+	                attachSCABinding(componentReference, definitions);
+	            }
+	        }
 
-            // Index all components and check for duplicates
-            if (components.containsKey(component.getName())) {
-                error(monitor, "DuplicateComponentName", component, composite.getName().toString(), component.getName());
-            } else {
-                components.put(component.getName(), component);
-            }
-
-            // Propagate the autowire flag from the composite to components
-            if (component.getAutowire() == null) {
-                component.setAutowire(composite.getAutowire());
-            }
-
-            if (component.getImplementation() instanceof ComponentPreProcessor) {
-                ((ComponentPreProcessor)component.getImplementation()).preProcess(component);
-            }
-
-            // Index implementation 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);
-
-            // 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>();
-            indexComponentPropertiesServicesAndReferences(component,
-                                                          componentServices,
-                                                          componentReferences,
-                                                          componentProperties,
-                                                          monitor);
-
-            // Reconcile component services/references/properties and
-            // implementation services/references and create component
-            // services/references/properties for the services/references
-            // declared by the implementation
-            reconcileServices(component, services, componentServices, monitor);
-            reconcileReferences(component, references, componentReferences, monitor);
-            reconcileProperties(component, properties, componentProperties, monitor);
-
-            // Configure or create callback services for component's references
-            // with callbacks
-            configureCallbackServices(component, componentServices);
-
-            // Configure or create callback references for component's services
-            // with callbacks
-            configureCallbackReferences(component, componentReferences);
-
-            // Initialize service bindings
-            for (ComponentService componentService : component.getServices()) {
-
-                // Create default SCA binding
-                attachSCABinding(componentService, definitions);
-            }
-
-            // Initialize reference bindings
-            for (ComponentReference componentReference : component.getReferences()) {
-
-                // Create default SCA binding
-                attachSCABinding(componentReference, definitions);
-            }
-        }
-    }
+    } // end method 
 
     /**
      * For all the references with callbacks, create a corresponding callback

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=804958&r1=804957&r2=804958&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 Aug 17 12:57:15 2009
@@ -152,6 +152,8 @@
                       Monitor monitor) throws CompositeBuilderException {
 
         try {
+    		monitor.pushContext("Composite: " + composite.getURI());   		
+    		
             // Collect and fuse includes
             compositeIncludeBuilder.build(composite, definitions, monitor);
 
@@ -221,7 +223,9 @@
             compositePolicyBuilder.build(composite, definitions, monitor);
         } catch (Exception e) {
             throw new CompositeBuilderException("Exception while building composite " + composite.getName(), e);
-        } // end try
+    	} finally {
+    		monitor.popContext();
+    	} // end try
 
     } // end method build