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 ModuleMonitoringLevels 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 ModuleMonitoringLevels() { 52 this(Common.USE_DEFAULT_VALUES); 53 } 54 55 public ModuleMonitoringLevels(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(ModuleMonitoringLevels.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 getThreadPool() { 155 return getAttributeValue(ServerTags.THREAD_POOL); 156 } 157 162 public void setThreadPool(String v, boolean overwrite) throws StaleWriteConfigException { 163 setAttributeValue(ServerTags.THREAD_POOL, v, overwrite); 164 } 165 169 public void setThreadPool(String v) { 170 setAttributeValue(ServerTags.THREAD_POOL, v); 171 } 172 175 public static String getDefaultThreadPool() { 176 return "OFF".trim(); 177 } 178 182 public String getOrb() { 183 return getAttributeValue(ServerTags.ORB); 184 } 185 190 public void setOrb(String v, boolean overwrite) throws StaleWriteConfigException { 191 setAttributeValue(ServerTags.ORB, v, overwrite); 192 } 193 197 public void setOrb(String v) { 198 setAttributeValue(ServerTags.ORB, v); 199 } 200 203 public static String getDefaultOrb() { 204 return "OFF".trim(); 205 } 206 210 public String getEjbContainer() { 211 return getAttributeValue(ServerTags.EJB_CONTAINER); 212 } 213 218 public void setEjbContainer(String v, boolean overwrite) throws StaleWriteConfigException { 219 setAttributeValue(ServerTags.EJB_CONTAINER, v, overwrite); 220 } 221 225 public void setEjbContainer(String v) { 226 setAttributeValue(ServerTags.EJB_CONTAINER, v); 227 } 228 231 public static String getDefaultEjbContainer() { 232 return "OFF".trim(); 233 } 234 238 public String getWebContainer() { 239 return getAttributeValue(ServerTags.WEB_CONTAINER); 240 } 241 246 public void setWebContainer(String v, boolean overwrite) throws StaleWriteConfigException { 247 setAttributeValue(ServerTags.WEB_CONTAINER, v, overwrite); 248 } 249 253 public void setWebContainer(String v) { 254 setAttributeValue(ServerTags.WEB_CONTAINER, v); 255 } 256 259 public static String getDefaultWebContainer() { 260 return "OFF".trim(); 261 } 262 266 public String getTransactionService() { 267 return getAttributeValue(ServerTags.TRANSACTION_SERVICE); 268 } 269 274 public void setTransactionService(String v, boolean overwrite) throws StaleWriteConfigException { 275 setAttributeValue(ServerTags.TRANSACTION_SERVICE, v, overwrite); 276 } 277 281 public void setTransactionService(String v) { 282 setAttributeValue(ServerTags.TRANSACTION_SERVICE, v); 283 } 284 287 public static String getDefaultTransactionService() { 288 return "OFF".trim(); 289 } 290 294 public String getHttpService() { 295 return getAttributeValue(ServerTags.HTTP_SERVICE); 296 } 297 302 public void setHttpService(String v, boolean overwrite) throws StaleWriteConfigException { 303 setAttributeValue(ServerTags.HTTP_SERVICE, v, overwrite); 304 } 305 309 public void setHttpService(String v) { 310 setAttributeValue(ServerTags.HTTP_SERVICE, v); 311 } 312 315 public static String getDefaultHttpService() { 316 return "OFF".trim(); 317 } 318 322 public String getJdbcConnectionPool() { 323 return getAttributeValue(ServerTags.JDBC_CONNECTION_POOL); 324 } 325 330 public void setJdbcConnectionPool(String v, boolean overwrite) throws StaleWriteConfigException { 331 setAttributeValue(ServerTags.JDBC_CONNECTION_POOL, v, overwrite); 332 } 333 337 public void setJdbcConnectionPool(String v) { 338 setAttributeValue(ServerTags.JDBC_CONNECTION_POOL, v); 339 } 340 343 public static String getDefaultJdbcConnectionPool() { 344 return "OFF".trim(); 345 } 346 350 public String getConnectorConnectionPool() { 351 return getAttributeValue(ServerTags.CONNECTOR_CONNECTION_POOL); 352 } 353 358 public void setConnectorConnectionPool(String v, boolean overwrite) throws StaleWriteConfigException { 359 setAttributeValue(ServerTags.CONNECTOR_CONNECTION_POOL, v, overwrite); 360 } 361 365 public void setConnectorConnectionPool(String v) { 366 setAttributeValue(ServerTags.CONNECTOR_CONNECTION_POOL, v); 367 } 368 371 public static String getDefaultConnectorConnectionPool() { 372 return "OFF".trim(); 373 } 374 378 public String getConnectorService() { 379 return getAttributeValue(ServerTags.CONNECTOR_SERVICE); 380 } 381 386 public void setConnectorService(String v, boolean overwrite) throws StaleWriteConfigException { 387 setAttributeValue(ServerTags.CONNECTOR_SERVICE, v, overwrite); 388 } 389 393 public void setConnectorService(String v) { 394 setAttributeValue(ServerTags.CONNECTOR_SERVICE, v); 395 } 396 399 public static String getDefaultConnectorService() { 400 return "OFF".trim(); 401 } 402 406 public String getJmsService() { 407 return getAttributeValue(ServerTags.JMS_SERVICE); 408 } 409 414 public void setJmsService(String v, boolean overwrite) throws StaleWriteConfigException { 415 setAttributeValue(ServerTags.JMS_SERVICE, v, overwrite); 416 } 417 421 public void setJmsService(String v) { 422 setAttributeValue(ServerTags.JMS_SERVICE, v); 423 } 424 427 public static String getDefaultJmsService() { 428 return "OFF".trim(); 429 } 430 434 public String getJvm() { 435 return getAttributeValue(ServerTags.JVM); 436 } 437 442 public void setJvm(String v, boolean overwrite) throws StaleWriteConfigException { 443 setAttributeValue(ServerTags.JVM, v, overwrite); 444 } 445 449 public void setJvm(String v) { 450 setAttributeValue(ServerTags.JVM, v); 451 } 452 455 public static String getDefaultJvm() { 456 return "OFF".trim(); 457 } 458 462 public ElementProperty newElementProperty() { 463 return new ElementProperty(); 464 } 465 466 471 protected String getRelativeXPath() { 472 String ret = null; 473 ret = "module-monitoring-levels"; 474 return (null != ret ? ret.trim() : null); 475 } 476 477 480 public static String getDefaultAttributeValue(String attr) { 481 if(attr == null) return null; 482 attr = attr.trim(); 483 if(attr.equals(ServerTags.THREAD_POOL)) return "OFF".trim(); 484 if(attr.equals(ServerTags.ORB)) return "OFF".trim(); 485 if(attr.equals(ServerTags.EJB_CONTAINER)) return "OFF".trim(); 486 if(attr.equals(ServerTags.WEB_CONTAINER)) return "OFF".trim(); 487 if(attr.equals(ServerTags.TRANSACTION_SERVICE)) return "OFF".trim(); 488 if(attr.equals(ServerTags.HTTP_SERVICE)) return "OFF".trim(); 489 if(attr.equals(ServerTags.JDBC_CONNECTION_POOL)) return "OFF".trim(); 490 if(attr.equals(ServerTags.CONNECTOR_CONNECTION_POOL)) return "OFF".trim(); 491 if(attr.equals(ServerTags.CONNECTOR_SERVICE)) return "OFF".trim(); 492 if(attr.equals(ServerTags.JMS_SERVICE)) return "OFF".trim(); 493 if(attr.equals(ServerTags.JVM)) return "OFF".trim(); 494 return null; 495 } 496 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 498 comparators.add(c); 499 } 500 501 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 503 comparators.remove(c); 504 } 505 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 506 } 507 508 public void dump(StringBuffer str, String indent){ 510 String s; 511 Object o; 512 org.netbeans.modules.schema2beans.BaseBean n; 513 str.append(indent); 514 str.append("ElementProperty["+this.sizeElementProperty()+"]"); for(int i=0; i<this.sizeElementProperty(); i++) 516 { 517 str.append(indent+"\t"); 518 str.append("#"+i+":"); 519 n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i); 520 if (n != null) 521 n.dump(str, indent + "\t"); else 523 str.append(indent+"\tnull"); this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent); 525 } 526 527 } 528 public String dumpBeanNode(){ 529 StringBuffer str = new StringBuffer (); 530 str.append("ModuleMonitoringLevels\n"); this.dump(str, "\n "); return str.toString(); 533 }} 534 535 537 | Popular Tags |