1 23 package com.sun.enterprise.deployment.node.runtime.connector; 24 25 import java.util.List ; 26 import java.util.Map ; 27 import org.w3c.dom.Node ; 28 29 import com.sun.enterprise.deployment.Descriptor; 30 import com.sun.enterprise.deployment.ConnectorDescriptor; 31 import com.sun.enterprise.deployment.node.XMLElement; 32 import com.sun.enterprise.deployment.node.runtime.RuntimeBundleNode; 33 import com.sun.enterprise.deployment.runtime.connector.SunConnector; 34 import com.sun.enterprise.deployment.runtime.connector.ResourceAdapter; 35 import com.sun.enterprise.deployment.runtime.connector.RoleMap; 36 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 37 import com.sun.enterprise.deployment.xml.DTDRegistry; 38 39 45 public class ConnectorNode extends RuntimeBundleNode { 46 47 protected SunConnector descriptor=null; 48 protected ConnectorDescriptor connector=null; 49 52 public ConnectorNode(ConnectorDescriptor connector) { 53 54 handlers = null; 56 57 this.connector = connector; 58 59 registerElementHandler(new XMLElement(RuntimeTagNames.RESOURCE_ADAPTER), 60 ResourceAdapterNode.class, "setResourceAdapter"); 61 registerElementHandler(new XMLElement(RuntimeTagNames.ROLE_MAP), 62 RoleMapNode.class,"setRoleMap"); 63 } 64 65 68 public String getDocType() { 69 return DTDRegistry.SUN_CONNECTOR_100_DTD_PUBLIC_ID; 70 } 71 72 75 public String getSystemID() { 76 return DTDRegistry.SUN_CONNECTOR_100_DTD_SYSTEM_ID; 77 } 78 79 82 public List <String > getSystemIDs() { 83 return null; 84 } 85 86 protected XMLElement getXMLRootTag() { 87 return new XMLElement(RuntimeTagNames.S1AS_CONNECTOR_RUNTIME_TAG); 88 } 89 90 96 public static String registerBundle(Map publicIDToDTD) { 97 publicIDToDTD.put(DTDRegistry.SUN_CONNECTOR_100_DTD_PUBLIC_ID, DTDRegistry.SUN_CONNECTOR_100_DTD_SYSTEM_ID); 98 return RuntimeTagNames.S1AS_CONNECTOR_RUNTIME_TAG; 99 } 100 101 104 public Object getDescriptor() { 105 if (descriptor==null) { 106 descriptor = new SunConnector(); 107 connector.setSunDescriptor(descriptor); 108 } 109 return descriptor; 110 } 111 112 120 public Node writeDescriptor(Node parent, String nodeName, Descriptor descriptor) { 121 if (!(descriptor instanceof ConnectorDescriptor)) { 122 throw new IllegalArgumentException (getClass() + " cannot handles descriptors of type " + descriptor.getClass()); 123 } 124 ConnectorDescriptor connector = (ConnectorDescriptor) descriptor; 125 126 Node connectorNode = super.writeDescriptor(parent, nodeName, descriptor); 127 128 SunConnector sunDesc = connector.getSunDescriptor(); 130 if (sunDesc!=null) { 131 ResourceAdapterNode ran = new ResourceAdapterNode(); 132 ran.writeDescriptor(connectorNode, RuntimeTagNames.RESOURCE_ADAPTER, sunDesc.getResourceAdapter()); 133 134 if (sunDesc.getRoleMap()!=null) { 136 RoleMapNode rmn = new RoleMapNode(); 137 rmn.writeDescriptor(connectorNode, RuntimeTagNames.ROLE_MAP, sunDesc.getRoleMap()); 138 } 139 } 140 return connectorNode; 141 } 142 } 143 | Popular Tags |