org.codehaus.cargo.module.application
Class ApplicationXml

java.lang.Object
  extended by org.jdom.Document
      extended by org.codehaus.cargo.module.AbstractDescriptor
          extended by org.codehaus.cargo.module.application.ApplicationXml
All Implemented Interfaces:
Serializable, Cloneable, Descriptor, J2eeDescriptor, org.jdom.Parent

public class ApplicationXml
extends AbstractDescriptor
implements J2eeDescriptor

Encapsulates the DOM representation of an EAR descriptor (application.xml) to provide convenience methods for easy access and manipulation.

Version:
$Id: ApplicationXml.java 1705 2008-09-02 13:14:55Z adriana $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jdom.Document
baseURI
 
Constructor Summary
ApplicationXml(org.jdom.Element rootElement, DescriptorType type)
          Constructor.
 
Method Summary
 void addEjbModule(String name)
          Adds a ejb module to the deployment descriptor.
 void addWebModule(String uri, String context)
          Adds a web module to the deployment descriptor.
 Iterator getEjbModules()
          Returns an iterator over the ejb modules defined in the descriptor.
 Iterator getElements(ApplicationXmlTag tag)
          Returns an iterator over the elements that match the specified tag.
 String getFileName()
          Returns the file name of this descriptor.
 Iterator getVendorDescriptors()
          Returns all vendor descriptors associated with this J2EE deployment descriptor.
 ApplicationXmlVersion getVersion()
           
 org.jdom.Element getWebModule(String webUri)
          Returns the element that contains the definition of a specific web module, or null if a web module with the specified web-uri is not defined.
 String getWebModuleContextRoot(String webUri)
          Returns the context root of the the specified web module.
 Iterator getWebModuleUris()
          Returns an iterator over the URIs of the web modules defined in the descriptor.
 
Methods inherited from class org.codehaus.cargo.module.AbstractDescriptor
addElement, checkElement, createNestedText, getChildText, getChildText, getDescriptorType, getDocument, getElements, getElements, getImmediateChild, getInsertionPointFor, getNestedElements, getNestedText, getTagByIdentifier, getTagByIdentifier, getTags, getTags, getText
 
Methods inherited from class org.jdom.Document
addContent, addContent, addContent, addContent, clone, cloneContent, detachRootElement, equals, getBaseURI, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getDocType, 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, getTags
 
Methods inherited from interface org.jdom.Parent
clone, cloneContent, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getParent, indexOf, removeContent, removeContent, removeContent, removeContent
 

Constructor Detail

ApplicationXml

public ApplicationXml(org.jdom.Element rootElement,
                      DescriptorType type)
Constructor.

Parameters:
rootElement - the root element for this descriptor
type - the type of this descriptor
Method Detail

getVersion

public ApplicationXmlVersion getVersion()
Returns:
The J2EE API version.

getWebModule

public org.jdom.Element getWebModule(String webUri)
Returns the element that contains the definition of a specific web module, or null if a web module with the specified web-uri is not defined.

Parameters:
webUri - The uri of the web module
Returns:
The DOM element representing the web module definition

getWebModuleContextRoot

public String getWebModuleContextRoot(String webUri)
Returns the context root of the the specified web module.

Parameters:
webUri - The uri of the web module
Returns:
The context root of the web module

getWebModuleUris

public Iterator getWebModuleUris()
Returns an iterator over the URIs of the web modules defined in the descriptor.

Returns:
An iterator over the URIs of the web modules

getEjbModules

public Iterator getEjbModules()
Returns an iterator over the ejb modules defined in the descriptor.

Returns:
An iterator of Strings over the ejb modules

getElements

public Iterator getElements(ApplicationXmlTag tag)
Returns an iterator over the elements that match the specified tag.

Parameters:
tag - The descriptor tag of which the elements should be returned
Returns:
An iterator over the elements matching the tag, in the order they occur in the descriptor

addWebModule

public void addWebModule(String uri,
                         String context)
Adds a web module to the deployment descriptor.

Parameters:
uri - the uri of the new module
context - the context of the new module

addEjbModule

public void addEjbModule(String name)
Adds a ejb module to the deployment descriptor.

Parameters:
name - the name of the new module

getVendorDescriptors

public Iterator getVendorDescriptors()
Returns all vendor descriptors associated with this J2EE deployment descriptor. For example for JBoss the vendor descriptor associated with web.xml is jboss-web.xml.

Specified by:
getVendorDescriptors in interface J2eeDescriptor
Returns:
Iterator containing Descriptor objects
See Also:
J2eeDescriptor.getVendorDescriptors()

getFileName

public String getFileName()
Returns the file name of this descriptor. For example "web.xml", "weblogic.xml", etc.

Specified by:
getFileName in interface Descriptor
Returns:
the file name
See Also:
Descriptor.getFileName()


Copyright © 2004-2012 Codehaus. All Rights Reserved.