tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r988703 - /tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
Date Tue, 24 Aug 2010 20:14:21 GMT
Author: nash
Date: Tue Aug 24 20:14:21 2010
New Revision: 988703

URL: http://svn.apache.org/viewvc?rev=988703&view=rev
Log:
Merge revision 952186 from trunk into the 1.6.1 branch

Modified:
    tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java

Modified: tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java?rev=988703&r1=988702&r2=988703&view=diff
==============================================================================
--- tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
(original)
+++ tuscany/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
Tue Aug 24 20:14:21 2010
@@ -140,7 +140,7 @@ public class NodeImpl implements SCANode
             configuration.getComposite().setURI(compositeURL.toString());
 
             // Configure the node
-            configureNode(configuration);
+            configureNode(configuration, null);
 
         } catch (ServiceRuntimeException e) {
             throw e;
@@ -162,7 +162,7 @@ public class NodeImpl implements SCANode
             initRuntime();
 
             ConfiguredNodeImplementation config = findNodeConfiguration(null, null);
-            configureNode(config);
+            configureNode(config, null);
         } catch (ServiceRuntimeException e) {
             throw e;
         } catch (Throwable e) {
@@ -197,7 +197,7 @@ public class NodeImpl implements SCANode
             initRuntime();
 
             ConfiguredNodeImplementation config = findNodeConfiguration(compositeURI, classLoader);
-            configureNode(config);
+            configureNode(config, null);
         } catch (ServiceRuntimeException e) {
             throw e;
         } catch (Throwable e) {
@@ -378,7 +378,7 @@ public class NodeImpl implements SCANode
             }
 
             // Configure the node
-            configureNode(configuration);
+            configureNode(configuration, null);
 
         } catch (ServiceRuntimeException e) {
             throw e;
@@ -420,20 +420,7 @@ public class NodeImpl implements SCANode
                     modelFactories.getFactory(NodeImplementationFactory.class);
                 configuration = nodeImplementationFactory.createConfiguredNodeImplementation();
 
-                // Read the composite model
-                StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
-                // URL compositeURL = new URL(compositeURI);
-                logger.log(Level.INFO, "Loading composite: " + compositeURI);
-
-                CompositeDocumentProcessor compositeDocProcessor =
-                    (CompositeDocumentProcessor)documentProcessors.getProcessor(Composite.class);
-                composite =
-                    compositeDocProcessor.read(URI.create(compositeURI), new ByteArrayInputStream(compositeContent
-                        .getBytes("UTF-8")));
-
-                analyzeProblems();
-
-                configuration.setComposite(composite);
+                // Defer reading the composite content until the contributions have been
loaded (TUSCANY-3569)
 
                 // Create contribution models
                 ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
@@ -444,7 +431,7 @@ public class NodeImpl implements SCANode
             }
 
             // Configure the node
-            configureNode(configuration);
+            configureNode(configuration, compositeContent);
 
         } catch (ServiceRuntimeException e) {
             throw e;
@@ -503,7 +490,7 @@ public class NodeImpl implements SCANode
         return URI.create(uri);
     }
 
-    private void configureNode(ConfiguredNodeImplementation configuration) throws Exception
{
+    private void configureNode(ConfiguredNodeImplementation configuration, String compositeContent)
throws Exception {
 
         // Find if any contribution JARs already available locally on the classpath
         Map<String, URL> localContributions = localContributions();
@@ -539,7 +526,20 @@ public class NodeImpl implements SCANode
         }
 
         composite = configuration.getComposite();
-        
+
+        // Read the composite content after the contributions have been loaded, so that the
+        // policySet definitions provided by the contributions are available (TUSCANY-3569)
+        if (composite == null && compositeContent != null) {
+            logger.log(Level.INFO, "Loading composite: " + configurationName);
+            CompositeDocumentProcessor compositeDocProcessor =
+                (CompositeDocumentProcessor)documentProcessors.getProcessor(Composite.class);
+            composite =
+                compositeDocProcessor.read(URI.create(configurationName), new ByteArrayInputStream(compositeContent
+                    .getBytes("UTF-8")));
+            analyzeProblems();
+            configuration.setComposite(composite);
+        }
+
         if(composite != null && composite.isUnresolved()) {
             ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
             Artifact compositeFile = contributionFactory.createArtifact();



Mime
View raw message