1 23 24 29 30 package com.sun.enterprise.deployment.node.connector; 31 32 import java.util.*; 33 import org.xml.sax.Attributes ; 34 import com.sun.enterprise.deployment.Descriptor; 35 import com.sun.enterprise.deployment.OutboundResourceAdapter; 36 import com.sun.enterprise.deployment.AuthMechanism; 37 import com.sun.enterprise.deployment.EnvironmentProperty; 38 import com.sun.enterprise.deployment.SecurityPermission; 39 import com.sun.enterprise.deployment.ConnectorDescriptor; 40 import com.sun.enterprise.deployment.xml.ConnectorTagNames; 41 import com.sun.enterprise.deployment.xml.TagNames; 42 import com.sun.enterprise.deployment.node.DescriptorFactory; 43 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 44 import com.sun.enterprise.deployment.node.ConfigurableNode; 45 import com.sun.enterprise.deployment.node.XMLElement; 46 import com.sun.enterprise.deployment.util.DOLUtils; 47 import com.sun.enterprise.deployment.ConnectorDescriptor; 48 import com.sun.enterprise.deployment.ConnectionDefDescriptor; 49 import com.sun.enterprise.deployment.node.XMLNode; 50 51 import org.xml.sax.Attributes ; 52 import org.w3c.dom.Node ; 53 54 60 public class OutBoundRANode extends DeploymentDescriptorNode { 61 62 OutboundResourceAdapter descriptor = null; 63 64 public final static XMLElement tag = new XMLElement(ConnectorTagNames.OUTBOUND_RESOURCE_ADAPTER); 65 66 public OutBoundRANode() { 68 register(); 69 } 70 71 public OutBoundRANode(XMLElement element) { 72 this.setXMLRootTag(element); 73 register(); 74 } 75 76 83 public void createConDefDescriptorFor10() { 84 ConnectionDefDescriptor conDef = new ConnectionDefDescriptor(); 85 ((OutboundResourceAdapter)getDescriptor()).addConnectionDefDescriptor(conDef); 86 } 87 88 91 private void register() { 92 registerElementHandler(new XMLElement(ConnectorTagNames.AUTH_MECHANISM), 93 AuthMechNode.class); 94 registerElementHandler(new XMLElement(ConnectorTagNames.CONNECTION_DEFINITION), 95 ConnectionDefNode.class); 96 registerElementHandler(new XMLElement(ConnectorTagNames.CONFIG_PROPERTY), 97 ConfigPropertyNode.class); 98 registerElementHandler(new XMLElement(ConnectorTagNames.SECURITY_PERMISSION), 99 SecurityPermissionNode.class); 100 } 101 102 105 public Object getDescriptor() { 106 if (descriptor==null) { 107 descriptor = (OutboundResourceAdapter)DescriptorFactory.getDescriptor(getXMLPath()); 110 ((ConnectorDescriptor)(getParentNode().getDescriptor())).setOutboundResourceAdapter(descriptor); 111 } 112 return descriptor; 113 } 114 115 121 public void addDescriptor(Object obj) { 122 if (obj instanceof AuthMechanism) { 123 boolean flag = descriptor.addAuthMechanism((AuthMechanism)obj); 124 if (flag == false) 125 DOLUtils.getDefaultLogger().finer("The AuthMechanism object already exists in the Descriptor"); 126 } else if (obj instanceof ConnectionDefDescriptor) { 127 descriptor.addConnectionDefDescriptor((ConnectionDefDescriptor)obj); 128 } else if (obj instanceof EnvironmentProperty) { 129 descriptor.addConfigProperty((EnvironmentProperty)obj); 130 } else if (obj instanceof SecurityPermission) { 131 ConnectorDescriptor connDesc = 134 (ConnectorDescriptor)getParentNode().getDescriptor(); 135 connDesc.addSecurityPermission((SecurityPermission)obj); 136 } 137 } 138 139 145 protected Map getDispatchTable() { 146 Map table = super.getDispatchTable(); 148 149 table.put(ConnectorTagNames.TRANSACTION_SUPPORT, "setTransactionSupport"); 150 table.put(ConnectorTagNames.REAUTHENTICATION_SUPPORT, "setReauthenticationSupport"); 151 152 156 table.put(ConnectorTagNames.MANAGED_CONNECTION_FACTORY, "setManagedConnectionFactoryImpl"); 157 158 table.put(ConnectorTagNames.CONNECTION_FACTORY_INTF, "setConnectionFactoryIntf"); 159 table.put(ConnectorTagNames.CONNECTION_FACTORY_IMPL, "setConnectionFactoryImpl"); 160 table.put(ConnectorTagNames.CONNECTION_INTF, "setConnectionIntf"); 161 table.put(ConnectorTagNames.CONNECTION_IMPL, "setConnectionImpl"); 162 163 return table; 164 } 165 166 173 public Node writeDescriptor(Node connectorNode, Descriptor descriptor) { 174 176 Node raNode = appendChild(connectorNode, ConnectorTagNames.OUTBOUND_RESOURCE_ADAPTER); 177 append(raNode, (OutboundResourceAdapter)((ConnectorDescriptor)descriptor).getOutboundResourceAdapter()); 178 return connectorNode; 179 } 180 181 184 public void startElement(XMLElement element, Attributes attributes) { 185 } 186 187 190 private void append (Node raNode, OutboundResourceAdapter conDesc) { 191 192 ConnectionDefNode conDef = new ConnectionDefNode(); 193 raNode = conDef.writeDescriptor(raNode, conDesc); 194 195 appendTextChild(raNode, ConnectorTagNames.TRANSACTION_SUPPORT, conDesc.getTransSupport()); 196 197 AuthMechNode auth = new AuthMechNode(); 198 raNode = auth.writeDescriptor(raNode, conDesc); 199 200 appendTextChild(raNode, ConnectorTagNames.REAUTHENTICATION_SUPPORT, conDesc.getReauthenticationSupport()); 201 202 } 203 } 204 | Popular Tags |