|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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.
Constructor Summary | |
---|---|
AbstractDescriptor(org.w3c.dom.Document document,
Grammar grammar)
Constructor. |
Method Summary | |
---|---|
protected org.w3c.dom.Element |
addElement(DescriptorTag tag,
org.w3c.dom.Element child,
org.w3c.dom.Element parent)
Adds an element of the specified tag to the descriptor. |
protected void |
checkElement(org.w3c.dom.Element element,
DescriptorTag expectedTag)
Checks an element whether its name matches the specified name. |
protected org.w3c.dom.Element |
createNestedText(DescriptorTag tag,
java.lang.String text)
Creates an element that contains nested text. |
protected java.lang.String |
getChildText(org.w3c.dom.Element parent,
DescriptorTag tag)
Returns the text value from a child directly under the parent tag. |
org.w3c.dom.Document |
getDocument()
Returns the DOM document representing the deployment descriptor. |
java.util.Iterator |
getElements(DescriptorTag tag)
Returns an iterator over the elements that match the specified tag. |
protected org.w3c.dom.Element |
getImmediateChild(org.w3c.dom.Element parent,
DescriptorTag tag)
Gets a certain tag directly under the parent tag. |
protected org.w3c.dom.Node |
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.w3c.dom.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.w3c.dom.Element parent,
DescriptorTag tag)
Returns the text nested inside a child element of the specified element. |
org.w3c.dom.Element |
getRootElement()
|
protected java.lang.String |
getText(org.w3c.dom.Element element)
Returns the text value of an element. |
org.w3c.dom.Element |
replaceElement(DescriptorTag tag,
org.w3c.dom.Element child,
org.w3c.dom.Element parent)
Replaces all elements of the specified tag with the provided element. |
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.Descriptor |
---|
getFileName |
Constructor Detail |
---|
public AbstractDescriptor(org.w3c.dom.Document document, Grammar grammar)
document
- The DOM document representing the parsed deployment descriptorgrammar
- The DTD of the descriptorMethod Detail |
---|
public org.w3c.dom.Document getDocument()
getDocument
in interface Descriptor
public org.w3c.dom.Element getRootElement()
public java.util.Iterator getElements(DescriptorTag tag)
tag
- The descriptor tag of which the elements should be returned
protected void checkElement(org.w3c.dom.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.w3c.dom.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.w3c.dom.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.w3c.dom.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.w3c.dom.Element element)
element
- the element of wich the text value should be returned
protected org.w3c.dom.Element getImmediateChild(org.w3c.dom.Element parent, DescriptorTag tag)
parent
- the tag to get the cild fromtag
- name of the child tag
protected java.lang.String getChildText(org.w3c.dom.Element parent, DescriptorTag tag)
parent
- the parent tag to get the child text fromtag
- the name of the child tag
protected org.w3c.dom.Element addElement(DescriptorTag tag, org.w3c.dom.Element child, org.w3c.dom.Element parent)
tag
- The descriptor tagchild
- The child element to addparent
- The parent element to add the child to
public org.w3c.dom.Element replaceElement(DescriptorTag tag, org.w3c.dom.Element child, org.w3c.dom.Element parent)
tag
- The descriptor tagchild
- The element to replace the current elements withparent
- The parent element to add the child to
protected org.w3c.dom.Node 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |