1 23 24 28 29 package com.sun.enterprise.config.serverbeans; 30 31 import org.w3c.dom.*; 32 import org.netbeans.modules.schema2beans.*; 33 import java.beans.*; 34 import java.util.*; 35 import java.io.Serializable ; 36 import com.sun.enterprise.config.ConfigBean; 37 import com.sun.enterprise.config.ConfigException; 38 import com.sun.enterprise.config.StaleWriteConfigException; 39 import com.sun.enterprise.util.i18n.StringManager; 40 41 43 public class WebContainerAvailability extends ConfigBean implements Serializable 44 { 45 46 static Vector comparators = new Vector(); 47 private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0); 48 49 static public final String ELEMENT_PROPERTY = "ElementProperty"; 50 51 public WebContainerAvailability() { 52 this(Common.USE_DEFAULT_VALUES); 53 } 54 55 public WebContainerAvailability(int options) 56 { 57 super(comparators, runtimeVersion); 58 initPropertyTables(1); 60 this.createProperty("property", ELEMENT_PROPERTY, 61 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 62 ElementProperty.class); 63 this.createAttribute(ELEMENT_PROPERTY, "name", "Name", 64 AttrProp.CDATA | AttrProp.REQUIRED, 65 null, null); 66 this.createAttribute(ELEMENT_PROPERTY, "value", "Value", 67 AttrProp.CDATA | AttrProp.REQUIRED, 68 null, null); 69 this.initialize(options); 70 } 71 72 void initialize(int options) { 74 75 } 76 77 public void setElementProperty(int index, ElementProperty value) { 79 this.setValue(ELEMENT_PROPERTY, index, value); 80 } 81 82 public ElementProperty getElementProperty(int index) { 84 return (ElementProperty)this.getValue(ELEMENT_PROPERTY, index); 85 } 86 87 public void setElementProperty(ElementProperty[] value) { 89 this.setValue(ELEMENT_PROPERTY, value); 90 } 91 92 public ElementProperty[] getElementProperty() { 94 return (ElementProperty[])this.getValues(ELEMENT_PROPERTY); 95 } 96 97 public int sizeElementProperty() { 99 return this.size(ELEMENT_PROPERTY); 100 } 101 102 public int addElementProperty(ElementProperty value) 104 throws ConfigException{ 105 return addElementProperty(value, true); 106 } 107 108 public int addElementProperty(ElementProperty value, boolean overwrite) 110 throws ConfigException{ 111 ElementProperty old = getElementPropertyByName(value.getName()); 112 if(old != null) { 113 throw new ConfigException(StringManager.getManager(WebContainerAvailability.class).getString("cannotAddDuplicate", "ElementProperty")); 114 } 115 return this.addValue(ELEMENT_PROPERTY, value, overwrite); 116 } 117 118 public int removeElementProperty(ElementProperty value){ 123 return this.removeValue(ELEMENT_PROPERTY, value); 124 } 125 126 public int removeElementProperty(ElementProperty value, boolean overwrite) 132 throws StaleWriteConfigException{ 133 return this.removeValue(ELEMENT_PROPERTY, value, overwrite); 134 } 135 136 public ElementProperty getElementPropertyByName(String id) { 137 if (null != id) { id = id.trim(); } 138 ElementProperty[] o = getElementProperty(); 139 if (o == null) return null; 140 141 for (int i=0; i < o.length; i++) { 142 if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) { 143 return o[i]; 144 } 145 } 146 147 return null; 148 149 } 150 154 public String getAvailabilityEnabled() { 155 return getAttributeValue(ServerTags.AVAILABILITY_ENABLED); 156 } 157 162 public void setAvailabilityEnabled(String v, boolean overwrite) throws StaleWriteConfigException { 163 setAttributeValue(ServerTags.AVAILABILITY_ENABLED, v, overwrite); 164 } 165 169 public void setAvailabilityEnabled(String v) { 170 setAttributeValue(ServerTags.AVAILABILITY_ENABLED, v); 171 } 172 176 public String getPersistenceType() { 177 return getAttributeValue(ServerTags.PERSISTENCE_TYPE); 178 } 179 184 public void setPersistenceType(String v, boolean overwrite) throws StaleWriteConfigException { 185 setAttributeValue(ServerTags.PERSISTENCE_TYPE, v, overwrite); 186 } 187 191 public void setPersistenceType(String v) { 192 setAttributeValue(ServerTags.PERSISTENCE_TYPE, v); 193 } 194 197 public static String getDefaultPersistenceType() { 198 return "memory".trim(); 199 } 200 204 public String getPersistenceFrequency() { 205 return getAttributeValue(ServerTags.PERSISTENCE_FREQUENCY); 206 } 207 212 public void setPersistenceFrequency(String v, boolean overwrite) throws StaleWriteConfigException { 213 setAttributeValue(ServerTags.PERSISTENCE_FREQUENCY, v, overwrite); 214 } 215 219 public void setPersistenceFrequency(String v) { 220 setAttributeValue(ServerTags.PERSISTENCE_FREQUENCY, v); 221 } 222 226 public String getPersistenceScope() { 227 return getAttributeValue(ServerTags.PERSISTENCE_SCOPE); 228 } 229 234 public void setPersistenceScope(String v, boolean overwrite) throws StaleWriteConfigException { 235 setAttributeValue(ServerTags.PERSISTENCE_SCOPE, v, overwrite); 236 } 237 241 public void setPersistenceScope(String v) { 242 setAttributeValue(ServerTags.PERSISTENCE_SCOPE, v); 243 } 244 248 public boolean isPersistenceStoreHealthCheckEnabled() { 249 return toBoolean(getAttributeValue(ServerTags.PERSISTENCE_STORE_HEALTH_CHECK_ENABLED)); 250 } 251 256 public void setPersistenceStoreHealthCheckEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 257 setAttributeValue(ServerTags.PERSISTENCE_STORE_HEALTH_CHECK_ENABLED, ""+(v==true), overwrite); 258 } 259 263 public void setPersistenceStoreHealthCheckEnabled(boolean v) { 264 setAttributeValue(ServerTags.PERSISTENCE_STORE_HEALTH_CHECK_ENABLED, ""+(v==true)); 265 } 266 269 public static String getDefaultPersistenceStoreHealthCheckEnabled() { 270 return "false".trim(); 271 } 272 276 public boolean isSsoFailoverEnabled() { 277 return toBoolean(getAttributeValue(ServerTags.SSO_FAILOVER_ENABLED)); 278 } 279 284 public void setSsoFailoverEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 285 setAttributeValue(ServerTags.SSO_FAILOVER_ENABLED, ""+(v==true), overwrite); 286 } 287 291 public void setSsoFailoverEnabled(boolean v) { 292 setAttributeValue(ServerTags.SSO_FAILOVER_ENABLED, ""+(v==true)); 293 } 294 297 public static String getDefaultSsoFailoverEnabled() { 298 return "false".trim(); 299 } 300 304 public String getHttpSessionStorePoolName() { 305 return getAttributeValue(ServerTags.HTTP_SESSION_STORE_POOL_NAME); 306 } 307 312 public void setHttpSessionStorePoolName(String v, boolean overwrite) throws StaleWriteConfigException { 313 setAttributeValue(ServerTags.HTTP_SESSION_STORE_POOL_NAME, v, overwrite); 314 } 315 319 public void setHttpSessionStorePoolName(String v) { 320 setAttributeValue(ServerTags.HTTP_SESSION_STORE_POOL_NAME, v); 321 } 322 326 public ElementProperty newElementProperty() { 327 return new ElementProperty(); 328 } 329 330 335 protected String getRelativeXPath() { 336 String ret = null; 337 ret = "web-container-availability"; 338 return (null != ret ? ret.trim() : null); 339 } 340 341 344 public static String getDefaultAttributeValue(String attr) { 345 if(attr == null) return null; 346 attr = attr.trim(); 347 if(attr.equals(ServerTags.PERSISTENCE_TYPE)) return "memory".trim(); 348 if(attr.equals(ServerTags.PERSISTENCE_STORE_HEALTH_CHECK_ENABLED)) return "false".trim(); 349 if(attr.equals(ServerTags.SSO_FAILOVER_ENABLED)) return "false".trim(); 350 return null; 351 } 352 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 354 comparators.add(c); 355 } 356 357 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 359 comparators.remove(c); 360 } 361 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 362 } 363 364 public void dump(StringBuffer str, String indent){ 366 String s; 367 Object o; 368 org.netbeans.modules.schema2beans.BaseBean n; 369 str.append(indent); 370 str.append("ElementProperty["+this.sizeElementProperty()+"]"); for(int i=0; i<this.sizeElementProperty(); i++) 372 { 373 str.append(indent+"\t"); 374 str.append("#"+i+":"); 375 n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i); 376 if (n != null) 377 n.dump(str, indent + "\t"); else 379 str.append(indent+"\tnull"); this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent); 381 } 382 383 } 384 public String dumpBeanNode(){ 385 StringBuffer str = new StringBuffer (); 386 str.append("WebContainerAvailability\n"); this.dump(str, "\n "); return str.toString(); 389 }} 390 391 393 | Popular Tags |