1 23 package com.sun.enterprise.deployment.node.runtime; 24 25 import java.util.Map ; 26 import org.w3c.dom.Node ; 27 28 import com.sun.enterprise.deployment.node.XMLElement; 29 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode; 30 import com.sun.enterprise.deployment.runtime.BeanCacheDescriptor; 31 import com.sun.enterprise.deployment.xml.RuntimeTagNames; 32 33 39 public class BeanCacheNode extends DeploymentDescriptorNode { 40 41 protected BeanCacheDescriptor descriptor=null; 42 43 46 public Object getDescriptor() { 47 if (descriptor==null) { 48 descriptor = new BeanCacheDescriptor(); 49 } 50 return descriptor; 51 } 52 53 59 public void setElementValue(XMLElement element, String value) { 60 if (RuntimeTagNames.IS_CACHE_OVERFLOW_ALLOWED.equals(element.getQName())) { 61 descriptor.setIsCacheOverflowAllowed(Boolean.valueOf(value)); 62 } else 63 super.setElementValue(element, value); 64 } 65 66 72 protected Map getDispatchTable() { 73 Map dispatchTable = super.getDispatchTable(); 74 dispatchTable.put(RuntimeTagNames.MAX_CACHE_SIZE, "setMaxCacheSize"); 75 dispatchTable.put(RuntimeTagNames.RESIZE_QUANTITY, "setResizeQuantity"); 76 dispatchTable.put(RuntimeTagNames.CACHE_IDLE_TIMEOUT_IN_SECONDS, "setCacheIdleTimeoutInSeconds"); 77 dispatchTable.put(RuntimeTagNames.REMOVAL_TIMEOUT_IN_SECONDS, "setRemovalTimeoutInSeconds"); 78 dispatchTable.put(RuntimeTagNames.VICTIM_SELECTION_POLICY, "setVictimSelectionPolicy"); 79 return dispatchTable; 80 } 81 82 90 public Node writeDescriptor(Node parent, String nodeName, BeanCacheDescriptor descriptor) { 91 Node beanCacheNode = super.writeDescriptor(parent, nodeName, descriptor); 92 appendTextChild(beanCacheNode, RuntimeTagNames.MAX_CACHE_SIZE, descriptor.getMaxCacheSize()); 93 appendTextChild(beanCacheNode, RuntimeTagNames.RESIZE_QUANTITY, descriptor.getResizeQuantity()); 94 appendTextChild(beanCacheNode, RuntimeTagNames.IS_CACHE_OVERFLOW_ALLOWED, String.valueOf(descriptor.isIsCacheOverflowAllowed())); 95 appendTextChild(beanCacheNode, RuntimeTagNames.CACHE_IDLE_TIMEOUT_IN_SECONDS, descriptor.getCacheIdleTimeoutInSeconds()); 96 appendTextChild(beanCacheNode, RuntimeTagNames.REMOVAL_TIMEOUT_IN_SECONDS, descriptor.getRemovalTimeoutInSeconds()); 97 appendTextChild(beanCacheNode, RuntimeTagNames.VICTIM_SELECTION_POLICY, descriptor.getVictimSelectionPolicy()); 98 return beanCacheNode; 99 } 100 } 101 | Popular Tags |