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.runtime.RuntimeDescriptor; 31 import com.sun.enterprise.deployment.runtime.web.SessionManager; 32 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 33 34 39 public class SessionManagerNode extends WebRuntimeNode { 40 41 44 public SessionManagerNode() { 45 46 registerElementHandler(new XMLElement(RuntimeTagNames.MANAGER_PROPERTIES), 47 WebPropertyContainerNode.class, "setManagerProperties"); 48 registerElementHandler(new XMLElement(RuntimeTagNames.STORE_PROPERTIES), 49 WebPropertyContainerNode.class, "setStoreProperties"); 50 } 51 52 58 public void setElementValue(XMLElement element, String value) { 59 RuntimeDescriptor descriptor = getRuntimeDescriptor(); 60 if (descriptor==null) { 61 throw new RuntimeException ("Trying to set values on a null descriptor"); 62 } 63 if (element.getQName().equals(RuntimeTagNames.PERSISTENCE_TYPE)) { 64 descriptor.setAttributeValue(SessionManager.PERSISTENCE_TYPE, value); 65 } 66 } 67 68 76 public Node writeDescriptor(Node parent, String nodeName, SessionManager descriptor) { 77 78 Element sessionMgr = (Element ) super.writeDescriptor(parent, nodeName, descriptor); 79 80 if (descriptor.getManagerProperties()!=null) { 82 WebPropertyNode wpn = new WebPropertyNode(); 83 Node mgrProps = appendChild(sessionMgr, RuntimeTagNames.MANAGER_PROPERTIES); 84 wpn.writeDescriptor(mgrProps, RuntimeTagNames.PROPERTY, descriptor.getManagerProperties().getWebProperty()); 85 } 86 87 if (descriptor.getStoreProperties()!=null) { 89 WebPropertyNode wpn = new WebPropertyNode(); 90 Node storeProps = appendChild(sessionMgr, RuntimeTagNames.STORE_PROPERTIES); 91 wpn.writeDescriptor(storeProps, RuntimeTagNames.PROPERTY, descriptor.getStoreProperties().getWebProperty()); 92 } 93 94 setAttribute(sessionMgr, RuntimeTagNames.PERSISTENCE_TYPE, (String ) descriptor.getAttributeValue(SessionManager.PERSISTENCE_TYPE)); 96 97 return sessionMgr; 98 } 99 100 } 101 | Popular Tags |