|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdom.Document
org.codehaus.cargo.module.AbstractDescriptor
public abstract class AbstractDescriptor
Encapsulates the DOM representation of a deployment descriptor to provide convenience methods for easy access and manipulation.
Field Summary |
---|
Fields inherited from class org.jdom.Document |
---|
baseURI |
Constructor Summary | |
---|---|
AbstractDescriptor(org.jdom.Element rootElement,
DescriptorType descriptorType)
Constructor. |
Method Summary | |
---|---|
org.jdom.Element |
addElement(DescriptorTag tag,
org.jdom.Element child,
org.jdom.Element parent)
Adds an element of the specified tag to the descriptor. |
protected void |
checkElement(org.jdom.Element element,
DescriptorTag expectedTag)
Checks an element whether its name matches the specified name. |
protected org.jdom.Element |
createNestedText(DescriptorTag tag,
java.lang.String text)
Creates an element that contains nested text. |
protected java.lang.String |
getChildText(org.jdom.Element parent,
DescriptorTag tag)
Returns the text value from a child directly under the parent tag. |
protected java.lang.String |
getChildText(org.jdom.Element parent,
java.lang.String tagName)
Returns the text value from a child directly under the parent tag. |
DescriptorType |
getDescriptorType()
Get the descriptor type for this descriptor. |
org.jdom.Document |
getDocument()
Return the representation as a document. |
java.util.Iterator |
getElements(DescriptorTag tag)
Returns an iterator over the elements that match the specified tag. |
java.util.Iterator |
getElements(java.lang.String tagName)
Returns an iterator over the elements that match the specified tag. |
protected org.jdom.Element |
getImmediateChild(org.jdom.Element parent,
DescriptorTag tag)
Gets a certain tag directly under the parent tag. |
protected org.jdom.Element |
getInsertionPointFor(DescriptorTag tag,
java.lang.String parent)
Returns the node before which the specified tag should be inserted, or null if
the node should be inserted at the end of the descriptor. |
protected java.util.Iterator |
getNestedElements(org.jdom.Element parent,
DescriptorTag tag)
Returns an iterator over the child elements of the specified element that match the specified tag. |
protected java.lang.String |
getNestedText(org.jdom.Element parent,
DescriptorTag tag)
Returns the text nested inside a child element of the specified element. |
org.jdom.Element |
getTagByIdentifier(DescriptorTag tag,
java.lang.String value)
Get elements of a particular descriptor tag whose identifier matches the passed parameter. |
org.jdom.Element |
getTagByIdentifier(java.lang.String tagName,
java.lang.String value)
Get elements of a particular descriptor tag whose identifier matches the passed parameter. |
java.util.List |
getTags(DescriptorTag tag)
Get tags of a particular type. |
java.util.List |
getTags(java.lang.String tagName)
Get tags of a particular type. |
protected java.lang.String |
getText(org.jdom.Element element)
Returns the text value of an element. |
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 |
---|
getFileName, getRootElement |
Methods inherited from interface org.jdom.Parent |
---|
clone, cloneContent, getContent, getContent, getContent, getContentSize, getDescendants, getDescendants, getParent, indexOf, removeContent, removeContent, removeContent, removeContent |
Constructor Detail |
---|
public AbstractDescriptor(org.jdom.Element rootElement, DescriptorType descriptorType)
rootElement
- The root element of the documentdescriptorType
- The type of the descriptorMethod Detail |
---|
public org.jdom.Document getDocument()
getDocument
in interface Descriptor
getDocument
in interface org.jdom.Parent
getDocument
in class org.jdom.Document
public java.util.List getTags(DescriptorTag tag)
getTags
in interface Descriptor
tag
- type of elements to find
public java.util.List getTags(java.lang.String tagName)
tagName
- type of elements to find
public java.util.Iterator getElements(DescriptorTag tag)
tag
- The descriptor tag of which the elements should be returned
public java.util.Iterator getElements(java.lang.String tagName)
tagName
- The name of a descriptor tag of which the elements should be returned
protected void checkElement(org.jdom.Element element, DescriptorTag expectedTag) throws java.lang.IllegalArgumentException
element
- The element to checkexpectedTag
- The expected tag name
java.lang.IllegalArgumentException
- If the element name doesn't matchprotected java.util.Iterator getNestedElements(org.jdom.Element parent, DescriptorTag tag)
parent
- The element of which the nested elements should be retrievedtag
- The descriptor tag of which the elements should be returned
protected org.jdom.Element createNestedText(DescriptorTag tag, java.lang.String text)
tag
- The tag to create an instance oftext
- The text that should be nested in the element
protected java.lang.String getNestedText(org.jdom.Element parent, DescriptorTag tag)
parent
- The element of which the nested text should be returnedtag
- The descriptor tag in which the text is nested
protected java.lang.String getText(org.jdom.Element element)
element
- the element of wich the text value should be returned
protected org.jdom.Element getImmediateChild(org.jdom.Element parent, DescriptorTag tag)
parent
- the tag to get the cild fromtag
- name of the child tag
protected java.lang.String getChildText(org.jdom.Element parent, DescriptorTag tag)
parent
- the parent tag to get the child text fromtag
- the name of the child tag
protected java.lang.String getChildText(org.jdom.Element parent, java.lang.String tagName)
parent
- the parent tag to get the child text fromtagName
- the name of the child tag
public org.jdom.Element addElement(DescriptorTag tag, org.jdom.Element child, org.jdom.Element parent)
addElement
in interface Descriptor
tag
- The descriptor tagchild
- The child element to addparent
- The parent element to add the child to
protected org.jdom.Element getInsertionPointFor(DescriptorTag tag, java.lang.String parent)
null
if
the node should be inserted at the end of the descriptor.
tag
- The tag that should be insertedparent
- name of the parent tag
public DescriptorType getDescriptorType()
Descriptor
getDescriptorType
in interface Descriptor
public org.jdom.Element getTagByIdentifier(DescriptorTag tag, java.lang.String value)
getTagByIdentifier
in interface Descriptor
tag
- tag to search forvalue
- value for the identifier to match
public org.jdom.Element getTagByIdentifier(java.lang.String tagName, java.lang.String value)
tagName
- Name of the tag to search forvalue
- value for the identifier to match
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |