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.xml.TagNames; 29 import com.sun.enterprise.deployment.xml.ConnectorTagNames; 30 import com.sun.enterprise.deployment.Descriptor; 31 import com.sun.enterprise.deployment.MessageListener; 32 import com.sun.enterprise.deployment.node.DescriptorFactory; 33 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 34 import com.sun.enterprise.deployment.node.ConfigurableNode; 35 import com.sun.enterprise.deployment.node.XMLElement; 36 import com.sun.enterprise.deployment.InboundResourceAdapter; 37 import com.sun.enterprise.deployment.ConnectorDescriptor; 38 39 import org.xml.sax.Attributes ; 40 import org.w3c.dom.Node ; 41 42 43 49 public class InBoundRANode extends DeploymentDescriptorNode { 50 51 57 58 private InboundResourceAdapter descriptor = null; 59 60 public InBoundRANode() { 62 registerElementHandler(new XMLElement(ConnectorTagNames.MSG_LISTENER), 63 MessageListenerNode.class); 64 } 65 66 69 public void startElement(XMLElement element, Attributes attributes) { 70 } 71 72 78 protected Map getDispatchTable() { 79 Map table = super.getDispatchTable(); 80 return table; 81 } 82 83 86 public Object getDescriptor() { 87 if (descriptor==null) { 88 descriptor = (InboundResourceAdapter)DescriptorFactory.getDescriptor(getXMLPath()); 91 ((ConnectorDescriptor)(getParentNode().getDescriptor())).setInboundResourceAdapter(descriptor); 92 93 } 94 return descriptor; 95 } 96 97 103 public void addDescriptor(Object obj) { 104 if (obj instanceof MessageListener) { 105 descriptor.addMessageListener((MessageListener)obj); 106 } 107 } 108 109 116 public Node writeDescriptor(Node connectorNode, Descriptor descriptor) { 117 Node inBoundNode = appendChild(connectorNode, ConnectorTagNames.INBOUND_RESOURCE_ADAPTER); 118 appendInBoundNode(inBoundNode, (InboundResourceAdapter)((ConnectorDescriptor)descriptor).getInboundResourceAdapter()); 119 return connectorNode; 120 } 121 122 125 private void appendInBoundNode (Node inBoundNode, InboundResourceAdapter conDesc) { 126 127 Node msgAdapter = appendChild(inBoundNode, ConnectorTagNames.MSG_ADAPTER); 128 129 MessageListenerNode msgListener = new MessageListenerNode(); 130 msgAdapter = msgListener.writeDescriptor(msgAdapter, conDesc); 131 } 132 133 } 134 | Popular Tags |