diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-19 13:42:32 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-19 13:42:32 +0000 |
commit | 53724b906471050ee5bf7b6d8dc2f1bc8e277f77 (patch) | |
tree | 83520b86547d77df62fff03e451fe249342aeca8 /branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java | |
parent | 3ccbf454d348f0f1483f7961d9920c8722620c4e (diff) |
Commit some code to write out composite model during processing. Uncomment to use.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@745858 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java')
-rw-r--r-- | branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java index b676dba54f..b8e5330007 100644 --- a/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java +++ b/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.assembly.xml; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -141,6 +142,22 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements transformedArtifactContent = PolicyComputationUtils.addApplicablePolicySets(scdlStream, domainPolicySets, documentBuilderFactory); scdlStream = new ByteArrayInputStream(transformedArtifactContent); + + // For debugging purposes, write out the XML with applicablePolicySets added +/* + try { + scdlStream.mark(0); + ByteArrayOutputStream tmpOutput = new ByteArrayOutputStream(); + while(scdlStream.available()!= 0){ + tmpOutput.write(scdlStream.read()); + } + System.out.println(tmpOutput); + scdlStream.reset(); + + } catch (Exception e){ + e.printStackTrace(); + } +*/ } } catch ( IOException e ) { ContributionReadException ce = new ContributionReadException(e); @@ -163,22 +180,24 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements } // For debugging purposes, write it back to XML -// if (composite != null) { -// try { -// ByteArrayOutputStream bos = new ByteArrayOutputStream(); -// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); -// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE); -// extensionProcessor.write(composite, outputFactory.createXMLStreamWriter(bos)); -// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray())); -// OutputFormat format = new OutputFormat(); -// format.setIndenting(true); -// format.setIndent(2); -// XMLSerializer serializer = new XMLSerializer(System.out, format); -// serializer.serialize(document); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } +/* + if (composite != null) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + XMLOutputFactory outputFactory = XMLOutputFactory.newInstance(); + outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE); + extensionProcessor.write(composite, outputFactory.createXMLStreamWriter(bos)); + Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray())); + OutputFormat format = new OutputFormat(); + format.setIndenting(true); + format.setIndent(2); + XMLSerializer serializer = new XMLSerializer(System.out, format); + serializer.serialize(document); + } catch (Exception e) { + e.printStackTrace(); + } + } + */ return composite; |