1 23 package com.sun.enterprise.deployment.node.runtime.common; 24 25 import java.util.Map ; 26 import org.w3c.dom.Node ; 27 28 import com.sun.enterprise.deployment.node.XMLElement; 29 import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode; 30 import com.sun.enterprise.deployment.runtime.common.ResourceRef; 31 import com.sun.enterprise.deployment.runtime.common.DefaultResourcePrincipal; 32 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 33 34 40 public class ResourceRefNode extends RuntimeDescriptorNode { 41 42 public ResourceRefNode() { 43 registerElementHandler(new XMLElement(RuntimeTagNames.DEFAULT_RESOURCE_PRINCIPAL), 44 DefaultResourcePrincipalNode.class, "setDefaultResourcePrincipal"); 45 } 46 47 53 protected Map getDispatchTable() { 54 Map table = super.getDispatchTable(); 55 table.put(RuntimeTagNames.RES_REF_NAME, "setResRefName"); 56 table.put(RuntimeTagNames.JNDI_NAME, "setJndiName"); 57 return table; 58 } 59 60 68 public Node writeDescriptor(Node parent, String nodeName, ResourceRef descriptor) { 69 Node refNode = appendChild(parent, nodeName); 70 appendTextChild(refNode, RuntimeTagNames.RES_REF_NAME, descriptor.getResRefName()); 71 appendTextChild(refNode, RuntimeTagNames.JNDI_NAME, descriptor.getJndiName()); 72 DefaultResourcePrincipal defaultPrincipal = descriptor.getDefaultResourcePrincipal(); 73 if (defaultPrincipal!=null) { 74 DefaultResourcePrincipalNode subNode = new DefaultResourcePrincipalNode(); 75 subNode.writeDescriptor(refNode, RuntimeTagNames.DEFAULT_RESOURCE_PRINCIPAL, defaultPrincipal); 76 } 77 return refNode; 78 } 79 } 80 | Popular Tags |