1 23 24 package com.sun.enterprise.deployment.node.runtime.web; 25 26 import org.w3c.dom.Node ; 27 import org.w3c.dom.Element ; 28 29 import com.sun.enterprise.deployment.runtime.web.WebProperty; 30 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 31 import com.sun.enterprise.deployment.node.XMLElement; 32 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor; 33 34 35 40 public class WebPropertyNode extends WebRuntimeNode { 41 42 50 protected boolean setAttributeValue(XMLElement elementName, XMLElement attributeName, String value) { 51 RuntimeDescriptor descriptor = 52 (RuntimeDescriptor) getRuntimeDescriptor(); 53 if (descriptor==null) { 54 throw new RuntimeException ( 55 "Trying to set values on a null descriptor"); 56 } 57 if (attributeName.getQName().equals(RuntimeTagNames.NAME)) { 58 descriptor.setAttributeValue(WebProperty.NAME, value); 59 return true; 60 } else if (attributeName.getQName().equals(RuntimeTagNames.VALUE)) { 61 descriptor.setAttributeValue(WebProperty.VALUE, value); 62 return true; 63 } 64 return false; 65 } 66 67 75 public Node writeDescriptor(Node parent, String nodeName, 76 WebProperty property) { 77 Element propertyElement = 78 (Element ) super.writeDescriptor(parent, nodeName, property); 79 80 appendTextChild(propertyElement, RuntimeTagNames.DESCRIPTION, property.getDescription()); 82 83 setAttribute(propertyElement, RuntimeTagNames.NAME, (String ) property.getAttributeValue(WebProperty.NAME)); 84 setAttribute(propertyElement, RuntimeTagNames.VALUE, (String ) property.getAttributeValue(WebProperty.VALUE)); 85 return propertyElement; 86 } 87 88 95 public void writeDescriptor(Node parent, String nodeName, WebProperty[] properties) { 96 if (properties==null) 97 return; 98 for (int i=0;i<properties.length;i++) { 99 writeDescriptor(parent, nodeName, properties[i]); 100 } 101 } 102 } 103 104 | Popular Tags |