org.codehaus.cargo.module.merge
Class DocumentStreamAdapter

java.lang.Object
  extended by org.codehaus.cargo.module.AbstractDescriptorIo
      extended by org.codehaus.cargo.module.merge.DocumentStreamAdapter
All Implemented Interfaces:
MergeProcessor

public class DocumentStreamAdapter
extends AbstractDescriptorIo
implements MergeProcessor

Adapter class to convert streams into documents. This is needed because the DocumentMerger understands DOM Documents, but items in War files are accessed as streams - therefore use this wrapper to pass streams into the DocumentMerger (or subclass).

Version:
$Id: $

Constructor Summary
DocumentStreamAdapter(MergeProcessor next)
          constructor.
 
Method Summary
 void addMergeItem(java.lang.Object mergeItem)
          Add an item to be merged.
protected  org.w3c.dom.Document getDocument(java.io.InputStream theInput)
          Parse the input stream into a document.
 java.lang.Object performMerge()
          Perform the merge.
 
Methods inherited from class org.codehaus.cargo.module.AbstractDescriptorIo
createDocumentBuilder, writeAll, writeDescriptor, writeDescriptor, writeDescriptor, writeDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentStreamAdapter

public DocumentStreamAdapter(MergeProcessor next)
constructor.

Parameters:
next - the processor to adapt
Method Detail

addMergeItem

public void addMergeItem(java.lang.Object mergeItem)
                  throws MergeException
Add an item to be merged.

Specified by:
addMergeItem in interface MergeProcessor
Parameters:
mergeItem - in the item to merge.
Throws:
MergeException - on exceptions
See Also:
MergeProcessor.addMergeItem(java.lang.Object)

performMerge

public java.lang.Object performMerge()
                              throws MergeException
Perform the merge.

Specified by:
performMerge in interface MergeProcessor
Returns:
the merged artifact
Throws:
MergeException - if there is a problem
See Also:
MergeProcessor.performMerge()

getDocument

protected org.w3c.dom.Document getDocument(java.io.InputStream theInput)
                                    throws javax.xml.parsers.ParserConfigurationException,
                                           org.xml.sax.SAXException,
                                           java.io.IOException
Parse the input stream into a document.

Parameters:
theInput - in the InputStream to read
Returns:
Document generated from the stream
Throws:
javax.xml.parsers.ParserConfigurationException - on parse exception
org.xml.sax.SAXException - on sax exception
java.io.IOException - on IO exception


Copyright © 2004-2009 Codehaus. All Rights Reserved.