org.codehaus.cargo.module.webapp
Class WarArchiveMerger.MergedWarArchive

java.lang.Object
  extended by org.codehaus.cargo.module.webapp.WarArchiveMerger.MergedWarArchive
All Implemented Interfaces:
JarArchive, WarArchive
Enclosing class:
WarArchiveMerger

public class WarArchiveMerger.MergedWarArchive
extends java.lang.Object
implements WarArchive

Subclass representing the merged WAR file.


Nested Class Summary
 class WarArchiveMerger.MergedWarArchive.ArchiveResourceMerger
          Class to store merging operations.
 
Method Summary
 void addProcessor(java.lang.String path, MergeProcessor merger)
           
 boolean containsClass(java.lang.String theClassName)
          Returns whether a class of the specified name is contained in the archive.
protected  void executeMergeProcessors(java.io.File assembleDir)
           
 void expandToPath(java.lang.String path)
          Expand the archive to the specified directory.
 java.lang.String findResource(java.lang.String theName)
          Returns the full path of a named resource in the archive.
protected  DefaultWarArchive firstWarFile()
           
 java.io.InputStream getResource(java.lang.String thePath)
          Returns a resource from the archive as input stream.
 java.util.List getResources(java.lang.String thePath)
          Returns the list of resources in the specified directory in the archive.
 WebXml getWebXml()
          Returns the deployment descriptor of the web application.
 WebXmlMerger getWebXmlMerger()
          Get the web XML merger.
 void store(java.io.File warFile)
          Stores the war archive to file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

firstWarFile

protected DefaultWarArchive firstWarFile()
Returns:
the first war file in the merge list

addProcessor

public void addProcessor(java.lang.String path,
                         MergeProcessor merger)
Parameters:
path - in the path to merge to
merger - in the processor to add

getWebXmlMerger

public WebXmlMerger getWebXmlMerger()
                             throws java.io.IOException,
                                    org.xml.sax.SAXException,
                                    javax.xml.parsers.ParserConfigurationException
Get the web XML merger.

Returns:
the WebXml merger
Throws:
java.io.IOException - on an IO Exception
org.xml.sax.SAXException - on a SAX Parse Exception
javax.xml.parsers.ParserConfigurationException - on Parser config exception

getWebXml

public WebXml getWebXml()
                 throws java.io.IOException,
                        org.xml.sax.SAXException,
                        javax.xml.parsers.ParserConfigurationException
Returns the deployment descriptor of the web application.

Specified by:
getWebXml in interface WarArchive
Returns:
The parsed deployment descriptor
Throws:
java.io.IOException - If there was a problem reading the deployment descriptor in the WAR
org.xml.sax.SAXException - If the deployment descriptor of the WAR could not be parsed
javax.xml.parsers.ParserConfigurationException - If there is an XML parser configuration problem
See Also:
WarArchive.getWebXml()

executeMergeProcessors

protected void executeMergeProcessors(java.io.File assembleDir)
                               throws MergeException,
                                      java.io.IOException
Parameters:
assembleDir - in the directory to output the merge data to
Throws:
MergeException - when there is a problem
java.io.IOException - if an IO exception

store

public void store(java.io.File warFile)
           throws MergeException,
                  java.io.IOException,
                  org.xml.sax.SAXException,
                  javax.xml.parsers.ParserConfigurationException
Stores the war archive to file. Changes to the descriptors of the war archive will be stored as well.

Specified by:
store in interface WarArchive
Parameters:
warFile - file to store the war in.
Throws:
java.io.IOException - If there was a problem reading the deployment descriptor in the WAR
org.xml.sax.SAXException - If the deployment descriptor of the WAR could not be parsed
javax.xml.parsers.ParserConfigurationException - If there is an XML parser configuration problem
MergeException
See Also:
WarArchive.store(java.io.File)

containsClass

public boolean containsClass(java.lang.String theClassName)
                      throws java.io.IOException
Returns whether a class of the specified name is contained in the archive.

Specified by:
containsClass in interface JarArchive
Parameters:
theClassName - The name of the class to search for
Returns:
Whether the class was found
Throws:
java.io.IOException - If an I/O error occurred reading the archive
See Also:
JarArchive.containsClass(java.lang.String)

findResource

public java.lang.String findResource(java.lang.String theName)
                              throws java.io.IOException
Returns the full path of a named resource in the archive.

Specified by:
findResource in interface JarArchive
Parameters:
theName - The name of the resource
Returns:
The full path to the resource inside the archive
Throws:
java.io.IOException - If an I/O error occurred reading the archive
See Also:
JarArchive.findResource(java.lang.String)

getResource

public java.io.InputStream getResource(java.lang.String thePath)
                                throws java.io.IOException
Returns a resource from the archive as input stream.

Specified by:
getResource in interface JarArchive
Parameters:
thePath - The path to the resource in the archive
Returns:
An input stream containing the specified resource, or null if the resource was not found in the JAR
Throws:
java.io.IOException - If an I/O error occurs
See Also:
JarArchive.getResource(java.lang.String)

getResources

public java.util.List getResources(java.lang.String thePath)
                            throws java.io.IOException
Returns the list of resources in the specified directory in the archive.

Specified by:
getResources in interface JarArchive
Parameters:
thePath - The directory
Returns:
The list of resources
Throws:
java.io.IOException - If an I/O error occurs
See Also:
JarArchive.getResources(java.lang.String)

expandToPath

public void expandToPath(java.lang.String path)
                  throws java.io.IOException
Expand the archive to the specified directory.

Specified by:
expandToPath in interface JarArchive
Parameters:
path - The path to expand to
Throws:
java.io.IOException - If an I/O error occurs
See Also:
JarArchive.expandToPath(String)


Copyright © 2004-2009 Codehaus. All Rights Reserved.