1 23 package com.sun.enterprise.deployment.node.runtime; 24 25 import java.util.Map ; 26 import java.util.Iterator ; 27 import org.w3c.dom.Node ; 28 29 import com.sun.enterprise.deployment.MessageDestinationDescriptor; 30 import com.sun.enterprise.deployment.BundleDescriptor; 31 import com.sun.enterprise.deployment.node.XMLElement; 32 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 33 import com.sun.enterprise.deployment.node.MessageDestinationNode; 34 import com.sun.enterprise.deployment.node.runtime.web.WebBundleRuntimeNode; 35 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 36 37 44 public class MessageDestinationRuntimeNode extends DeploymentDescriptorNode { 45 46 private MessageDestinationDescriptor descriptor; 47 48 51 public Object getDescriptor() { 52 return descriptor; 53 } 54 55 61 protected Map getDispatchTable() { 62 Map table = super.getDispatchTable(); 63 table.put(RuntimeTagNames.JNDI_NAME, "setJndiName"); 64 return table; 65 } 66 67 73 public void setElementValue(XMLElement element, String value) { 74 if (RuntimeTagNames.MESSAGE_DESTINATION_NAME.equals(element.getQName())) { 75 Object parentNode = getParentNode(); 77 Object parentDesc = null; 78 if (parentNode instanceof WebBundleRuntimeNode) { 79 parentDesc = ((WebBundleRuntimeNode) parentNode).getWebBundleDescriptor(); 80 } else { 81 parentDesc = getParentNode().getDescriptor(); 82 } 83 84 if (parentDesc instanceof BundleDescriptor) { 85 descriptor = ((BundleDescriptor) parentDesc). 86 getMessageDestinationByName(value); 87 } 88 } else super.setElementValue(element, value); 89 } 90 91 99 public Node writeDescriptor(Node parent, String nodeName, MessageDestinationDescriptor msgDest) { 100 String jndiName = msgDest.getJndiName(); 101 Node msgDestNode = null; 102 if( (jndiName != null) && (jndiName.length() > 0) ) { 103 msgDestNode = super.writeDescriptor(parent, nodeName, msgDest); 104 appendTextChild(msgDestNode, 105 RuntimeTagNames.MESSAGE_DESTINATION_NAME, 106 msgDest.getName()); 107 appendTextChild(msgDestNode, RuntimeTagNames.JNDI_NAME, 108 msgDest.getJndiName()); 109 } 110 return msgDestNode; 111 } 112 113 } 114 | Popular Tags |