1 23 24 29 30 package com.sun.enterprise.deployment.node; 31 32 import java.util.Properties ; 33 import java.util.Enumeration ; 34 import org.w3c.dom.Node ; 35 import com.sun.enterprise.deployment.xml.TagNames; 36 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 37 38 44 public class PropertiesNode extends DeploymentDescriptorNode { 45 46 private String name=null; 47 private Properties descriptor= new Properties (); 48 49 52 public Object getDescriptor() { 53 return descriptor; 54 } 55 56 62 public void setElementValue(XMLElement element, String value) { 63 if (TagNames.NAME_VALUE_PAIR_NAME.equals(element.getQName())) { 64 name = value; 65 } else if (TagNames.NAME_VALUE_PAIR_VALUE.equals(element.getQName())) { 66 descriptor.put(name, value); 67 } 68 } 69 70 71 79 public Node writeDescriptor(Node parent, String nodeName, Properties descriptor) { 80 81 Node propertiesNode = super.appendChild(parent, nodeName); 82 for (Enumeration keys = descriptor.propertyNames(); keys.hasMoreElements();) { 83 Node aProperty = this.appendChild(propertiesNode, RuntimeTagNames.PROPERTY); 84 String key = (String ) keys.nextElement(); 85 appendTextChild(aProperty, TagNames.NAME_VALUE_PAIR_NAME, key); 86 appendTextChild(aProperty, TagNames.NAME_VALUE_PAIR_VALUE, 87 descriptor.getProperty(key)); 88 } 89 return propertiesNode; 90 } 91 } 92 | Popular Tags |