diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-22 15:55:52 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-22 15:55:52 +0000 |
commit | 399df0e96559b977ef2a880f5f81b0f0eaac189c (patch) | |
tree | fef96b07a8a392b17914d7bc59ee626cde6182c5 /java/sca/modules | |
parent | 6f41d8779ba82b282f067818a81123a8063c2734 (diff) |
Dump out nested composites also.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@817709 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r-- | java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java | 23 |
1 files changed, 19 insertions, 4 deletions
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 9d8f4eeb99..fa9c2dcc1f 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 @@ -34,6 +34,7 @@ import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.CompositeService; import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.common.java.io.IOHelper; import org.apache.tuscany.sca.contribution.Contribution; @@ -304,17 +305,31 @@ public class NodeImpl implements Node, Client { StAXArtifactProcessorExtensionPoint xmlProcessors = getExtensionPoints().getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); StAXArtifactProcessor<Composite> compositeProcessor = - xmlProcessors.getProcessor(Composite.class); - + xmlProcessors.getProcessor(Composite.class); + + return writeComposite(getDomainComposite(), compositeProcessor); + } + + private String writeComposite(Composite composite, StAXArtifactProcessor<Composite> compositeProcessor){ ByteArrayOutputStream bos = new ByteArrayOutputStream(); XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); try { - compositeProcessor.write(getDomainComposite(), outputFactory.createXMLStreamWriter(bos)); + compositeProcessor.write(composite, outputFactory.createXMLStreamWriter(bos)); } catch(Exception ex) { return ex.toString(); } - return bos.toString(); + String result = bos.toString(); + + // write out and nested composites + for(Component component : composite.getComponents()){ + if (component.getImplementation() instanceof Composite) { + result += "\n<!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->\n" + + writeComposite((Composite)component.getImplementation(), compositeProcessor); + } + } + + return result; } } |