1 23 24 package com.sun.enterprise.deployment.node.runtime.web; 25 26 import java.util.Map ; 27 import org.w3c.dom.Node ; 28 import org.w3c.dom.Element ; 29 30 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor; 31 import com.sun.enterprise.deployment.runtime.web.ClassLoader; 32 import com.sun.enterprise.deployment.runtime.web.WebProperty; 33 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 34 import com.sun.enterprise.deployment.node.XMLElement; 35 36 39 public class ClassLoaderNode extends WebRuntimeNode { 40 41 public ClassLoaderNode() { 42 registerElementHandler(new XMLElement(RuntimeTagNames.PROPERTY), 43 WebPropertyNode.class, "addWebProperty"); 44 } 45 46 54 protected boolean setAttributeValue(XMLElement elementName, 55 XMLElement attributeName, String value) { 56 RuntimeDescriptor descriptor = 57 (RuntimeDescriptor) getRuntimeDescriptor(); 58 if (descriptor==null) { 59 throw new RuntimeException ( 60 "Trying to set values on a null descriptor"); 61 } 62 if (attributeName.getQName().equals(RuntimeTagNames.EXTRA_CLASS_PATH)) { 63 descriptor.setAttributeValue(ClassLoader.EXTRA_CLASS_PATH, value); 64 return true; 65 } else if (attributeName.getQName().equals(RuntimeTagNames.DELEGATE)) { 66 descriptor.setAttributeValue(ClassLoader.DELEGATE, value); 67 return true; 68 } else if (attributeName.getQName().equals( 69 RuntimeTagNames.DYNAMIC_RELOAD_INTERVAL)) { 70 descriptor.setAttributeValue(ClassLoader.DYNAMIC_RELOAD_INTERVAL, 71 value); 72 return true; 73 } 74 return false; 75 } 76 77 85 public Node writeDescriptor(Node parent, String nodeName, 86 ClassLoader descriptor) { 87 88 Element classLoader = (Element ) super.writeDescriptor(parent, 89 nodeName, descriptor); 90 91 WebProperty[] properties = descriptor.getWebProperty(); 93 if (properties != null && properties.length > 0) { 94 WebPropertyNode wpn = new WebPropertyNode(); 95 wpn.writeDescriptor(classLoader, RuntimeTagNames.PROPERTY, 96 properties); 97 } 98 99 setAttribute(classLoader, RuntimeTagNames.EXTRA_CLASS_PATH, (String ) descriptor.getAttributeValue(ClassLoader.EXTRA_CLASS_PATH)); 101 setAttribute(classLoader, RuntimeTagNames.DELEGATE, (String ) descriptor.getAttributeValue(ClassLoader.DELEGATE)); 102 setAttribute(classLoader, RuntimeTagNames.DYNAMIC_RELOAD_INTERVAL, (String ) descriptor.getAttributeValue(ClassLoader.DYNAMIC_RELOAD_INTERVAL)); 103 104 return classLoader; 105 } 106 } 107 | Popular Tags |