1 23 package com.sun.enterprise.deployment.node.runtime; 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.DeploymentDescriptorNode; 30 import com.sun.enterprise.deployment.runtime.MdbConnectionFactoryDescriptor; 31 import com.sun.enterprise.deployment.ResourcePrincipal; 32 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 33 34 public class MDBConnectionFactoryNode extends DeploymentDescriptorNode { 35 36 protected MdbConnectionFactoryDescriptor descriptor; 37 38 public MDBConnectionFactoryNode() { 39 registerElementHandler(new XMLElement(RuntimeTagNames.DEFAULT_RESOURCE_PRINCIPAL), DefaultResourcePrincipalNode.class); 40 } 41 42 43 46 public Object getDescriptor() { 47 if (descriptor==null) { 48 descriptor = new MdbConnectionFactoryDescriptor(); 49 } 50 return descriptor; 51 } 52 53 59 protected Map getDispatchTable() { 60 Map dispatchTable = super.getDispatchTable(); 61 dispatchTable.put(RuntimeTagNames.JNDI_NAME, "setJndiName"); 62 return dispatchTable; 63 } 64 65 71 public void addDescriptor(Object newDescriptor) { 72 if (newDescriptor instanceof ResourcePrincipal) { 73 descriptor.setDefaultResourcePrincipal((ResourcePrincipal) newDescriptor); 74 } else super.addDescriptor(newDescriptor); 75 } 76 77 85 public Node writeDescriptor(Node parent, String nodeName, MdbConnectionFactoryDescriptor mcf) { 86 Node mcfNode = super.writeDescriptor(parent, nodeName, mcf); 87 appendTextChild(mcfNode, RuntimeTagNames.JNDI_NAME, mcf.getJndiName()); 88 if (mcf.getDefaultResourcePrincipal()!=null) { 89 DefaultResourcePrincipalNode subNode = new DefaultResourcePrincipalNode(); 90 subNode.writeDescriptor(mcfNode, RuntimeTagNames.DEFAULT_RESOURCE_PRINCIPAL, mcf.getDefaultResourcePrincipal()); 91 } 92 return mcfNode; 93 } 94 } 95 | Popular Tags |