summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk/modules
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-06-07 11:28:41 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2010-06-07 11:28:41 +0000
commitf8303b2ad6dc9cc1af87c5e7ec9f30d7e5871f30 (patch)
treea9259fe194f93117c93a13144618c48d73d0e680 /sca-java-1.x/trunk/modules
parentbe7658953234bc1264331dd7041a5abf2ade87f1 (diff)
Read composite content after contributions have been loaded (TUSCANY-3569)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@952186 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/modules')
-rw-r--r--sca-java-1.x/trunk/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/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/sca-java-1.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
index 4a93993560..0f110f0584 100644
--- a/sca-java-1.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ b/sca-java-1.x/trunk/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();