Package org.codehaus.cargo.module.webapp
Class DefaultWarArchive
- java.lang.Object
-
- org.codehaus.cargo.module.DefaultJarArchive
-
- org.codehaus.cargo.module.webapp.DefaultWarArchive
-
- All Implemented Interfaces:
JarArchive
,WarArchive
public class DefaultWarArchive extends DefaultJarArchive implements WarArchive
Class that encapsulates access to a WAR.
-
-
Constructor Summary
Constructors Constructor Description DefaultWarArchive(InputStream inputStream)
Constructor.DefaultWarArchive(String file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsClass(String className)
Returns whether a class of the specified name is contained in the web-app archive, either directly in WEB-INF/classes, or in one of the JARs in WEB-INF/lib.WebXml
getWebXml()
Returns the deployment descriptor of the web application.void
store(File warFile)
Stores the war archive to file.-
Methods inherited from class org.codehaus.cargo.module.DefaultJarArchive
expandToPath, findResource, getContentAsStream, getFileHandler, getResource, getResources, setFileHandler, streamToByteArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codehaus.cargo.module.JarArchive
expandToPath, findResource, getResource, getResources
-
-
-
-
Constructor Detail
-
DefaultWarArchive
public DefaultWarArchive(String file)
- See Also:
DefaultJarArchive(String)
-
DefaultWarArchive
public DefaultWarArchive(InputStream inputStream) throws IOException
Constructor.- Parameters:
inputStream
- The input stream for the web application archive- Throws:
IOException
- If there was a problem reading the WAR
-
-
Method Detail
-
getWebXml
public WebXml getWebXml() throws IOException, org.jdom2.JDOMException
Returns the deployment descriptor of the web application.- Specified by:
getWebXml
in interfaceWarArchive
- Returns:
- The parsed deployment descriptor
- Throws:
IOException
- If there was a problem reading the deployment descriptor in the WARorg.jdom2.JDOMException
- If the deployment descriptor of the WAR could not be parsed
-
store
public void store(File warFile) throws IOException, org.jdom2.JDOMException
Stores the war archive to file. Changes to the descriptors of the war archive will be stored as well.- Specified by:
store
in interfaceWarArchive
- Parameters:
warFile
- file to store the war in.- Throws:
IOException
- If there was a problem reading the deployment descriptor in the WARorg.jdom2.JDOMException
- If the deployment descriptor of the WAR could not be parsed
-
containsClass
public boolean containsClass(String className) throws IOException
Returns whether a class of the specified name is contained in the web-app archive, either directly in WEB-INF/classes, or in one of the JARs in WEB-INF/lib.- Specified by:
containsClass
in interfaceJarArchive
- Overrides:
containsClass
in classDefaultJarArchive
- Parameters:
className
- The name of the class to search for- Returns:
- Whether the class was found in the archive
- Throws:
IOException
- If an I/O error occurred reading the archive
-
-