diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-12-02 18:55:36 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2011-12-02 18:55:36 +0000 |
commit | 1ee87f0f4c14a106c7b37eef7aa218ed95a337b1 (patch) | |
tree | 99e02ee701e18738bcfe6eea759b96c56a5d502c /sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node | |
parent | f37a2fbbdc9a296727c533194a7f6fb90904d367 (diff) |
Add ablity to specify endpoint descriptions in node.xml for local domain registry
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1209634 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node')
2 files changed, 26 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java index 663129bc0f..48d76225fb 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java @@ -31,6 +31,7 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; +import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.common.xml.stax.StAXHelper; import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.ContributionReadException; @@ -157,7 +158,12 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem helper.save(reader, writer); composite.setContent(sw.toString()); } else { - node.getExtensions().add(processor.read(reader, context)); + Object ext = processor.read(reader, context); + if (ext instanceof Endpoint) { + node.getEndpointDescriptions().add((Endpoint)ext); + } else { + node.getExtensions().add(ext); + } } break; @@ -238,6 +244,11 @@ public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implem writeEnd(writer); } + // FIXME: The composite processor assumes that composite is root element +// for (Endpoint o : node.getEndpointDescriptions()) { +// processor.write(o, writer, context); +// } + for(Object o: node.getExtensions()) { processor.write(o, writer, context); } diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index 22562a5b97..453b4fb486 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -136,7 +136,12 @@ public class NodeImpl implements Node, NodeExtension { // Pass down the context attributes compositeContext.getAttributes().putAll(configuration.getAttributes()); - + // Add endpoint descriptions from the node configuration if the domain registry is local + if (!domainRegistry.isDistributed()) { + for (Endpoint e : configuration.getEndpointDescriptions()) { + domainRegistry.addEndpoint(e); + } + } // Activate the composite compositeActivator.activate(compositeContext, domainComposite); @@ -234,6 +239,14 @@ public class NodeImpl implements Node, NodeExtension { compositeActivator.deactivate(domainComposite); } // end if + + // Remove the external endpoint descriptions from node.xml + DomainRegistry domainRegistry = compositeContext.getEndpointRegistry(); + if (!domainRegistry.isDistributed()) { + for (Endpoint e : configuration.getEndpointDescriptions()) { + domainRegistry.removeEndpoint(e); + } + } nodeFactory.removeNode(configuration); /* |