FileDocCategorySizeDatePackage
ResourceEnvRefNode.javaAPI DocGlassfish v2 API5649Mon Jul 16 18:17:28 BST 2007com.sun.enterprise.deployment.node.runtime

ResourceEnvRefNode

public class ResourceEnvRefNode extends com.sun.enterprise.deployment.node.DeploymentDescriptorNode
This node is responsible for handling runtime descriptor resource-env-ref tag
author
Jerome Dochez
version

Fields Summary
private com.sun.enterprise.deployment.JmsDestinationReferenceDescriptor
descriptor
Constructors Summary
Methods Summary
public java.lang.ObjectgetDescriptor()

return
the descriptor instance to associate with this XMLNode

        return descriptor;
    
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

    
        Map table = super.getDispatchTable();
        table.put(RuntimeTagNames.JNDI_NAME, "setJndiName");
        return table;
    
public voidsetElementValue(com.sun.enterprise.deployment.node.XMLElement element, java.lang.String value)
receives notiification of the value for a particular tag

param
element the xml element
param
value it's associated value

        if (RuntimeTagNames.RESOURCE_ENV_REFERENCE_NAME.equals(element.getQName())) {
            Object parentDesc = getParentNode().getDescriptor();
            if (parentDesc instanceof ResourceEnvReferenceContainer) {
                try {
                    descriptor = ((ResourceEnvReferenceContainer) parentDesc).getJmsDestinationReferenceByName(value);
                } catch (IllegalArgumentException iae) {
                    DOLUtils.getDefaultLogger().warning(iae.getMessage());
                }
            }
        } else super.setElementValue(element, value);
    
public org.w3c.dom.NodewriteDescriptor(org.w3c.dom.Node parent, java.lang.String nodeName, com.sun.enterprise.deployment.JmsDestinationReferenceDescriptor ejbRef)
write the descriptor class to a DOM tree and return it

param
parent node for the DOM tree
param
node name for the descriptor
param
the descriptor to write
return
the DOM tree top node

          
        Node resRefNode = super.writeDescriptor(parent, nodeName, ejbRef);
        appendTextChild(resRefNode, RuntimeTagNames.RESOURCE_ENV_REFERENCE_NAME, ejbRef.getName());
        appendTextChild(resRefNode, RuntimeTagNames.JNDI_NAME, ejbRef.getJndiName());
        return resRefNode;
    
public static voidwriteResoureEnvReferences(org.w3c.dom.Node parent, com.sun.enterprise.deployment.types.ResourceEnvReferenceContainer descriptor)
writes all the runtime information for JMS destination references

param
parent node to add the runtime xml info
param
the J2EE component containing ejb references

        // resource-env-ref*
        Iterator resRefs = descriptor.getJmsDestinationReferenceDescriptors().iterator();
        if (resRefs.hasNext()) {
            ResourceEnvRefNode resourceEnvRefNode = new ResourceEnvRefNode();
            while (resRefs.hasNext()) {
                resourceEnvRefNode.writeDescriptor(parent, RuntimeTagNames.RESOURCE_ENV_REFERENCE, 
                    (JmsDestinationReferenceDescriptor) resRefs.next());
            }
        }