summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-09 23:40:04 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-10-09 23:40:04 +0000
commit2e8a2ebd0d9f9ffbb7fc6bd9fcb2e0fa06c7f5fb (patch)
treec1a745ff95957f33e3573b05e4a02edf4ba1b094 /java
parent8c67595b5299dd0b4691ef0c93c01df3c818c74b (diff)
Add capability to read domainRegistry and other options
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@823744 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java8
-rw-r--r--java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java3
-rw-r--r--java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java5
-rw-r--r--java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml3
4 files changed, 18 insertions, 1 deletions
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
index e91c5961fc..59f4eda9a5 100644
--- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
+++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
@@ -103,6 +103,7 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
node = nodeConfigurationFactory.createNodeConfiguration();
node.setURI(reader.getAttributeValue(null, "uri"));
node.setDomainURI(reader.getAttributeValue(null, "domain"));
+ node.setDomainRegistryURI(reader.getAttributeValue(null, "domainRegistry"));
} else if (CONTRIBUTION.equals(name)) {
contribution = nodeConfigurationFactory.createContributionConfiguration();
contribution.setURI(reader.getAttributeValue(null, "uri"));
@@ -146,6 +147,8 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
XMLStreamWriter writer = helper.createXMLStreamWriter(sw);
helper.save(reader, writer);
composite.setContent(sw.toString());
+ } else {
+ node.getExtensions().add(processor.read(reader));
}
break;
@@ -181,6 +184,7 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
NODE.getNamespaceURI(),
NODE.getLocalPart(),
new XAttr("uri", node.getURI()),
+ new XAttr("domainRegistry", node.getDomainRegistryURI()),
new XAttr("domain", node.getDomainURI()));
for (ContributionConfiguration c : node.getContributions()) {
@@ -223,6 +227,10 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem
new XAttr("baseURIs", uris.toString()));
writeEnd(writer);
}
+
+ for(Object o: node.getExtensions()) {
+ processor.write(o, writer);
+ }
writeEnd(writer);
}
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
index 6ac8394b8f..00d8dc7978 100644
--- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
+++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
@@ -492,6 +492,7 @@ public class NodeFactoryImpl extends NodeFactory {
// aggregate definitions
for (Artifact artifact : contribution.getArtifacts()) {
Object model = artifact.getModel();
+ // FIXME: Should we check the artifact URI is META-INF/definitions.xml?
if (model instanceof Definitions) {
monitor.pushContext("Definitions: " + artifact.getLocation());
DefinitionsUtil.aggregate((Definitions)model, systemDefinitions, monitor);
@@ -562,7 +563,7 @@ public class NodeFactoryImpl extends NodeFactory {
return domainComposite;
}
- private List<Contribution> loadContributions(NodeConfiguration configuration, Monitor monitor) throws Throwable {
+ protected List<Contribution> loadContributions(NodeConfiguration configuration, Monitor monitor) throws Throwable {
List<Contribution> contributions = new ArrayList<Contribution>();
// Load the specified contributions
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
index 5a363e68af..ab63c80b67 100644
--- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -124,7 +124,12 @@ public class NodeImpl implements Node, Client {
try {
Monitor monitor = manager.monitorFactory.createMonitor();
monitor.reset();
+
+ if (contributions == null) {
+ contributions = manager.loadContributions(configuration, monitor);
+ }
domainComposite = manager.configureNode(configuration, contributions, monitor);
+
this.compositeContext = new CompositeContextImpl(manager.extensionPoints, endpointRegistry, domainComposite);
// Activate the composite
diff --git a/java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml b/java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
index b6e56368ef..5b2835c434 100644
--- a/java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
+++ b/java/sca/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
@@ -21,6 +21,7 @@
xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
uri="http://sample/nodes/TestNode1"
+ domainRegistry = "vm://localhost"
domain="http://domain1">
<!-- Configure the base URIs for a given binding -->
@@ -52,4 +53,6 @@
<deploymentComposite location="test/Test.composite">
</deploymentComposite>
</contribution>
+ <option name="debug" value="true"/>
+ <option name="validation">true</option>
</node> \ No newline at end of file