Class DeploymentDescriptorNode<T>
- java.lang.Object
-
- com.sun.enterprise.deployment.node.DeploymentDescriptorNode<T>
-
- All Implemented Interfaces:
XMLNode<T>
- Direct Known Subclasses:
AbsoluteOrderingNode
,ActivationConfigNode
,ActivationConfigNode
,ActivationSpecNode
,AdministeredObjectDefinitionNode
,AdminObjectNode
,ApplicationParamNode
,AroundInvokeNode
,AuthConstraintNode
,AuthMechNode
,BeanCacheNode
,BeanPoolNode
,CheckpointAtEndOfMethodNode
,CmpFieldNode
,CmpNode
,ConcurrentMethodNode
,ConfigPropertyNode
,ConfigurableNode
,ConnectionDefNode
,ConnectionFactoryDefinitionNode
,ContainerTransactionNode
,ContextServiceDefinitionNode
,CookieConfigNode
,DataSourceDefinitionNode
,DefaultResourcePrincipalNode
,DisplayableComponentNode
,EjbApplicationExceptionNode
,EjbInitNode
,EjbInterceptorNode
,EjbNode
,EjbReferenceNode
,EjbRefNode
,EjbRelationNode
,EjbRelationshipRoleNode
,EjbRemoveNode
,EntityManagerFactoryReferenceNode
,EntityManagerReferenceNode
,EnvEntryNode
,ErrorPageNode
,ExcludeListNode
,FilterMappingNode
,FinderNode
,FlushAtEndOfMethodNode
,GroupNode
,InBoundRANode
,InitParamNode
,InjectionTargetNode
,InterceptorBindingNode
,IORConfigurationNode
,JavaWebStartAccessNode
,JMSConnectionFactoryDefinitionNode
,JMSDestinationDefinitionNode
,JnlpDocNode
,JspConfigNode
,JspGroupNode
,LicenseNode
,LifecycleCallbackNode
,LocaleEncodingMappingListNode
,LocaleEncodingMappingNode
,LocalizedNode
,LoginConfigNode
,MailConfigurationNode
,MailSessionNode
,ManagedExecutorDefinitionNode
,ManagedScheduledExecutorDefinitionNode
,ManagedThreadFactoryDefinitionNode
,MDBConnectionFactoryNode
,MDBResourceAdapterNode
,MessageDestinationRefNode
,MessageDestinationRefNode
,MessageDestinationRuntimeNode
,MessageListenerNode
,MessageNode
,MessageSecurityBindingNode
,MessageSecurityNode
,MethodNode
,MethodPermissionNode
,MimeMappingNode
,ModuleNode
,MultipartConfigNode
,NameValuePairNode
,OrderingNode
,OrderingOrderingNode
,OutBoundRANode
,PermissionItemNode
,PersistenceUnitNode
,PrefetchDisabledNode
,PrincipalNode
,PropertiesNode
,ProtectionNode
,QueryNode
,RANode
,RelationshipsNode
,ReliabilityConfigNode
,RequiredConfigNode
,ResourceEnvRefNode
,ResourceEnvRefNode
,ResourcePropertyNode
,ResourceRefNode
,ResourceRefNode
,RunAsNode
,RuntimeBundleNode
,RuntimeDescriptorNode
,ScheduledTimerNode
,SecurityConstraintNode
,SecurityIdentityNode
,SecurityPermissionNode
,SecurityRoleNode
,SecurityRoleRefNode
,ServiceRefNode
,ServiceRefPortInfoRuntimeNode
,ServletMappingNode
,ServletNode
,SessionConfigNode
,TagLibNode
,TimeoutValueNode
,UserDataConstraintNode
,WebCacheNode
,WebResourceCollectionNode
,WebServiceEndpointRuntimeNode
,WebServiceRuntimeNode
,WLServiceRefNode
,WLServiceRefPortInfoRuntimeNode
,WLUnSupportedNode
,WLWebServiceEndpointNode
,WLWebServiceEndpointNode.ServiceEndpointAddressNode
,WLWebServiceEndpointNode.WSDLNode
public abstract class DeploymentDescriptorNode<T> extends Object implements XMLNode<T>
Superclass of all Nodes implementation XMLNode implementation represents all the DOL classes responsible for handling the XML deployment descriptors. These nodes are called by the SAX parser when reading and are constructed to build the DOM tree for saving the XML files. XMLNode are organized like a tree with one root XMLNode (which implement the RootXMLNode interface) and sub XMLNodes responsible for handling subparts of the XML documents. Sub XMLNodes register themselves to their parent XMLNode as handlers for a particular XML subtag of the tag handled by the parent XMLNode Each XMLNode is therefore associated with a xml tag (located anywhere in the tree of tags as defined by the DTD). It owns the responsibility for reading and writing the tag, its attributes and all subtags (by using delegation to sub XMLNode if necessary).- Version:
- Author:
- Jerome Dochez
-
-
Field Summary
Fields Modifier and Type Field Description protected Object
abstractDescriptor
protected Hashtable<String,Class>
handlers
protected static LocalStringManagerImpl
localStrings
protected XMLNode
parentNode
protected XMLNode
rootNode
protected org.glassfish.hk2.api.ServiceLocator
serviceLocator
-
Constructor Summary
Constructors Constructor Description DeploymentDescriptorNode()
Creates new DeploymentDescriptorNode
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDescriptor(Object descriptor)
Adds a new DOL descriptor instance to the descriptor instance associated with this XMLNodeprotected 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 XMLNodevoid
addPrefixMapping(String prefix, String uri)
notify of a new prefix mapping used in this documentstatic Element
appendChild(Node parent, String elementName)
Append a new element child to the current nodevoid
appendQNameChild(String elementName, Node parent, String namespaceUri, String localPart, String prefix)
static Node
appendTextChild(Node parent, String elementName, int value)
Append a new text childstatic Node
appendTextChild(Node parent, String elementName, String text)
Append a new text childString
composeQNameValue(String prefix, String localPart)
protected Object
createDescriptor()
boolean
endElement(XMLElement element)
receives notification of the end of an XML element by the Parserstatic Node
forceAppendTextChild(Node parent, String elementName, String text)
Append a new text child even if text is emptyT
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 nodeString
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 elementvoid
postParsing()
notification of the end of XML parsing for this nodeprotected 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 elementstatic 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 elementprotected void
setDescriptorInfo(Object target, String methodName, String value)
call a setter method on a descriptor with a new valuevoid
setElementValue(XMLElement element, String value)
receives notification of the value for a particular tagvoid
setParentNode(XMLNode parentNode)
set the parent node for the current instance.protected void
setXMLRootTag(XMLElement element)
sets the XML tag associated with this XMLNodevoid
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 itNode
writeDescriptor(Node parent, T descriptor)
write the descriptor class to a DOM tree and return itNode
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<EjbReference> refs)
write the ejb references (local or remote) to the DOM treeprotected void
writeEntityManagerFactoryReferenceDescriptors(Node parentNode, Iterator<EntityManagerFactoryReferenceDescriptor> entityMgrFactoryRefs)
write a list of entity manager factory reference descriptors to a DOM Treeprotected void
writeEntityManagerReferenceDescriptors(Node parentNode, Iterator<EntityManagerReferenceDescriptor> entityMgrRefs)
write a list of entity manager reference descriptors to a DOM Treeprotected void
writeEnvEntryDescriptors(Node parentNode, Iterator envEntries)
write a list of env entry descriptors to a DOM Treeprotected void
writeJNDIEnvironmentRefs(Node node, JndiNameEnvironment descriptor)
writes jndi environment references group nodesprotected void
writeLifeCycleCallbackDescriptors(Node parentNode, String tagName, Collection<LifecycleCallbackDescriptor> lifecycleCallbacks)
write a list of life-cycle-callback descriptors to a DOM Treeprotected void
writeLocalizedDescriptions(Node node, Descriptor desc)
writes iocalized descriptions (if any) to the DOM nodeprotected void
writeMessageDestinationRefDescriptors(Node parentNode, Iterator<? extends MessageDestinationReferencer> msgDestRefs)
write a list of message destination reference descriptors to a DOM Treeprotected void
writeResourceDescriptors(Node parentNode, Iterator<ResourceDescriptor> descriptorIterator)
write a list of all descriptors to a DOM Treeprotected void
writeResourceEnvRefDescriptors(Node parentNode, Iterator<ResourceEnvReferenceDescriptor> resRefs)
write a list of resource env reference descriptors to a DOM Treeprotected void
writeResourceRefDescriptors(Node parentNode, Iterator resRefs)
write a list of resource reference descriptors to a DOM Treeprotected 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.
-
-
-
Field Detail
-
serviceLocator
protected org.glassfish.hk2.api.ServiceLocator serviceLocator
-
parentNode
protected XMLNode parentNode
-
rootNode
protected XMLNode rootNode
-
abstractDescriptor
protected Object abstractDescriptor
-
localStrings
protected static final LocalStringManagerImpl localStrings
-
-
Method Detail
-
getDescriptor
public T getDescriptor()
- Specified by:
getDescriptor
in interfaceXMLNode<T>
- Returns:
- the descriptor instance to associate with this XMLNode
-
createDescriptor
protected Object createDescriptor()
-
addDescriptor
public void addDescriptor(Object descriptor)
Adds a new DOL descriptor instance to the descriptor instance associated with this XMLNode- Specified by:
addDescriptor
in interfaceXMLNode<T>
- Parameters:
descriptor
- the new descriptor
-
addNodeDescriptor
protected void addNodeDescriptor(DeploymentDescriptorNode node)
Adds a new DOL descriptor instance to the descriptor associated with this XMLNode- Parameters:
node
- the sub-node adding the descriptor;
-
setParentNode
public void setParentNode(XMLNode parentNode)
set the parent node for the current instance.
-
getParentNode
public XMLNode getParentNode()
- Specified by:
getParentNode
in interfaceXMLNode<T>
- Returns:
- the parent node of the current instance
-
getRootNode
public XMLNode getRootNode()
- Specified by:
getRootNode
in interfaceXMLNode<T>
- Returns:
- the root node of the current instance
-
registerElementHandler
protected void registerElementHandler(XMLElement element, Class handler)
register a new XMLNode handler for a particular XML tag.- Parameters:
element
- XMLElement is the XML tag this XMLNode will handlehandler
- the class implemenenting the XMLNode interface
-
registerElementHandler
public void registerElementHandler(XMLElement element, Class handler, String addMethodName)
register a new XMLNode handler for a particular XML tag.- Parameters:
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 descriptor
-
getXMLRootTag
protected XMLElement getXMLRootTag()
- Returns:
- the XML tag associated with this XMLNode
-
setXMLRootTag
protected void setXMLRootTag(XMLElement element)
sets the XML tag associated with this XMLNode
-
getHandlerFor
public XMLNode getHandlerFor(XMLElement element)
Description copied from interface:XMLNode
Return the XMLNode implementation respionsible for handling the sub-element of the current node- Specified by:
getHandlerFor
in interfaceXMLNode<T>
- Parameters:
element
- the XML element type name- Returns:
- the handler registered for the subtag element of the curent XMLNode
-
startElement
public void startElement(XMLElement element, Attributes attributes)
SAX Parser API implementation, we don't really care for now.- Specified by:
startElement
in interfaceXMLNode<T>
- Parameters:
element
- the XML element type nameattributes
- the specified or defaultted attritutes
-
setAttributeValue
protected boolean setAttributeValue(XMLElement elementName, XMLElement attributeName, String value)
parsed an attribute of an element- Parameters:
elementName
- the element nameattributeName
- the attribute namevalue
- the attribute value- Returns:
- true if the attribute was processed
-
endElement
public boolean endElement(XMLElement element)
receives notification of the end of an XML element by the Parser- Specified by:
endElement
in interfaceXMLNode<T>
- Parameters:
element
- the xml tag identification- Returns:
- true if this node is done processing the XML sub tree
-
postParsing
public void postParsing()
notification of the end of XML parsing for this node
-
handlesElement
public boolean handlesElement(XMLElement element)
Description copied from interface:XMLNode
Return true if the XMLNode is responisble for handling the XML element- Specified by:
handlesElement
in interfaceXMLNode<T>
- Parameters:
element
- the XML element type name- Returns:
- true if the element tag can be handled by any registered sub nodes of the current XMLNode
-
setElementValue
public void setElementValue(XMLElement element, String value)
receives notification of the value for a particular tag- Specified by:
setElementValue
in interfaceXMLNode<T>
- Parameters:
element
- the xml elementvalue
- it's associated value
-
getDispatchTable
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.- Returns:
- the map with the element name as a key, the setter method as a value
-
setDescriptorInfo
protected void setDescriptorInfo(Object target, String methodName, String value) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
call a setter method on a descriptor with a new value- Parameters:
target
- the descriptor to usemethodName
- the setter method to invokevalue
- the new value for the field in the descriptor- Throws:
NoSuchMethodException
IllegalAccessException
InvocationTargetException
-
getXMLPath
public String getXMLPath()
- Specified by:
getXMLPath
in interfaceXMLNode<T>
- Returns:
- the XPath this XML Node is handling
-
writeDescriptor
public Node writeDescriptor(Node parent, T descriptor)
write the descriptor class to a DOM tree and return it- Specified by:
writeDescriptor
in interfaceXMLNode<T>
- Parameters:
parent
- node in the DOM treedescriptor
- the descriptor to write- Returns:
- the DOM tree top node
-
writeDescriptor
public Node writeDescriptor(Node parent, String nodeName, T descriptor)
write the descriptor class to a DOM tree and return it- Parameters:
parent
- node in the DOM treenodeName
- name for the root element for this DOM tree fragmentdescriptor
- the descriptor to write- Returns:
- the DOM tree top node
-
writeDescriptors
public 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. This method should be overriden by the sub classes if it needs to be called by the parent node.- Parameters:
parent
- node in the DOM treenodeName
- the name of the nodeparentDesc
- parent descriptor of the descriptor to be written- Returns:
- the JAXP DOM node
-
writeSimpleTextDescriptor
public 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. And this API is to write out the simple text sub element that the parent node handles itself. This method should be overriden by the sub classes if it needs to be called by the parent node.- Parameters:
parent
- node in the DOM treenodeName
- node name of the nodeparentDesc
- parent descriptor of the descriptor to be written- Returns:
- the JAXP DOM node
-
writeSubDescriptors
public 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.- Parameters:
node
- current node in the DOM treenodeName
- node name of the nodedescriptor
- the descriptor to be written- Returns:
- the JAXP DOM node for this descriptor
-
getOwnerDocument
protected static Document getOwnerDocument(Node node)
- Returns:
- the Document for the given node
-
appendChild
public static Element appendChild(Node parent, String elementName)
Append a new element child to the current node
- Parameters:
parent
- is the parent node for the new child elementelementName
- is new element tag name- Returns:
- the newly created child node
-
appendTextChild
public static Node appendTextChild(Node parent, String elementName, String text)
Append a new text child
- Parameters:
parent
- for the new child elementelementName
- is the new element tag nametext
- the text for the new element
-
appendTextChild
public static Node appendTextChild(Node parent, String elementName, int value)
Append a new text child
- Parameters:
parent
- for the new child elementelementName
- is the new element tag namevalue
- the int value for the new element
-
forceAppendTextChild
public static Node forceAppendTextChild(Node parent, String elementName, String text)
Append a new text child even if text is empty
- Parameters:
parent
- for the new child elementelementName
- is the new element tag nametext
- the text for the new element
-
setAttribute
public static void setAttribute(Element parent, String elementName, String text)
Append a new attribute to an element
- Parameters:
parent
- for the new child elementelementName
- is the new element tag nametext
- the text for the new element
-
setAttributeNS
public static void setAttributeNS(Element element, String prefix, String namespaceURI)
Set a namespace attribute on an element.- Parameters:
element
- on which to set attributeprefix
- raw prefix (without "xmlns:")namespaceURI
- namespace URI to which prefix is mapped.
-
writeEnvEntryDescriptors
protected void writeEnvEntryDescriptors(Node parentNode, Iterator envEntries)
write a list of env entry descriptors to a DOM Tree- Parameters:
parentNode
- parent node for the DOM treeenvEntries
- the iterator over the descriptors to write
-
writeEjbReferenceDescriptors
protected void writeEjbReferenceDescriptors(Node parentNode, Iterator<EjbReference> refs)
write the ejb references (local or remote) to the DOM tree- Parameters:
parentNode
- parent node for the DOM treerefs
- the set of EjbReferenceDescriptor to write
-
writeServiceReferenceDescriptors
protected void writeServiceReferenceDescriptors(Node parentNode, Iterator refs)
-
writeResourceRefDescriptors
protected void writeResourceRefDescriptors(Node parentNode, Iterator resRefs)
write a list of resource reference descriptors to a DOM Tree- Parameters:
parentNode
- parent node for the DOM treeresRefs
- the iterator over the descriptors to write
-
writeResourceEnvRefDescriptors
protected void writeResourceEnvRefDescriptors(Node parentNode, Iterator<ResourceEnvReferenceDescriptor> resRefs)
write a list of resource env reference descriptors to a DOM Tree- Parameters:
parentNode
- parent node for the DOM treeresRefs
- the iterator over the descriptors to write
-
writeMessageDestinationRefDescriptors
protected void writeMessageDestinationRefDescriptors(Node parentNode, Iterator<? extends MessageDestinationReferencer> msgDestRefs)
write a list of message destination reference descriptors to a DOM Tree- Parameters:
parentNode
- parent node for the DOM treemsgDestRefs
- the iterator over the descriptors to write
-
writeEntityManagerReferenceDescriptors
protected void writeEntityManagerReferenceDescriptors(Node parentNode, Iterator<EntityManagerReferenceDescriptor> entityMgrRefs)
write a list of entity manager reference descriptors to a DOM Tree- Parameters:
parentNode
- parent node for the DOM treeentityMgrRefs
- the iterator over the descriptors to write
-
writeEntityManagerFactoryReferenceDescriptors
protected void writeEntityManagerFactoryReferenceDescriptors(Node parentNode, Iterator<EntityManagerFactoryReferenceDescriptor> entityMgrFactoryRefs)
write a list of entity manager factory reference descriptors to a DOM Tree- Parameters:
parentNode
- parent node for the DOM treeentityMgrFactoryRefs
- the iterator over the descriptors to write
-
writeLifeCycleCallbackDescriptors
protected void writeLifeCycleCallbackDescriptors(Node parentNode, String tagName, Collection<LifecycleCallbackDescriptor> lifecycleCallbacks)
write a list of life-cycle-callback descriptors to a DOM Tree- Parameters:
parentNode
- parent node for the DOM treetagName
- the tag name for the descriptorslifecycleCallbacks
- the iterator over the descriptors to write
-
writeResourceDescriptors
protected void writeResourceDescriptors(Node parentNode, Iterator<ResourceDescriptor> descriptorIterator)
write a list of all descriptors to a DOM Tree- Parameters:
parentNode
- parent node for the DOM treedescriptorIterator
- the iterator over the descriptors to write
-
writeLocalizedDescriptions
protected void writeLocalizedDescriptions(Node node, Descriptor desc)
writes iocalized descriptions (if any) to the DOM node
-
writeJNDIEnvironmentRefs
protected void writeJNDIEnvironmentRefs(Node node, JndiNameEnvironment descriptor)
writes jndi environment references group nodes
-
addNamespaceDeclaration
protected void addNamespaceDeclaration(Element node, Descriptor descriptor)
Any node can now declare its own namespace. this apply to DDs only when dealing with deployment extensions. Write any declared namespace declaration- Parameters:
node
- from which this namespace is declareddescriptor
- containing the namespace declaration if any
-
addPrefixMapping
public void addPrefixMapping(String prefix, String uri)
notify of a new prefix mapping used in this document- Specified by:
addPrefixMapping
in interfaceXMLNode<T>
-
resolvePrefix
public String resolvePrefix(XMLElement element, String prefix)
Resolve a QName prefix to its corresponding Namespace URI by searching up node chain starting with child.- Specified by:
resolvePrefix
in interfaceXMLNode<T>
-
getPrefixFromQName
public String getPrefixFromQName(String qname)
- Returns:
- namespace URI prefix from qname, where qname is an xsd:QName, or the empty string if there is no prefix. QName ::= (Prefix ':')? LocalPart
-
getLocalPartFromQName
public String getLocalPartFromQName(String qname)
Return local part from qname, where qname is an xsd:QName. QName ::= (Prefix ':')? LocalPart
-
-