Class DeploymentDescriptorNode<T>

    • Field Detail

      • serviceLocator

        protected org.glassfish.hk2.api.ServiceLocator serviceLocator
      • parentNode

        protected XMLNode parentNode
      • rootNode

        protected XMLNode rootNode
      • abstractDescriptor

        protected Object abstractDescriptor
    • Constructor Detail

      • DeploymentDescriptorNode

        public DeploymentDescriptorNode()
        Creates new DeploymentDescriptorNode
    • Method Detail

      • getDescriptor

        public T getDescriptor()
        Specified by:
        getDescriptor in interface XMLNode<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 interface XMLNode<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 interface XMLNode<T>
        Returns:
        the parent node of the current instance
      • getRootNode

        public XMLNode getRootNode()
        Specified by:
        getRootNode in interface XMLNode<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 handle
        handler - 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 handle
        handler - the class implemenenting the XMLNode interface
        addMethodName - 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 interface XMLNode<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 interface XMLNode<T>
        Parameters:
        element - the XML element type name
        attributes - 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 name
        attributeName - the attribute name
        value - 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 interface XMLNode<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 interface XMLNode<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 interface XMLNode<T>
        Parameters:
        element - the xml element
        value - 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
      • getXMLPath

        public String getXMLPath()
        Specified by:
        getXMLPath in interface XMLNode<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 interface XMLNode<T>
        Parameters:
        parent - node in the DOM tree
        descriptor - 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 tree
        nodeName - name for the root element for this DOM tree fragment
        descriptor - 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 tree
        nodeName - the name of the node
        parentDesc - 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 tree
        nodeName - node name of the node
        parentDesc - 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 tree
        nodeName - node name of the node
        descriptor - 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 element
        elementName - 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 element
        elementName - is the new element tag name
        text - 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 element
        elementName - is the new element tag name
        value - 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 element
        elementName - is the new element tag name
        text - 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 element
        elementName - is the new element tag name
        text - 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 attribute
        prefix - 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 tree
        envEntries - 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 tree
        refs - 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 tree
        resRefs - 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 tree
        resRefs - 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 tree
        msgDestRefs - 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 tree
        entityMgrRefs - 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 tree
        entityMgrFactoryRefs - 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 tree
        tagName - the tag name for the descriptors
        lifecycleCallbacks - 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 tree
        descriptorIterator - 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 declared
        descriptor - 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 interface XMLNode<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 interface XMLNode<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
      • composeQNameValue

        public String composeQNameValue​(String prefix,
                                        String localPart)
      • appendQNameChild

        public void appendQNameChild​(String elementName,
                                     Node parent,
                                     String namespaceUri,
                                     String localPart,
                                     String prefix)