1 23 24 29 30 package com.sun.enterprise.deployment.node.connector; 31 32 import java.util.*; 33 import org.w3c.dom.Node ; 34 import org.xml.sax.Attributes ; 35 import com.sun.enterprise.deployment.ConnectorDescriptor; 36 import com.sun.enterprise.deployment.AdminObject; 37 import com.sun.enterprise.deployment.Descriptor; 38 import com.sun.enterprise.deployment.EnvironmentProperty; 39 import com.sun.enterprise.deployment.SecurityPermission; 40 import com.sun.enterprise.deployment.node.DescriptorFactory; 41 import com.sun.enterprise.deployment.node.BundleNode; 42 import com.sun.enterprise.deployment.node.ConfigurableNode; 43 import com.sun.enterprise.deployment.xml.ConnectorTagNames; 44 import com.sun.enterprise.deployment.xml.TagNames; 45 import com.sun.enterprise.deployment.node.XMLElement; 46 import com.sun.enterprise.deployment.node.RootXMLNode; 47 import com.sun.enterprise.deployment.node.XMLNode; 48 import com.sun.enterprise.deployment.MessageListener; 49 import com.sun.enterprise.deployment.node.connector.MessageListenerNode; 50 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 51 52 import com.sun.enterprise.deployment.AuthMechanism; 54 import com.sun.enterprise.deployment.SecurityPermission; 55 import com.sun.enterprise.deployment.util.DOLUtils; 56 57 58 63 public class RANode extends DeploymentDescriptorNode { 64 65 private ConnectorDescriptor descriptor = null; 67 public static String VERSION_10 = "1.0"; 68 public static String VERSION_15 = "1.5"; 69 70 public RANode() { 72 register(); 73 } 74 75 public RANode(XMLElement element) { 76 this.setXMLRootTag(element); 77 register(); 78 } 79 80 private void register() { 81 registerElementHandler(new XMLElement(ConnectorTagNames.OUTBOUND_RESOURCE_ADAPTER), 83 OutBoundRANode.class); 84 registerElementHandler(new XMLElement(ConnectorTagNames.INBOUND_RESOURCE_ADAPTER), 85 InBoundRANode.class); 86 registerElementHandler(new XMLElement(ConnectorTagNames.CONFIG_PROPERTY), 87 ConfigPropertyNode.class, "addConfigProperty"); 88 registerElementHandler(new XMLElement(ConnectorTagNames.ADMIN_OBJECT), 89 AdminObjectNode.class, "addAdminObject"); 90 registerElementHandler(new XMLElement(ConnectorTagNames.SECURITY_PERMISSION), 91 SecurityPermissionNode.class, "addSecurityPermission"); 92 } 93 94 95 98 public Object getDescriptor() { 99 if (descriptor == null) { 100 descriptor = (ConnectorDescriptor)getParentNode().getDescriptor(); 101 } 102 return descriptor; 103 } 104 105 111 protected Map getDispatchTable() { 112 Map table = super.getDispatchTable(); 114 table.put(ConnectorTagNames.RESOURCE_ADAPTER_CLASS, "setResourceAdapterClass"); 115 return table; 116 } 117 118 125 public Node writeDescriptor(Node connectorNode, Descriptor descriptor) { 126 127 if (! (descriptor instanceof ConnectorDescriptor)) { 128 throw new IllegalArgumentException (getClass() + " cannot handle descriptors of type " + descriptor.getClass()); 129 } 130 ConnectorDescriptor conDesc = (ConnectorDescriptor) descriptor; 131 Node raNode = appendChild(connectorNode, ConnectorTagNames.RESOURCE_ADAPTER); 132 133 appendTextChild(raNode, ConnectorTagNames.RESOURCE_ADAPTER_CLASS, conDesc.getResourceAdapterClass()); 134 135 ConfigPropertyNode config = new ConfigPropertyNode(); 137 raNode = config.writeDescriptor(raNode, conDesc); 138 139 if (conDesc.getOutBoundDefined() == true) { 140 OutBoundRANode obNode = new OutBoundRANode(); 142 raNode = obNode.writeDescriptor(raNode, conDesc); 143 } 144 145 if (conDesc.getInBoundDefined() == true) { 146 InBoundRANode inNode = new InBoundRANode(); 148 raNode = inNode.writeDescriptor(raNode, conDesc); 149 } 150 151 AdminObjectNode admin = new AdminObjectNode(); 153 raNode = admin.writeDescriptor(raNode, conDesc); 154 156 SecurityPermissionNode secPerm = new SecurityPermissionNode(); 158 raNode = secPerm.writeDescriptor(raNode, conDesc); 159 160 return connectorNode; 161 } 162 } 163 | Popular Tags |