1 23 24 29 30 package com.sun.enterprise.tools.common.dd.ejb; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 39 public class BeanCache extends com.sun.enterprise.tools.common.dd.SunBaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String MAX_CACHE_SIZE = "MaxCacheSize"; static public final String RESIZE_QUANTITY = "ResizeQuantity"; static public final String IS_CACHE_OVERFLOW_ALLOWED = "IsCacheOverflowAllowed"; static public final String CACHE_IDLE_TIMEOUT_IN_SECONDS = "CacheIdleTimeoutInSeconds"; static public final String REMOVAL_TIMEOUT_IN_SECONDS = "RemovalTimeoutInSeconds"; static public final String VICTIM_SELECTION_POLICY = "VictimSelectionPolicy"; 51 public BeanCache() { 52 this(Common.USE_DEFAULT_VALUES); 53 } 54 55 public BeanCache(int options) 56 { 57 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 58 this.createProperty("max-cache-size", MAX_CACHE_SIZE, 61 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 62 String .class); 63 this.createProperty("resize-quantity", RESIZE_QUANTITY, 65 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 66 String .class); 67 this.createProperty("is-cache-overflow-allowed", IS_CACHE_OVERFLOW_ALLOWED, 69 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 70 String .class); 71 this.createProperty("cache-idle-timeout-in-seconds", CACHE_IDLE_TIMEOUT_IN_SECONDS, 73 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 74 String .class); 75 this.createProperty("removal-timeout-in-seconds", REMOVAL_TIMEOUT_IN_SECONDS, 77 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 78 String .class); 79 this.createProperty("victim-selection-policy", VICTIM_SELECTION_POLICY, 81 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 82 String .class); 83 this.initialize(options); 84 } 85 86 void initialize(int options) 88 { 89 90 } 91 92 public void setMaxCacheSize(String value) { 94 this.setValue(MAX_CACHE_SIZE, value); 95 } 96 97 public String getMaxCacheSize() { 99 return (String )this.getValue(MAX_CACHE_SIZE); 100 } 101 102 public void setResizeQuantity(String value) { 104 this.setValue(RESIZE_QUANTITY, value); 105 } 106 107 public String getResizeQuantity() { 109 return (String )this.getValue(RESIZE_QUANTITY); 110 } 111 112 public void setIsCacheOverflowAllowed(String value) { 114 this.setValue(IS_CACHE_OVERFLOW_ALLOWED, value); 115 } 116 117 public String getIsCacheOverflowAllowed() { 119 return (String )this.getValue(IS_CACHE_OVERFLOW_ALLOWED); 120 } 121 122 public void setCacheIdleTimeoutInSeconds(String value) { 124 this.setValue(CACHE_IDLE_TIMEOUT_IN_SECONDS, value); 125 } 126 127 public String getCacheIdleTimeoutInSeconds() { 129 return (String )this.getValue(CACHE_IDLE_TIMEOUT_IN_SECONDS); 130 } 131 132 public void setRemovalTimeoutInSeconds(String value) { 134 this.setValue(REMOVAL_TIMEOUT_IN_SECONDS, value); 135 } 136 137 public String getRemovalTimeoutInSeconds() { 139 return (String )this.getValue(REMOVAL_TIMEOUT_IN_SECONDS); 140 } 141 142 public void setVictimSelectionPolicy(String value) { 144 this.setValue(VICTIM_SELECTION_POLICY, value); 145 } 146 147 public String getVictimSelectionPolicy() { 149 return (String )this.getValue(VICTIM_SELECTION_POLICY); 150 } 151 152 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 154 comparators.add(c); 155 } 156 157 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 159 comparators.remove(c); 160 } 161 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 162 boolean restrictionFailure = false; 163 if (getMaxCacheSize() != null) { 165 } 166 if (getResizeQuantity() != null) { 168 } 169 if (getIsCacheOverflowAllowed() != null) { 171 } 172 if (getCacheIdleTimeoutInSeconds() != null) { 174 } 175 if (getRemovalTimeoutInSeconds() != null) { 177 } 178 if (getVictimSelectionPolicy() != null) { 180 } 181 } 182 183 public void dump(StringBuffer str, String indent){ 185 String s; 186 Object o; 187 org.netbeans.modules.schema2beans.BaseBean n; 188 str.append(indent); 189 str.append("MaxCacheSize"); str.append(indent+"\t"); str.append("<"); s = this.getMaxCacheSize(); 193 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(MAX_CACHE_SIZE, 0, str, indent); 196 197 str.append(indent); 198 str.append("ResizeQuantity"); str.append(indent+"\t"); str.append("<"); s = this.getResizeQuantity(); 202 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(RESIZE_QUANTITY, 0, str, indent); 205 206 str.append(indent); 207 str.append("IsCacheOverflowAllowed"); str.append(indent+"\t"); str.append("<"); s = this.getIsCacheOverflowAllowed(); 211 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(IS_CACHE_OVERFLOW_ALLOWED, 0, str, indent); 214 215 str.append(indent); 216 str.append("CacheIdleTimeoutInSeconds"); str.append(indent+"\t"); str.append("<"); s = this.getCacheIdleTimeoutInSeconds(); 220 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(CACHE_IDLE_TIMEOUT_IN_SECONDS, 0, str, indent); 223 224 str.append(indent); 225 str.append("RemovalTimeoutInSeconds"); str.append(indent+"\t"); str.append("<"); s = this.getRemovalTimeoutInSeconds(); 229 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(REMOVAL_TIMEOUT_IN_SECONDS, 0, str, indent); 232 233 str.append(indent); 234 str.append("VictimSelectionPolicy"); str.append(indent+"\t"); str.append("<"); s = this.getVictimSelectionPolicy(); 238 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(VICTIM_SELECTION_POLICY, 0, str, indent); 241 242 } 243 public String dumpBeanNode(){ 244 StringBuffer str = new StringBuffer (); 245 str.append("BeanCache\n"); this.dump(str, "\n "); return str.toString(); 248 }} 249 250 252 253 1097 | Popular Tags |