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 LbConfigs 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 LB_CONFIG = "LbConfig"; 50 51 public LbConfigs() { 52 this(Common.USE_DEFAULT_VALUES); 53 } 54 55 public LbConfigs(int options) 56 { 57 super(comparators, runtimeVersion); 58 initPropertyTables(1); 60 this.createProperty("lb-config", LB_CONFIG, 61 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 62 LbConfig.class); 63 this.createAttribute(LB_CONFIG, "name", "Name", 64 AttrProp.CDATA | AttrProp.REQUIRED, 65 null, null); 66 this.createAttribute(LB_CONFIG, "response-timeout-in-seconds", "ResponseTimeoutInSeconds", 67 AttrProp.CDATA, 68 null, "60"); 69 this.createAttribute(LB_CONFIG, "https-routing", "HttpsRouting", 70 AttrProp.CDATA, 71 null, "false"); 72 this.createAttribute(LB_CONFIG, "reload-poll-interval-in-seconds", "ReloadPollIntervalInSeconds", 73 AttrProp.CDATA, 74 null, "60"); 75 this.createAttribute(LB_CONFIG, "monitoring-enabled", "MonitoringEnabled", 76 AttrProp.CDATA, 77 null, "false"); 78 this.createAttribute(LB_CONFIG, "route-cookie-enabled", "RouteCookieEnabled", 79 AttrProp.CDATA, 80 null, "true"); 81 this.initialize(options); 82 } 83 84 void initialize(int options) { 86 87 } 88 89 public void setLbConfig(int index, LbConfig value) { 91 this.setValue(LB_CONFIG, index, value); 92 } 93 94 public LbConfig getLbConfig(int index) { 96 return (LbConfig)this.getValue(LB_CONFIG, index); 97 } 98 99 public void setLbConfig(LbConfig[] value) { 101 this.setValue(LB_CONFIG, value); 102 } 103 104 public LbConfig[] getLbConfig() { 106 return (LbConfig[])this.getValues(LB_CONFIG); 107 } 108 109 public int sizeLbConfig() { 111 return this.size(LB_CONFIG); 112 } 113 114 public int addLbConfig(LbConfig value) 116 throws ConfigException{ 117 return addLbConfig(value, true); 118 } 119 120 public int addLbConfig(LbConfig value, boolean overwrite) 122 throws ConfigException{ 123 LbConfig old = getLbConfigByName(value.getName()); 124 if(old != null) { 125 throw new ConfigException(StringManager.getManager(LbConfigs.class).getString("cannotAddDuplicate", "LbConfig")); 126 } 127 return this.addValue(LB_CONFIG, value, overwrite); 128 } 129 130 public int removeLbConfig(LbConfig value){ 135 return this.removeValue(LB_CONFIG, value); 136 } 137 138 public int removeLbConfig(LbConfig value, boolean overwrite) 144 throws StaleWriteConfigException{ 145 return this.removeValue(LB_CONFIG, value, overwrite); 146 } 147 148 public LbConfig getLbConfigByName(String id) { 149 if (null != id) { id = id.trim(); } 150 LbConfig[] o = getLbConfig(); 151 if (o == null) return null; 152 153 for (int i=0; i < o.length; i++) { 154 if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) { 155 return o[i]; 156 } 157 } 158 159 return null; 160 161 } 162 166 public LbConfig newLbConfig() { 167 return new LbConfig(); 168 } 169 170 175 protected String getRelativeXPath() { 176 String ret = null; 177 ret = "lb-configs"; 178 return (null != ret ? ret.trim() : null); 179 } 180 181 184 public static String getDefaultAttributeValue(String attr) { 185 if(attr == null) return null; 186 attr = attr.trim(); 187 return null; 188 } 189 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 191 comparators.add(c); 192 } 193 194 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 196 comparators.remove(c); 197 } 198 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 199 } 200 201 public void dump(StringBuffer str, String indent){ 203 String s; 204 Object o; 205 org.netbeans.modules.schema2beans.BaseBean n; 206 str.append(indent); 207 str.append("LbConfig["+this.sizeLbConfig()+"]"); for(int i=0; i<this.sizeLbConfig(); i++) 209 { 210 str.append(indent+"\t"); 211 str.append("#"+i+":"); 212 n = (org.netbeans.modules.schema2beans.BaseBean) this.getLbConfig(i); 213 if (n != null) 214 n.dump(str, indent + "\t"); else 216 str.append(indent+"\tnull"); this.dumpAttributes(LB_CONFIG, i, str, indent); 218 } 219 220 } 221 public String dumpBeanNode(){ 222 StringBuffer str = new StringBuffer (); 223 str.append("LbConfigs\n"); this.dump(str, "\n "); return str.toString(); 226 }} 227 228 230 | Popular Tags |