summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-08-24 20:14:21 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-08-24 20:14:21 +0000
commit091d57a3a835a40273310d0c56b6a71224e0d5e8 (patch)
tree764deae1d3495251b837eb93370f5cd237e32936 /sca-java-1.x
parent30bb8253a1d5a74c6812aa4b2ca364eecd493f7e (diff)
Merge revision 952186 from trunk into the 1.6.1 branch
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@988703 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x')
-rw-r--r--sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java42
1 files changed, 21 insertions, 21 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
index 4a93993560..0f110f0584 100644
--- a/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ b/sca-java-1.x/branches/sca-java-1.6.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -140,7 +140,7 @@ public class NodeImpl implements SCANode, SCAClient {
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, SCAClient {
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, SCAClient {
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, SCAClient {
}
// Configure the node
- configureNode(configuration);
+ configureNode(configuration, null);
} catch (ServiceRuntimeException e) {
throw e;
@@ -420,20 +420,7 @@ public class NodeImpl implements SCANode, SCAClient {
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, SCAClient {
}
// Configure the node
- configureNode(configuration);
+ configureNode(configuration, compositeContent);
} catch (ServiceRuntimeException e) {
throw e;
@@ -503,7 +490,7 @@ public class NodeImpl implements SCANode, SCAClient {
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, SCAClient {
}
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();