org.codehaus.cargo.module.merge
Class DocumentStreamAdapter

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

public class DocumentStreamAdapter
extends java.lang.Object
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: DocumentStreamAdapter.java 1705 2008-09-02 13:14:55Z adriana $

Constructor Summary
DocumentStreamAdapter(MergeProcessor next)
          constructor.
 
Method Summary
 void addMergeItem(java.lang.Object mergeItem)
          Add an item to be merged.
 DescriptorIo getDescriptorIo()
           
protected  org.jdom.Document getDocument(java.io.InputStream theInput)
          Parse the input stream into a document.
 java.lang.Object performMerge()
          Perform the merge.
 void setDescriptorIo(DescriptorIo descriptorIo)
           
 
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.jdom.Document getDocument(java.io.InputStream theInput)
                                 throws java.io.IOException,
                                        org.jdom.JDOMException
Parse the input stream into a document.

Parameters:
theInput - in the InputStream to read
Returns:
Document generated from the stream
Throws:
java.io.IOException - on IO exception
org.jdom.JDOMException - if there is an XML problem

getDescriptorIo

public DescriptorIo getDescriptorIo()
Returns:
the descriptorIo

setDescriptorIo

public void setDescriptorIo(DescriptorIo descriptorIo)
Parameters:
descriptorIo - the descriptorIo to set


Copyright © 2004-2011 Codehaus. All Rights Reserved.