1 23 24 package com.sun.enterprise.deployment.node.runtime; 25 26 import java.util.Map ; 27 import java.util.Map.Entry; 28 import org.w3c.dom.Node ; 29 30 import java.util.Set ; 31 import java.util.Iterator ; 32 33 import com.sun.enterprise.deployment.node.XMLElement; 34 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 35 36 import com.sun.enterprise.deployment.Descriptor; 37 import com.sun.enterprise.deployment.ActivationConfigDescriptor; 38 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor; 39 import com.sun.enterprise.deployment.EnvironmentProperty; 40 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 41 42 48 public class ActivationConfigNode extends DeploymentDescriptorNode { 49 50 private ActivationConfigDescriptor descriptor = null; 51 private String propertyName = null; 52 53 public ActivationConfigNode() { 54 super(); 55 registerElementHandler( 56 new XMLElement(RuntimeTagNames.ACTIVATION_CONFIG), 57 ActivationConfigNode.class, 58 "setRuntimeActivationConfigDescriptor"); 59 } 60 61 65 public Object getDescriptor() { 66 if (descriptor == null) { 67 descriptor = ((EjbMessageBeanDescriptor) getParentNode().getDescriptor()).getRuntimeActivationConfigDescriptor(); 68 } 69 return descriptor; 70 } 71 72 80 protected Map getDispatchTable() { 81 Map table = super.getDispatchTable(); 83 return table; 84 } 85 86 87 93 public void setElementValue(XMLElement element, String value) { 94 if (RuntimeTagNames.ACTIVATION_CONFIG_PROPERTY_NAME.equals 95 (element.getQName())) { 96 propertyName = value; 97 } else if(RuntimeTagNames.ACTIVATION_CONFIG_PROPERTY_VALUE.equals 98 (element.getQName())) { 99 EnvironmentProperty prop = 100 new EnvironmentProperty(propertyName, value, ""); 101 descriptor.getActivationConfig().add(prop); 102 propertyName = null; 103 } 104 else super.setElementValue(element, value); 105 } 106 107 115 public Node writeDescriptor(Node parent, String nodeName, 116 ActivationConfigDescriptor descriptor) { 117 118 Node activationConfigNode = null; 119 Set activationConfig = descriptor.getActivationConfig(); 120 if( activationConfig.size() > 0 ) { 121 activationConfigNode = 122 appendChild(parent, nodeName); 123 for(Iterator iter = activationConfig.iterator(); iter.hasNext();) { 124 Node activationConfigPropertyNode = 125 appendChild(activationConfigNode, 126 RuntimeTagNames.ACTIVATION_CONFIG_PROPERTY); 127 EnvironmentProperty next = (EnvironmentProperty) iter.next(); 128 appendTextChild(activationConfigPropertyNode, 129 RuntimeTagNames.ACTIVATION_CONFIG_PROPERTY_NAME, 130 (String ) next.getName()); 131 appendTextChild(activationConfigPropertyNode, 132 RuntimeTagNames.ACTIVATION_CONFIG_PROPERTY_VALUE, 133 (String ) next.getValue()); 134 } 135 } 136 137 return activationConfigNode; 138 } 139 } 140 | Popular Tags |