FileDocCategorySizeDatePackage
RelationshipsNode.javaAPI DocGlassfish v2 API4920Fri May 04 22:31:40 BST 2007com.sun.enterprise.deployment.node.ejb

RelationshipsNode

public class RelationshipsNode extends com.sun.enterprise.deployment.node.DeploymentDescriptorNode
This class is responsible for handling the ejb-relationships xml element
author
Jerome Dochez
version

Fields Summary
Constructors Summary
public RelationshipsNode()

        super();
        registerElementHandler(new XMLElement(EjbTagNames.EJB_RELATION),
                                                            EjbRelationNode.class);                   
    
Methods Summary
public booleanendElement(com.sun.enterprise.deployment.node.XMLElement element)
receives notification of the end of an XML element by the Parser

param
element the xml tag identification
return
true if this node is done processing the XML sub tree

        return element.equals(getXMLRootTag());
    
public java.lang.ObjectgetDescriptor()

return
the descriptor instance to associate with this XMLNode

        return getParentNode().getDescriptor();
    
protected java.util.MapgetDispatchTable()
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.

return
the map with the element name as a key, the setter method as a value

        // no need to be synchronized for now
        Map table =  new HashMap();
        table.put(EjbTagNames.DESCRIPTION, "setRelationshipsDescription");
        return table;
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.EjbBundleDescriptor descriptor)
write the relationships descriptor class to a DOM tree and return it

param
parent node in the DOM tree
param
node name for the root element of this xml fragment
param
the descriptor to write
return
the DOM tree top node

        Node relationshipsNode = super.writeDescriptor(parent, nodeName, descriptor);
        appendTextChild(relationshipsNode, EjbTagNames.DESCRIPTION, descriptor.getRelationshipsDescription()); 
        EjbRelationNode subNode = new EjbRelationNode();
        for (Iterator e=descriptor.getRelationships().iterator();e.hasNext();) {
            RelationshipDescriptor rd = (RelationshipDescriptor) e.next();
            subNode.writeDescriptor(relationshipsNode, EjbTagNames.EJB_RELATION, rd);
        }
        
        return relationshipsNode;