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 IiopListener 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 SSL = "Ssl"; 50 static public final String ELEMENT_PROPERTY = "ElementProperty"; 51 52 public IiopListener() { 53 this(Common.USE_DEFAULT_VALUES); 54 } 55 56 public IiopListener(int options) 57 { 58 super(comparators, runtimeVersion); 59 initPropertyTables(2); 61 this.createProperty("ssl", SSL, 62 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 63 Ssl.class); 64 this.createAttribute(SSL, "cert-nickname", "CertNickname", 65 AttrProp.CDATA | AttrProp.REQUIRED, 66 null, null); 67 this.createAttribute(SSL, "ssl2-enabled", "Ssl2Enabled", 68 AttrProp.CDATA, 69 null, "false"); 70 this.createAttribute(SSL, "ssl2-ciphers", "Ssl2Ciphers", 71 AttrProp.CDATA | AttrProp.IMPLIED, 72 null, null); 73 this.createAttribute(SSL, "ssl3-enabled", "Ssl3Enabled", 74 AttrProp.CDATA, 75 null, "true"); 76 this.createAttribute(SSL, "ssl3-tls-ciphers", "Ssl3TlsCiphers", 77 AttrProp.CDATA | AttrProp.IMPLIED, 78 null, null); 79 this.createAttribute(SSL, "tls-enabled", "TlsEnabled", 80 AttrProp.CDATA, 81 null, "true"); 82 this.createAttribute(SSL, "tls-rollback-enabled", "TlsRollbackEnabled", 83 AttrProp.CDATA, 84 null, "true"); 85 this.createAttribute(SSL, "client-auth-enabled", "ClientAuthEnabled", 86 AttrProp.CDATA, 87 null, "false"); 88 this.createProperty("property", ELEMENT_PROPERTY, 89 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 90 ElementProperty.class); 91 this.createAttribute(ELEMENT_PROPERTY, "name", "Name", 92 AttrProp.CDATA | AttrProp.REQUIRED, 93 null, null); 94 this.createAttribute(ELEMENT_PROPERTY, "value", "Value", 95 AttrProp.CDATA | AttrProp.REQUIRED, 96 null, null); 97 this.initialize(options); 98 } 99 100 void initialize(int options) { 102 103 } 104 105 public void setSsl(Ssl value) { 107 this.setValue(SSL, value); 108 } 109 110 public Ssl getSsl() { 112 return (Ssl)this.getValue(SSL); 113 } 114 115 public void setElementProperty(int index, ElementProperty value) { 117 this.setValue(ELEMENT_PROPERTY, index, value); 118 } 119 120 public ElementProperty getElementProperty(int index) { 122 return (ElementProperty)this.getValue(ELEMENT_PROPERTY, index); 123 } 124 125 public void setElementProperty(ElementProperty[] value) { 127 this.setValue(ELEMENT_PROPERTY, value); 128 } 129 130 public ElementProperty[] getElementProperty() { 132 return (ElementProperty[])this.getValues(ELEMENT_PROPERTY); 133 } 134 135 public int sizeElementProperty() { 137 return this.size(ELEMENT_PROPERTY); 138 } 139 140 public int addElementProperty(ElementProperty value) 142 throws ConfigException{ 143 return addElementProperty(value, true); 144 } 145 146 public int addElementProperty(ElementProperty value, boolean overwrite) 148 throws ConfigException{ 149 ElementProperty old = getElementPropertyByName(value.getName()); 150 if(old != null) { 151 throw new ConfigException(StringManager.getManager(IiopListener.class).getString("cannotAddDuplicate", "ElementProperty")); 152 } 153 return this.addValue(ELEMENT_PROPERTY, value, overwrite); 154 } 155 156 public int removeElementProperty(ElementProperty value){ 161 return this.removeValue(ELEMENT_PROPERTY, value); 162 } 163 164 public int removeElementProperty(ElementProperty value, boolean overwrite) 170 throws StaleWriteConfigException{ 171 return this.removeValue(ELEMENT_PROPERTY, value, overwrite); 172 } 173 174 public ElementProperty getElementPropertyByName(String id) { 175 if (null != id) { id = id.trim(); } 176 ElementProperty[] o = getElementProperty(); 177 if (o == null) return null; 178 179 for (int i=0; i < o.length; i++) { 180 if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) { 181 return o[i]; 182 } 183 } 184 185 return null; 186 187 } 188 192 public String getId() { 193 return getAttributeValue(ServerTags.ID); 194 } 195 200 public void setId(String v, boolean overwrite) throws StaleWriteConfigException { 201 setAttributeValue(ServerTags.ID, v, overwrite); 202 } 203 207 public void setId(String v) { 208 setAttributeValue(ServerTags.ID, v); 209 } 210 214 public String getAddress() { 215 return getAttributeValue(ServerTags.ADDRESS); 216 } 217 222 public void setAddress(String v, boolean overwrite) throws StaleWriteConfigException { 223 setAttributeValue(ServerTags.ADDRESS, v, overwrite); 224 } 225 229 public void setAddress(String v) { 230 setAttributeValue(ServerTags.ADDRESS, v); 231 } 232 236 public String getPort() { 237 return getAttributeValue(ServerTags.PORT); 238 } 239 244 public void setPort(String v, boolean overwrite) throws StaleWriteConfigException { 245 setAttributeValue(ServerTags.PORT, v, overwrite); 246 } 247 251 public void setPort(String v) { 252 setAttributeValue(ServerTags.PORT, v); 253 } 254 257 public static String getDefaultPort() { 258 return "1072".trim(); 259 } 260 264 public boolean isSecurityEnabled() { 265 return toBoolean(getAttributeValue(ServerTags.SECURITY_ENABLED)); 266 } 267 272 public void setSecurityEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 273 setAttributeValue(ServerTags.SECURITY_ENABLED, ""+(v==true), overwrite); 274 } 275 279 public void setSecurityEnabled(boolean v) { 280 setAttributeValue(ServerTags.SECURITY_ENABLED, ""+(v==true)); 281 } 282 285 public static String getDefaultSecurityEnabled() { 286 return "false".trim(); 287 } 288 292 public boolean isEnabled() { 293 return toBoolean(getAttributeValue(ServerTags.ENABLED)); 294 } 295 300 public void setEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 301 setAttributeValue(ServerTags.ENABLED, ""+(v==true), overwrite); 302 } 303 307 public void setEnabled(boolean v) { 308 setAttributeValue(ServerTags.ENABLED, ""+(v==true)); 309 } 310 313 public static String getDefaultEnabled() { 314 return "true".trim(); 315 } 316 320 public Ssl newSsl() { 321 return new Ssl(); 322 } 323 324 328 public ElementProperty newElementProperty() { 329 return new ElementProperty(); 330 } 331 332 337 protected String getRelativeXPath() { 338 String ret = null; 339 ret = "iiop-listener" + (canHaveSiblings() ? "[@id='" + getAttributeValue("id") +"']" : "") ; 340 return (null != ret ? ret.trim() : null); 341 } 342 343 346 public static String getDefaultAttributeValue(String attr) { 347 if(attr == null) return null; 348 attr = attr.trim(); 349 if(attr.equals(ServerTags.PORT)) return "1072".trim(); 350 if(attr.equals(ServerTags.SECURITY_ENABLED)) return "false".trim(); 351 if(attr.equals(ServerTags.ENABLED)) return "true".trim(); 352 return null; 353 } 354 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 356 comparators.add(c); 357 } 358 359 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 361 comparators.remove(c); 362 } 363 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 364 } 365 366 public void dump(StringBuffer str, String indent){ 368 String s; 369 Object o; 370 org.netbeans.modules.schema2beans.BaseBean n; 371 str.append(indent); 372 str.append("Ssl"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getSsl(); 374 if (n != null) 375 n.dump(str, indent + "\t"); else 377 str.append(indent+"\tnull"); this.dumpAttributes(SSL, 0, str, indent); 379 380 str.append(indent); 381 str.append("ElementProperty["+this.sizeElementProperty()+"]"); for(int i=0; i<this.sizeElementProperty(); i++) 383 { 384 str.append(indent+"\t"); 385 str.append("#"+i+":"); 386 n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i); 387 if (n != null) 388 n.dump(str, indent + "\t"); else 390 str.append(indent+"\tnull"); this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent); 392 } 393 394 } 395 public String dumpBeanNode(){ 396 StringBuffer str = new StringBuffer (); 397 str.append("IiopListener\n"); this.dump(str, "\n "); return str.toString(); 400 }} 401 402 404 | Popular Tags |