Package org.codehaus.cargo.module.webapp
Class WebXml
- java.lang.Object
-
- org.jdom2.Document
-
- org.codehaus.cargo.module.AbstractDescriptor
-
- org.codehaus.cargo.module.webapp.WebXml
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Descriptor
,J2eeDescriptor
,org.jdom2.NamespaceAware
,org.jdom2.Parent
public class WebXml extends AbstractDescriptor implements J2eeDescriptor
Encapsulates the DOM representation of a web deployment descriptorweb.xml
to provide convenience methods for easy access and manipulation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WebXml()
Constructor.WebXml(org.jdom2.Element rootElement, DescriptorType type)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTag(DescriptorElement element)
Add a tag into the document.void
addVendorDescriptor(VendorWebAppDescriptor descr)
Associates a vendor specific descriptor with this web.xml.String
getFileName()
Returns the file name of this descriptor.org.jdom2.Element
getTag(String tag)
Get a tag by name.protected org.jdom2.Namespace
getTagNamespace()
Get the namespace that tags in this descriptor live in.List<Descriptor>
getVendorDescriptors()
Returns all vendor descriptors associated with this J2EE deployment descriptor.WebXmlVersion
getVersion()
Returns the servlet API version.-
Methods inherited from class org.codehaus.cargo.module.AbstractDescriptor
addElement, checkElement, containsElement, createNestedText, getChildText, getChildText, getContentExceptComments, getDescriptorType, getDocument, getElements, getElements, getImmediateChild, getInsertionPointFor, getNestedElements, getNestedText, getTagByIdentifier, getTagByIdentifier, getTags, getTags, getText, sameContent, sameElement
-
Methods inherited from class org.jdom2.Document
addContent, addContent, addContent, addContent, canContainContent, clone, cloneContent, detachRootElement, equals, getBaseURI, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getDocType, getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced, getParent, getProperty, getRootElement, hashCode, hasRootElement, indexOf, removeContent, removeContent, removeContent, removeContent, setBaseURI, setContent, setContent, setContent, setContent, setDocType, setProperty, setRootElement, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.codehaus.cargo.module.Descriptor
addElement, getDescriptorType, getDocument, getRootElement, getTagByIdentifier, getTagByIdentifier, getTags, getTags
-
Methods inherited from interface org.jdom2.NamespaceAware
getNamespacesInherited, getNamespacesInScope, getNamespacesIntroduced
-
Methods inherited from interface org.jdom2.Parent
addContent, addContent, addContent, addContent, canContainContent, clone, cloneContent, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getParent, indexOf, removeContent, removeContent, removeContent, removeContent
-
-
-
-
Constructor Detail
-
WebXml
public WebXml()
Constructor.
-
WebXml
public WebXml(org.jdom2.Element rootElement, DescriptorType type)
Constructor.- Parameters:
rootElement
- The root webxml elementtype
- The descriptor type to use
-
-
Method Detail
-
getFileName
public String getFileName()
Returns the file name of this descriptor. For example "web.xml", "weblogic.xml", etc.- Specified by:
getFileName
in interfaceDescriptor
- Returns:
- the file name
-
addVendorDescriptor
public void addVendorDescriptor(VendorWebAppDescriptor descr)
Associates a vendor specific descriptor with this web.xml.- Parameters:
descr
- the vendor specific dexcriptor to associate
-
getVendorDescriptors
public List<Descriptor> getVendorDescriptors()
Returns all vendor descriptors associated with this J2EE deployment descriptor. For example for JBoss the vendor descriptor associated withweb.xml
isjboss-web.xml
.- Specified by:
getVendorDescriptors
in interfaceJ2eeDescriptor
- Returns:
- List of Descriptor objects
-
getTagNamespace
protected org.jdom2.Namespace getTagNamespace()
Get the namespace that tags in this descriptor live in.- Returns:
- the namespace, or null if none
-
getVersion
public WebXmlVersion getVersion()
Returns the servlet API version.- Returns:
- The version
-
addTag
public void addTag(DescriptorElement element)
Add a tag into the document.- Parameters:
element
- The element to add
-
getTag
public org.jdom2.Element getTag(String tag)
Get a tag by name.- Parameters:
tag
- The tag name- Returns:
- the element for the tag
-
-