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.node.XMLElement; 30 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 31 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor; 32 import com.sun.enterprise.deployment.runtime.web.LocaleCharsetMap; 33 38 public class LocaleCharsetMapNode extends WebRuntimeNode { 39 40 46 public void setElementValue(XMLElement element, String value) { 47 RuntimeDescriptor descriptor = getRuntimeDescriptor(); 48 if (descriptor==null) { 49 throw new RuntimeException ("Trying to set name or value on null property"); 50 } 51 if (element.getQName().equals(RuntimeTagNames.LOCALE)) { 52 descriptor.setAttributeValue(LocaleCharsetMap.LOCALE, value); 53 } else 54 if (element.getQName().equals(RuntimeTagNames.AGENT)) { 55 descriptor.setAttributeValue(LocaleCharsetMap.AGENT, value); 56 } 57 if (element.getQName().equals(RuntimeTagNames.CHARSET)) { 58 descriptor.setAttributeValue(LocaleCharsetMap.CHARSET, value); 59 } 60 } 61 62 70 public Node writeDescriptor(Node parent, String nodeName, LocaleCharsetMap descriptor) { 71 72 Element locale = (Element ) super.writeDescriptor(parent, nodeName, descriptor); 73 74 appendTextChild(locale, RuntimeTagNames.DESCRIPTION, descriptor.getDescription()); 76 77 setAttribute(locale, RuntimeTagNames.LOCALE, (String ) descriptor.getAttributeValue(LocaleCharsetMap.LOCALE)); 79 setAttribute(locale, RuntimeTagNames.AGENT, (String ) descriptor.getAttributeValue(LocaleCharsetMap.AGENT)); 80 setAttribute(locale, RuntimeTagNames.CHARSET, (String ) descriptor.getAttributeValue(LocaleCharsetMap.CHARSET)); 81 82 return locale; 83 } 84 } 85 | Popular Tags |