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 GroupManagementService 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 GroupManagementService() { 52 this(Common.USE_DEFAULT_VALUES); 53 } 54 55 public GroupManagementService(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(GroupManagementService.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 getFdProtocolMaxTries() { 155 return getAttributeValue(ServerTags.FD_PROTOCOL_MAX_TRIES); 156 } 157 162 public void setFdProtocolMaxTries(String v, boolean overwrite) throws StaleWriteConfigException { 163 setAttributeValue(ServerTags.FD_PROTOCOL_MAX_TRIES, v, overwrite); 164 } 165 169 public void setFdProtocolMaxTries(String v) { 170 setAttributeValue(ServerTags.FD_PROTOCOL_MAX_TRIES, v); 171 } 172 175 public static String getDefaultFdProtocolMaxTries() { 176 return "3".trim(); 177 } 178 182 public String getFdProtocolTimeoutInMillis() { 183 return getAttributeValue(ServerTags.FD_PROTOCOL_TIMEOUT_IN_MILLIS); 184 } 185 190 public void setFdProtocolTimeoutInMillis(String v, boolean overwrite) throws StaleWriteConfigException { 191 setAttributeValue(ServerTags.FD_PROTOCOL_TIMEOUT_IN_MILLIS, v, overwrite); 192 } 193 197 public void setFdProtocolTimeoutInMillis(String v) { 198 setAttributeValue(ServerTags.FD_PROTOCOL_TIMEOUT_IN_MILLIS, v); 199 } 200 203 public static String getDefaultFdProtocolTimeoutInMillis() { 204 return "2000".trim(); 205 } 206 210 public String getMergeProtocolMaxIntervalInMillis() { 211 return getAttributeValue(ServerTags.MERGE_PROTOCOL_MAX_INTERVAL_IN_MILLIS); 212 } 213 218 public void setMergeProtocolMaxIntervalInMillis(String v, boolean overwrite) throws StaleWriteConfigException { 219 setAttributeValue(ServerTags.MERGE_PROTOCOL_MAX_INTERVAL_IN_MILLIS, v, overwrite); 220 } 221 225 public void setMergeProtocolMaxIntervalInMillis(String v) { 226 setAttributeValue(ServerTags.MERGE_PROTOCOL_MAX_INTERVAL_IN_MILLIS, v); 227 } 228 231 public static String getDefaultMergeProtocolMaxIntervalInMillis() { 232 return "10000".trim(); 233 } 234 238 public String getMergeProtocolMinIntervalInMillis() { 239 return getAttributeValue(ServerTags.MERGE_PROTOCOL_MIN_INTERVAL_IN_MILLIS); 240 } 241 246 public void setMergeProtocolMinIntervalInMillis(String v, boolean overwrite) throws StaleWriteConfigException { 247 setAttributeValue(ServerTags.MERGE_PROTOCOL_MIN_INTERVAL_IN_MILLIS, v, overwrite); 248 } 249 253 public void setMergeProtocolMinIntervalInMillis(String v) { 254 setAttributeValue(ServerTags.MERGE_PROTOCOL_MIN_INTERVAL_IN_MILLIS, v); 255 } 256 259 public static String getDefaultMergeProtocolMinIntervalInMillis() { 260 return "5000".trim(); 261 } 262 266 public String getPingProtocolTimeoutInMillis() { 267 return getAttributeValue(ServerTags.PING_PROTOCOL_TIMEOUT_IN_MILLIS); 268 } 269 274 public void setPingProtocolTimeoutInMillis(String v, boolean overwrite) throws StaleWriteConfigException { 275 setAttributeValue(ServerTags.PING_PROTOCOL_TIMEOUT_IN_MILLIS, v, overwrite); 276 } 277 281 public void setPingProtocolTimeoutInMillis(String v) { 282 setAttributeValue(ServerTags.PING_PROTOCOL_TIMEOUT_IN_MILLIS, v); 283 } 284 287 public static String getDefaultPingProtocolTimeoutInMillis() { 288 return "2000".trim(); 289 } 290 294 public String getVsProtocolTimeoutInMillis() { 295 return getAttributeValue(ServerTags.VS_PROTOCOL_TIMEOUT_IN_MILLIS); 296 } 297 302 public void setVsProtocolTimeoutInMillis(String v, boolean overwrite) throws StaleWriteConfigException { 303 setAttributeValue(ServerTags.VS_PROTOCOL_TIMEOUT_IN_MILLIS, v, overwrite); 304 } 305 309 public void setVsProtocolTimeoutInMillis(String v) { 310 setAttributeValue(ServerTags.VS_PROTOCOL_TIMEOUT_IN_MILLIS, v); 311 } 312 315 public static String getDefaultVsProtocolTimeoutInMillis() { 316 return "1500".trim(); 317 } 318 322 public ElementProperty newElementProperty() { 323 return new ElementProperty(); 324 } 325 326 331 protected String getRelativeXPath() { 332 String ret = null; 333 ret = "group-management-service"; 334 return (null != ret ? ret.trim() : null); 335 } 336 337 340 public static String getDefaultAttributeValue(String attr) { 341 if(attr == null) return null; 342 attr = attr.trim(); 343 if(attr.equals(ServerTags.FD_PROTOCOL_MAX_TRIES)) return "3".trim(); 344 if(attr.equals(ServerTags.FD_PROTOCOL_TIMEOUT_IN_MILLIS)) return "2000".trim(); 345 if(attr.equals(ServerTags.MERGE_PROTOCOL_MAX_INTERVAL_IN_MILLIS)) return "10000".trim(); 346 if(attr.equals(ServerTags.MERGE_PROTOCOL_MIN_INTERVAL_IN_MILLIS)) return "5000".trim(); 347 if(attr.equals(ServerTags.PING_PROTOCOL_TIMEOUT_IN_MILLIS)) return "2000".trim(); 348 if(attr.equals(ServerTags.VS_PROTOCOL_TIMEOUT_IN_MILLIS)) return "1500".trim(); 349 return null; 350 } 351 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 353 comparators.add(c); 354 } 355 356 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 358 comparators.remove(c); 359 } 360 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 361 } 362 363 public void dump(StringBuffer str, String indent){ 365 String s; 366 Object o; 367 org.netbeans.modules.schema2beans.BaseBean n; 368 str.append(indent); 369 str.append("ElementProperty["+this.sizeElementProperty()+"]"); for(int i=0; i<this.sizeElementProperty(); i++) 371 { 372 str.append(indent+"\t"); 373 str.append("#"+i+":"); 374 n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i); 375 if (n != null) 376 n.dump(str, indent + "\t"); else 378 str.append(indent+"\tnull"); this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent); 380 } 381 382 } 383 public String dumpBeanNode(){ 384 StringBuffer str = new StringBuffer (); 385 str.append("GroupManagementService\n"); this.dump(str, "\n "); return str.toString(); 388 }} 389 390 392 | Popular Tags |