public abstract class DeploymentDescriptorNode<T> extends Object implements XMLNode<T>
| Modifier and Type | Field and Description |
|---|---|
protected Object |
abstractDescriptor |
protected org.glassfish.hk2.api.ServiceLocator |
habitat |
protected Hashtable<String,Class> |
handlers |
protected static LocalStringManagerImpl |
localStrings |
protected XMLNode |
parentNode |
protected XMLNode |
rootNode |
| Constructor and Description |
|---|
DeploymentDescriptorNode()
Creates new DeploymentDescriptorNode
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDescriptor(Object descriptor)
Adds a new DOL descriptor instance to the descriptor instance associated with
this XMLNode
|
protected void |
addNamespaceDeclaration(Element node,
Descriptor descriptor)
Any node can now declare its own namespace.
|
protected void |
addNodeDescriptor(DeploymentDescriptorNode node)
Adds a new DOL descriptor instance to the descriptor associated with this
XMLNode
|
void |
addPrefixMapping(String prefix,
String uri)
notify of a new prefix mapping used in this document
|
static Element |
appendChild(Node parent,
String elementName)
Append a new element child to the current node
|
void |
appendQNameChild(String elementName,
Node parent,
String namespaceUri,
String localPart,
String prefix) |
static Node |
appendTextChild(Node parent,
String elementName,
int value)
Append a new text child
|
static Node |
appendTextChild(Node parent,
String elementName,
String text)
Append a new text child
|
String |
composeQNameValue(String prefix,
String localPart) |
protected Object |
createDescriptor() |
boolean |
endElement(XMLElement element)
receives notification of the end of an XML element by the Parser
|
static Node |
forceAppendTextChild(Node parent,
String elementName,
String text)
Append a new text child even if text is empty
|
T |
getDescriptor() |
protected Map<String,String> |
getDispatchTable()
all sub-implementation of this class can use a dispatch table to map xml element to
method name on the descriptor class for setting the element value.
|
XMLNode |
getHandlerFor(XMLElement element)
Return the XMLNode implementation respionsible for
handling the sub-element of the current node
|
String |
getLocalPartFromQName(String qname)
Return local part from qname, where qname is an xsd:QName.
|
protected static Document |
getOwnerDocument(Node node) |
XMLNode |
getParentNode() |
String |
getPrefixFromQName(String qname) |
XMLNode |
getRootNode() |
String |
getXMLPath() |
protected XMLElement |
getXMLRootTag() |
boolean |
handlesElement(XMLElement element)
Return true if the XMLNode is responisble for handling the
XML element
|
void |
postParsing()
notification of the end of XML parsing for this node
|
protected void |
registerElementHandler(XMLElement element,
Class handler)
register a new XMLNode handler for a particular XML tag.
|
void |
registerElementHandler(XMLElement element,
Class handler,
String addMethodName)
register a new XMLNode handler for a particular XML tag.
|
String |
resolvePrefix(XMLElement element,
String prefix)
Resolve a QName prefix to its corresponding Namespace URI by
searching up node chain starting with child.
|
static void |
setAttribute(Element parent,
String elementName,
String text)
Append a new attribute to an element
|
static void |
setAttributeNS(Element element,
String prefix,
String namespaceURI)
Set a namespace attribute on an element.
|
protected boolean |
setAttributeValue(XMLElement elementName,
XMLElement attributeName,
String value)
parsed an attribute of an element
|
protected void |
setDescriptorInfo(Object target,
String methodName,
String value)
call a setter method on a descriptor with a new value
|
void |
setElementValue(XMLElement element,
String value)
receives notification of the value for a particular tag
|
void |
setParentNode(XMLNode parentNode)
set the parent node for the current instance.
|
protected void |
setXMLRootTag(XMLElement element)
sets the XML tag associated with this XMLNode
|
void |
startElement(XMLElement element,
Attributes attributes)
SAX Parser API implementation, we don't really care for now.
|
Node |
writeDescriptor(Node parent,
String nodeName,
T descriptor)
write the descriptor class to a DOM tree and return it
|
Node |
writeDescriptor(Node parent,
T descriptor)
write the descriptor class to a DOM tree and return it
|
Node |
writeDescriptors(Node parent,
String nodeName,
Descriptor parentDesc)
write all occurrences of the descriptor corresponding to the current
node from the parent descriptor to an JAXP DOM node and return it
This API will be invoked by the parent node when the parent node
writes out a mix of statically and dynamically registered sub nodes.
|
protected void |
writeEjbReferenceDescriptors(Node parentNode,
Iterator refs)
write the ejb references (local or remote) to the DOM tree
|
protected void |
writeEntityManagerFactoryReferenceDescriptors(Node parentNode,
Iterator entityMgrFactoryRefs)
write a list of entity manager factory reference descriptors to
a DOM Tree
|
protected void |
writeEntityManagerReferenceDescriptors(Node parentNode,
Iterator entityMgrRefs)
write a list of entity manager reference descriptors to a DOM Tree
|
protected void |
writeEnvEntryDescriptors(Node parentNode,
Iterator envEntries)
write a list of env entry descriptors to a DOM Tree
|
protected void |
writeJNDIEnvironmentRefs(Node node,
JndiNameEnvironment descriptor)
writes jndi environment references group nodes
|
protected void |
writeLifeCycleCallbackDescriptors(Node parentNode,
String tagName,
Collection<LifecycleCallbackDescriptor> lifecycleCallbacks)
write a list of life-cycle-callback descriptors to a DOM Tree
|
protected void |
writeLocalizedDescriptions(Node node,
Descriptor desc)
writes iocalized descriptions (if any) to the DOM node
|
protected void |
writeMessageDestinationRefDescriptors(Node parentNode,
Iterator msgDestRefs)
write a list of message destination reference descriptors to a DOM Tree
|
protected void |
writeResourceDescriptors(Node parentNode,
Iterator<ResourceDescriptor> descriptorIterator)
write a list of all descriptors to a DOM Tree
|
protected void |
writeResourceEnvRefDescriptors(Node parentNode,
Iterator resRefs)
write a list of resource env reference descriptors to a DOM Tree
|
protected void |
writeResourceRefDescriptors(Node parentNode,
Iterator resRefs)
write a list of resource reference descriptors to a DOM Tree
|
protected void |
writeServiceReferenceDescriptors(Node parentNode,
Iterator refs) |
Node |
writeSimpleTextDescriptor(Node parent,
String nodeName,
Descriptor parentDesc)
write out simple text element based on the node name
to an JAXP DOM node and return it
This API will be invoked by the parent node when the parent node
writes out a mix of statically and dynamically registered sub nodes.
|
Node |
writeSubDescriptors(Node node,
String nodeName,
Descriptor descriptor)
write out descriptor in a generic way to an JAXP DOM
node and return it
This API will generally be invoked when the parent node needs to
write out a mix of statically and dynamically registered sub nodes.
|
protected org.glassfish.hk2.api.ServiceLocator habitat
protected XMLNode parentNode
protected XMLNode rootNode
protected Object abstractDescriptor
protected static final LocalStringManagerImpl localStrings
public DeploymentDescriptorNode()
public T getDescriptor()
getDescriptor in interface XMLNode<T>protected Object createDescriptor()
public void addDescriptor(Object descriptor)
addDescriptor in interface XMLNode<T>descriptor - the new descriptorprotected void addNodeDescriptor(DeploymentDescriptorNode node)
node - the sub-node adding the descriptor;public void setParentNode(XMLNode parentNode)
public XMLNode getParentNode()
getParentNode in interface XMLNode<T>public XMLNode getRootNode()
getRootNode in interface XMLNode<T>protected void registerElementHandler(XMLElement element, Class handler)
element - XMLElement is the XML tag this XMLNode will handlehandler - the class implemenenting the XMLNode interfacepublic void registerElementHandler(XMLElement element, Class handler, String addMethodName)
element - XMLElement is the XML tag this XMLNode will handlehandler - the class implemenenting the XMLNode interfaceaddMethodName - is the method name for adding the descriptor
extracted by the handler node to the current descriptorprotected XMLElement getXMLRootTag()
protected void setXMLRootTag(XMLElement element)
public XMLNode getHandlerFor(XMLElement element)
XMLNodegetHandlerFor in interface XMLNode<T>element - the XML element type namepublic void startElement(XMLElement element, Attributes attributes)
startElement in interface XMLNode<T>element - the XML element type nameattributes - the specified or defaultted attritutesprotected boolean setAttributeValue(XMLElement elementName, XMLElement attributeName, String value)
elementName - the element nameattributeName - the attribute namevalue - the attribute valuepublic boolean endElement(XMLElement element)
endElement in interface XMLNode<T>element - the xml tag identificationpublic void postParsing()
public boolean handlesElement(XMLElement element)
XMLNodehandlesElement in interface XMLNode<T>element - the XML element type namepublic void setElementValue(XMLElement element, String value)
setElementValue in interface XMLNode<T>element - the xml elementvalue - it's associated valueprotected Map<String,String> getDispatchTable()
protected void setDescriptorInfo(Object target, String methodName, String value) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
target - the descriptor to usemethodName - the setter method to invokevalue - the new value for the field in the descriptorNoSuchMethodExceptionIllegalAccessExceptionInvocationTargetExceptionpublic String getXMLPath()
getXMLPath in interface XMLNode<T>public Node writeDescriptor(Node parent, T descriptor)
writeDescriptor in interface XMLNode<T>parent - node in the DOM treedescriptor - the descriptor to writepublic Node writeDescriptor(Node parent, String nodeName, T descriptor)
parent - node in the DOM treenodeName - name for the root element for this DOM tree fragmentdescriptor - the descriptor to writepublic Node writeDescriptors(Node parent, String nodeName, Descriptor parentDesc)
parent - node in the DOM treenodeName - the name of the nodeparentDesc - parent descriptor of the descriptor to be writtenpublic Node writeSimpleTextDescriptor(Node parent, String nodeName, Descriptor parentDesc)
parent - node in the DOM treenodeName - node name of the nodeparentDesc - parent descriptor of the descriptor to be writtenpublic Node writeSubDescriptors(Node node, String nodeName, Descriptor descriptor)
node - current node in the DOM treenodeName - node name of the nodedescriptor - the descriptor to be writtenprotected static Document getOwnerDocument(Node node)
public static Element appendChild(Node parent, String elementName)
Append a new element child to the current node
parent - is the parent node for the new child elementelementName - is new element tag namepublic static Node appendTextChild(Node parent, String elementName, String text)
Append a new text child
parent - for the new child elementelementName - is the new element tag nametext - the text for the new elementpublic static Node appendTextChild(Node parent, String elementName, int value)
Append a new text child
parent - for the new child elementelementName - is the new element tag namevalue - the int value for the new elementpublic static Node forceAppendTextChild(Node parent, String elementName, String text)
Append a new text child even if text is empty
parent - for the new child elementelementName - is the new element tag nametext - the text for the new elementpublic static void setAttribute(Element parent, String elementName, String text)
Append a new attribute to an element
parent - for the new child elementelementName - is the new element tag nametext - the text for the new elementpublic static void setAttributeNS(Element element, String prefix, String namespaceURI)
element - on which to set attributeprefix - raw prefix (without "xmlns:")namespaceURI - namespace URI to which prefix is mapped.protected void writeEnvEntryDescriptors(Node parentNode, Iterator envEntries)
parentNode - parent node for the DOM treeenvEntries - the iterator over the descriptors to writeprotected void writeEjbReferenceDescriptors(Node parentNode, Iterator refs)
parentNode - parent node for the DOM treerefs - the set of EjbReferenceDescriptor to writeprotected void writeServiceReferenceDescriptors(Node parentNode, Iterator refs)
protected void writeResourceRefDescriptors(Node parentNode, Iterator resRefs)
parentNode - parent node for the DOM treeresRefs - the iterator over the descriptors to writeprotected void writeResourceEnvRefDescriptors(Node parentNode, Iterator resRefs)
parentNode - parent node for the DOM treeresRefs - the iterator over the descriptors to writeprotected void writeMessageDestinationRefDescriptors(Node parentNode, Iterator msgDestRefs)
parentNode - parent node for the DOM treemsgDestRefs - the iterator over the descriptors to writeprotected void writeEntityManagerReferenceDescriptors(Node parentNode, Iterator entityMgrRefs)
parentNode - parent node for the DOM treeentityMgrRefs - the iterator over the descriptors to writeprotected void writeEntityManagerFactoryReferenceDescriptors(Node parentNode, Iterator entityMgrFactoryRefs)
parentNode - parent node for the DOM treeentityMgrFactoryRefs - the iterator over the descriptors to writeprotected void writeLifeCycleCallbackDescriptors(Node parentNode, String tagName, Collection<LifecycleCallbackDescriptor> lifecycleCallbacks)
parentNode - parent node for the DOM treetagName - the tag name for the descriptorslifecycleCallbacks - the iterator over the descriptors to writeprotected void writeResourceDescriptors(Node parentNode, Iterator<ResourceDescriptor> descriptorIterator)
parentNode - parent node for the DOM treedescriptorIterator - the iterator over the descriptors to writeprotected void writeLocalizedDescriptions(Node node, Descriptor desc)
protected void writeJNDIEnvironmentRefs(Node node, JndiNameEnvironment descriptor)
protected void addNamespaceDeclaration(Element node, Descriptor descriptor)
node - from which this namespace is declareddescriptor - containing the namespace declaration if anypublic void addPrefixMapping(String prefix, String uri)
addPrefixMapping in interface XMLNode<T>public String resolvePrefix(XMLElement element, String prefix)
resolvePrefix in interface XMLNode<T>public String getPrefixFromQName(String qname)
public String getLocalPartFromQName(String qname)
Copyright © 2017. All rights reserved.