1 23 24 package com.sun.enterprise.deployment.node.connector; 25 26 import java.util.*; 27 import org.xml.sax.Attributes ; 28 import com.sun.enterprise.deployment.Descriptor; 29 import com.sun.enterprise.deployment.ConnectorDescriptor; 30 import com.sun.enterprise.deployment.InboundResourceAdapter; 31 import com.sun.enterprise.deployment.xml.ConnectorTagNames; 32 import com.sun.enterprise.deployment.xml.TagNames; 33 import com.sun.enterprise.deployment.EnvironmentProperty; 34 import com.sun.enterprise.deployment.node.DescriptorFactory; 35 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 36 import com.sun.enterprise.deployment.node.ConfigurableNode; 37 import com.sun.enterprise.deployment.node.XMLElement; 38 import com.sun.enterprise.deployment.MessageListener; 39 import com.sun.enterprise.deployment.node.connector.RequiredConfigNode; 40 41 import org.xml.sax.Attributes ; 42 import org.w3c.dom.Node ; 43 44 50 public class ActivationSpecNode extends DeploymentDescriptorNode { 51 52 private MessageListener msgListener = null; 53 54 public ActivationSpecNode() { 55 registerElementHandler(new XMLElement(ConnectorTagNames.REQUIRED_CONFIG_PROP), 56 RequiredConfigNode.class); 57 58 } 59 60 66 67 protected Map getDispatchTable() { 68 Map table = super.getDispatchTable(); 69 table.put(ConnectorTagNames.ACTIVATION_SPEC_CLASS, "setActivationSpecClass"); 70 return table; 71 } 72 73 76 public Object getDescriptor() { 77 if (msgListener == null) { 78 msgListener = (MessageListener) getParentNode().getDescriptor(); 79 } 80 return msgListener; 81 } 82 83 89 public void addDescriptor(Object obj) { 90 if (obj instanceof EnvironmentProperty) { 91 msgListener.addConfigProperty((EnvironmentProperty)obj); 92 } 93 } 94 95 102 public Node writeDescriptor(Node parent, Descriptor descriptor) { 103 104 if (! (descriptor instanceof MessageListener)) { 105 throw new IllegalArgumentException (getClass() + " cannot handle descriptors of type " + descriptor.getClass()); 106 } 107 108 MessageListener msgListener = (MessageListener)descriptor; 109 Node actSpecNode = appendChild(parent, ConnectorTagNames.ACTIVATION_SPEC); 110 appendTextChild(actSpecNode, ConnectorTagNames.ACTIVATION_SPEC_CLASS, msgListener.getActivationSpecClass()); 111 112 RequiredConfigNode reqNode = new RequiredConfigNode(); 114 actSpecNode = reqNode.writeDescriptor(actSpecNode, msgListener); 115 116 return parent; 117 } 118 } 119 | Popular Tags |