tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edward...@apache.org
Subject svn commit: r801174 - in /tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml: BaseAssemblyProcessor.java CompositeProcessor.java
Date Wed, 05 Aug 2009 12:29:38 GMT
Author: edwardsmj
Date: Wed Aug  5 12:29:38 2009
New Revision: 801174

URL: http://svn.apache.org/viewvc?rev=801174&view=rev
Log:
Add Composite context information to Monitor during Resolve phase

Modified:
    tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
    tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java

Modified: tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java?rev=801174&r1=801173&r2=801174&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
(original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
Wed Aug  5 12:29:38 2009
@@ -106,7 +106,7 @@
     protected StAXArtifactProcessor<Object> extensionProcessor;
     protected PolicySubjectProcessor policyProcessor;
     private DocumentBuilderFactory documentBuilderFactory;
-    private Monitor monitor;
+    protected Monitor monitor;
 
     /**
      * Constructs a new BaseArtifactProcessor.

Modified: tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=801174&r1=801173&r2=801174&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
(original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
Wed Aug  5 12:29:38 2009
@@ -932,81 +932,89 @@
 
     public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException
{
 
-        // Resolve constraining type
-        ConstrainingType constrainingType = composite.getConstrainingType();
-        if (constrainingType != null) {
-            constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
-            composite.setConstrainingType(constrainingType);
-        }
-
-        // Resolve includes in the composite
-        for (int i = 0, n = composite.getIncludes().size(); i < n; i++) {
-            Composite include = composite.getIncludes().get(i);
-            if (include != null) {
-                include = resolver.resolveModel(Composite.class, include);
-                composite.getIncludes().set(i, include);
-            }
-        }
-
-        // Resolve extensions
-        for (Object extension : composite.getExtensions()) {
-            if (extension != null) {
-                extensionProcessor.resolve(extension, resolver);
-            }
-        }
-
-        //Resolve composite services and references
-        resolveContracts(composite, composite.getServices(), resolver);
-        resolveContracts(composite, composite.getReferences(), resolver);
-
-        // Resolve component implementations, services and references
-        for (Component component : composite.getComponents()) {
-            constrainingType = component.getConstrainingType();
-            if (constrainingType != null) {
-                constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
-                component.setConstrainingType(constrainingType);
-            }
-
-            //resolve component services and references
-            resolveContracts(component, component.getServices(), resolver);
-            resolveContracts(component, component.getReferences(), resolver);
-
-            for (ComponentProperty componentProperty : component.getProperties()) {
-                if (componentProperty.getFile() != null) {
-                    Artifact artifact = contributionFactory.createArtifact();
-                    artifact.setURI(componentProperty.getFile());
-                    artifact = resolver.resolveModel(Artifact.class, artifact);
-                    if (artifact.getLocation() != null) {
-                        componentProperty.setFile(artifact.getLocation());
-                    }
-                }
-            }
-
-            //resolve component implementation
-            Implementation implementation = component.getImplementation();
-            if (implementation != null) {
-                //now resolve the implementation so that even if there is a shared instance
-                //for this that is resolved, the specified intents and policysets are safe
in the
-                //component and not lost
-                implementation = resolveImplementation(implementation, resolver);
-
-                component.setImplementation(implementation);
-            }
-
-            //add model resolver to component
-            if (component instanceof ResolverExtension) {
-                ((ResolverExtension)component).setModelResolver(resolver);
-            }
-        }
-
-        // Add model resolver to promoted components
-        for (Service service : composite.getServices()) {
-            CompositeService compositeService = (CompositeService)service;
-            Component promotedComponent = compositeService.getPromotedComponent();
-            if (promotedComponent instanceof ResolverExtension) {
-                ((ResolverExtension)promotedComponent).setModelResolver(resolver);
-            }
-        }
+    	try {
+    		this.monitor.pushContext("Composite: " + composite.getName());
+	    	
+	        // Resolve constraining type
+	        ConstrainingType constrainingType = composite.getConstrainingType();
+	        if (constrainingType != null) {
+	            constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
+	            composite.setConstrainingType(constrainingType);
+	        }
+	
+	        // Resolve includes in the composite
+	        for (int i = 0, n = composite.getIncludes().size(); i < n; i++) {
+	            Composite include = composite.getIncludes().get(i);
+	            if (include != null) {
+	                include = resolver.resolveModel(Composite.class, include);
+	                composite.getIncludes().set(i, include);
+	            }
+	        }
+	
+	        // Resolve extensions
+	        for (Object extension : composite.getExtensions()) {
+	            if (extension != null) {
+	                extensionProcessor.resolve(extension, resolver);
+	            }
+	        }
+	
+	        //Resolve composite services and references
+	        resolveContracts(composite, composite.getServices(), resolver);
+	        resolveContracts(composite, composite.getReferences(), resolver);
+	
+	        // Resolve component implementations, services and references
+	        for (Component component : composite.getComponents()) {
+	            constrainingType = component.getConstrainingType();
+	            if (constrainingType != null) {
+	                constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
+	                component.setConstrainingType(constrainingType);
+	            }
+	
+	            //resolve component services and references
+	            resolveContracts(component, component.getServices(), resolver);
+	            resolveContracts(component, component.getReferences(), resolver);
+	
+	            for (ComponentProperty componentProperty : component.getProperties()) {
+	                if (componentProperty.getFile() != null) {
+	                    Artifact artifact = contributionFactory.createArtifact();
+	                    artifact.setURI(componentProperty.getFile());
+	                    artifact = resolver.resolveModel(Artifact.class, artifact);
+	                    if (artifact.getLocation() != null) {
+	                        componentProperty.setFile(artifact.getLocation());
+	                    }
+	                }
+	            }
+	
+	            //resolve component implementation
+	            Implementation implementation = component.getImplementation();
+	            if (implementation != null) {
+	                //now resolve the implementation so that even if there is a shared instance
+	                //for this that is resolved, the specified intents and policysets are safe
in the
+	                //component and not lost
+	                implementation = resolveImplementation(implementation, resolver);
+	
+	                component.setImplementation(implementation);
+	            }
+	
+	            //add model resolver to component
+	            if (component instanceof ResolverExtension) {
+	                ((ResolverExtension)component).setModelResolver(resolver);
+	            }
+	        }
+	
+	        // Add model resolver to promoted components
+	        for (Service service : composite.getServices()) {
+	            CompositeService compositeService = (CompositeService)service;
+	            Component promotedComponent = compositeService.getPromotedComponent();
+	            if (promotedComponent instanceof ResolverExtension) {
+	                ((ResolverExtension)promotedComponent).setModelResolver(resolver);
+	            }
+	        } // end for
+        
+    	} finally {
+    		// Pop context
+    		this.monitor.popContext();
+    	} // end try 
     }
 
     public QName getArtifactType() {



Mime
View raw message