1 23 24 29 30 package com.sun.enterprise.tools.common.dd.webapp; 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 Cache extends com.sun.enterprise.tools.common.dd.SunBaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String MAXENTRIES = "MaxEntries"; static public final String TIMEOUTINSECONDS = "TimeoutInSeconds"; static public final String ENABLED = "Enabled"; static public final String CACHE_HELPER = "CacheHelper"; static public final String DEFAULT_HELPER = "DefaultHelper"; static public final String PROPERTY = "WebProperty"; static public final String CACHE_MAPPING = "CacheMapping"; 52 public Cache() { 53 this(Common.USE_DEFAULT_VALUES); 54 } 55 56 public Cache(int options) 57 { 58 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 59 this.createProperty("cache-helper", CACHE_HELPER, 62 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 63 CacheHelper.class); 64 this.createAttribute(CACHE_HELPER, "name", "Name", 65 AttrProp.CDATA | AttrProp.REQUIRED, 66 null, null); 67 this.createAttribute(CACHE_HELPER, "class-name", "ClassName", 68 AttrProp.CDATA | AttrProp.REQUIRED, 69 null, null); 70 this.createProperty("default-helper", DEFAULT_HELPER, 72 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 73 DefaultHelper.class); 74 this.createProperty("property", PROPERTY, 76 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 77 WebProperty.class); 78 this.createAttribute(PROPERTY, "name", "Name", 79 AttrProp.CDATA | AttrProp.REQUIRED, 80 null, null); 81 this.createAttribute(PROPERTY, "value", "Value", 82 AttrProp.CDATA | AttrProp.REQUIRED, 83 null, null); 84 this.createProperty("cache-mapping", CACHE_MAPPING, 86 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 87 CacheMapping.class); 88 this.initialize(options); 89 } 90 91 void initialize(int options) 93 { 94 95 } 96 97 public void setMaxEntries(java.lang.String value) { 99 setAttributeValue(MAXENTRIES, value); 100 } 101 102 public java.lang.String getMaxEntries() { 104 return getAttributeValue(MAXENTRIES); 105 } 106 107 public void setTimeoutInSeconds(java.lang.String value) { 109 setAttributeValue(TIMEOUTINSECONDS, value); 110 } 111 112 public java.lang.String getTimeoutInSeconds() { 114 return getAttributeValue(TIMEOUTINSECONDS); 115 } 116 117 public void setEnabled(java.lang.String value) { 119 setAttributeValue(ENABLED, value); 120 } 121 122 public java.lang.String getEnabled() { 124 return getAttributeValue(ENABLED); 125 } 126 127 public void setCacheHelper(int index, CacheHelper value) { 129 this.setValue(CACHE_HELPER, index, value); 130 } 131 132 public CacheHelper getCacheHelper(int index) { 134 return (CacheHelper)this.getValue(CACHE_HELPER, index); 135 } 136 137 public void setCacheHelper(CacheHelper[] value) { 139 this.setValue(CACHE_HELPER, value); 140 } 141 142 public CacheHelper[] getCacheHelper() { 144 return (CacheHelper[])this.getValues(CACHE_HELPER); 145 } 146 147 public int sizeCacheHelper() { 149 return this.size(CACHE_HELPER); 150 } 151 152 public int addCacheHelper(com.sun.enterprise.tools.common.dd.webapp.CacheHelper value) { 154 return this.addValue(CACHE_HELPER, value); 155 } 156 157 public int removeCacheHelper(com.sun.enterprise.tools.common.dd.webapp.CacheHelper value) { 162 return this.removeValue(CACHE_HELPER, value); 163 } 164 165 public void setDefaultHelper(DefaultHelper value) { 167 this.setValue(DEFAULT_HELPER, value); 168 } 169 170 public DefaultHelper getDefaultHelper() { 172 return (DefaultHelper)this.getValue(DEFAULT_HELPER); 173 } 174 175 public void setWebProperty(int index, WebProperty value) { 177 this.setValue(PROPERTY, index, value); 178 } 179 180 public WebProperty getWebProperty(int index) { 182 return (WebProperty)this.getValue(PROPERTY, index); 183 } 184 185 public void setWebProperty(WebProperty[] value) { 187 this.setValue(PROPERTY, value); 188 } 189 190 public WebProperty[] getWebProperty() { 192 return (WebProperty[])this.getValues(PROPERTY); 193 } 194 195 public int sizeWebProperty() { 197 return this.size(PROPERTY); 198 } 199 200 public int addWebProperty(com.sun.enterprise.tools.common.dd.webapp.WebProperty value) { 202 return this.addValue(PROPERTY, value); 203 } 204 205 public int removeWebProperty(com.sun.enterprise.tools.common.dd.webapp.WebProperty value) { 210 return this.removeValue(PROPERTY, value); 211 } 212 213 public void setCacheMapping(int index, CacheMapping value) { 215 this.setValue(CACHE_MAPPING, index, value); 216 } 217 218 public CacheMapping getCacheMapping(int index) { 220 return (CacheMapping)this.getValue(CACHE_MAPPING, index); 221 } 222 223 public void setCacheMapping(CacheMapping[] value) { 225 this.setValue(CACHE_MAPPING, value); 226 } 227 228 public CacheMapping[] getCacheMapping() { 230 return (CacheMapping[])this.getValues(CACHE_MAPPING); 231 } 232 233 public int sizeCacheMapping() { 235 return this.size(CACHE_MAPPING); 236 } 237 238 public int addCacheMapping(com.sun.enterprise.tools.common.dd.webapp.CacheMapping value) { 240 return this.addValue(CACHE_MAPPING, value); 241 } 242 243 public int removeCacheMapping(com.sun.enterprise.tools.common.dd.webapp.CacheMapping value) { 248 return this.removeValue(CACHE_MAPPING, value); 249 } 250 251 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 253 comparators.add(c); 254 } 255 256 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 258 comparators.remove(c); 259 } 260 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 261 boolean restrictionFailure = false; 262 if (getMaxEntries() == null) { 264 throw new org.netbeans.modules.schema2beans.ValidateException("getMaxEntries() == null", "maxEntries", this); } 266 if (getTimeoutInSeconds() == null) { 268 throw new org.netbeans.modules.schema2beans.ValidateException("getTimeoutInSeconds() == null", "timeoutInSeconds", this); } 270 if (getEnabled() == null) { 272 throw new org.netbeans.modules.schema2beans.ValidateException("getEnabled() == null", "enabled", this); } 274 for (int _index = 0; _index < sizeCacheHelper(); ++_index) { 276 com.sun.enterprise.tools.common.dd.webapp.CacheHelper element = getCacheHelper(_index); 277 if (element != null) { 278 element.validate(); 279 } 280 } 281 if (getDefaultHelper() != null) { 283 getDefaultHelper().validate(); 284 } 285 for (int _index = 0; _index < sizeWebProperty(); ++_index) { 287 com.sun.enterprise.tools.common.dd.webapp.WebProperty element = getWebProperty(_index); 288 if (element != null) { 289 element.validate(); 290 } 291 } 292 for (int _index = 0; _index < sizeCacheMapping(); ++_index) { 294 com.sun.enterprise.tools.common.dd.webapp.CacheMapping element = getCacheMapping(_index); 295 if (element != null) { 296 element.validate(); 297 } 298 } 299 } 300 301 public void dump(StringBuffer str, String indent){ 303 String s; 304 Object o; 305 org.netbeans.modules.schema2beans.BaseBean n; 306 str.append(indent); 307 str.append("CacheHelper["+this.sizeCacheHelper()+"]"); for(int i=0; i<this.sizeCacheHelper(); i++) 309 { 310 str.append(indent+"\t"); 311 str.append("#"+i+":"); 312 n = (org.netbeans.modules.schema2beans.BaseBean) this.getCacheHelper(i); 313 if (n != null) 314 n.dump(str, indent + "\t"); else 316 str.append(indent+"\tnull"); this.dumpAttributes(CACHE_HELPER, i, str, indent); 318 } 319 320 str.append(indent); 321 str.append("DefaultHelper"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getDefaultHelper(); 323 if (n != null) 324 n.dump(str, indent + "\t"); else 326 str.append(indent+"\tnull"); this.dumpAttributes(DEFAULT_HELPER, 0, str, indent); 328 329 str.append(indent); 330 str.append("WebProperty["+this.sizeWebProperty()+"]"); for(int i=0; i<this.sizeWebProperty(); i++) 332 { 333 str.append(indent+"\t"); 334 str.append("#"+i+":"); 335 n = (org.netbeans.modules.schema2beans.BaseBean) this.getWebProperty(i); 336 if (n != null) 337 n.dump(str, indent + "\t"); else 339 str.append(indent+"\tnull"); this.dumpAttributes(PROPERTY, i, str, indent); 341 } 342 343 str.append(indent); 344 str.append("CacheMapping["+this.sizeCacheMapping()+"]"); for(int i=0; i<this.sizeCacheMapping(); i++) 346 { 347 str.append(indent+"\t"); 348 str.append("#"+i+":"); 349 n = (org.netbeans.modules.schema2beans.BaseBean) this.getCacheMapping(i); 350 if (n != null) 351 n.dump(str, indent + "\t"); else 353 str.append(indent+"\tnull"); this.dumpAttributes(CACHE_MAPPING, i, str, indent); 355 } 356 357 } 358 public String dumpBeanNode(){ 359 StringBuffer str = new StringBuffer (); 360 str.append("Cache\n"); this.dump(str, "\n "); return str.toString(); 363 }} 364 365 367 368 835 | Popular Tags |