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 IiopService 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 ORB = "Orb"; 50 static public final String SSL_CLIENT_CONFIG = "SslClientConfig"; 51 static public final String IIOP_LISTENER = "IiopListener"; 52 53 public IiopService() { 54 this(Common.USE_DEFAULT_VALUES); 55 } 56 57 public IiopService(int options) 58 { 59 super(comparators, runtimeVersion); 60 initPropertyTables(3); 62 this.createProperty("orb", ORB, 63 Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 64 Orb.class); 65 this.createAttribute(ORB, "use-thread-pool-ids", "UseThreadPoolIds", 66 AttrProp.CDATA | AttrProp.REQUIRED, 67 null, null); 68 this.createAttribute(ORB, "message-fragment-size", "MessageFragmentSize", 69 AttrProp.CDATA, 70 null, "1024"); 71 this.createAttribute(ORB, "max-connections", "MaxConnections", 72 AttrProp.CDATA, 73 null, "1024"); 74 this.createProperty("ssl-client-config", SSL_CLIENT_CONFIG, 75 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 76 SslClientConfig.class); 77 this.createProperty("iiop-listener", IIOP_LISTENER, 78 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 79 IiopListener.class); 80 this.createAttribute(IIOP_LISTENER, "id", "Id", 81 AttrProp.CDATA | AttrProp.REQUIRED, 82 null, null); 83 this.createAttribute(IIOP_LISTENER, "address", "Address", 84 AttrProp.CDATA | AttrProp.REQUIRED, 85 null, null); 86 this.createAttribute(IIOP_LISTENER, "port", "Port", 87 AttrProp.CDATA, 88 null, "1072"); 89 this.createAttribute(IIOP_LISTENER, "security-enabled", "SecurityEnabled", 90 AttrProp.CDATA, 91 null, "false"); 92 this.createAttribute(IIOP_LISTENER, "enabled", "Enabled", 93 AttrProp.CDATA, 94 null, "true"); 95 this.initialize(options); 96 } 97 98 void initialize(int options) { 100 101 } 102 103 public void setOrb(Orb value) { 105 this.setValue(ORB, value); 106 } 107 108 public Orb getOrb() { 110 return (Orb)this.getValue(ORB); 111 } 112 113 public void setSslClientConfig(SslClientConfig value) { 115 this.setValue(SSL_CLIENT_CONFIG, value); 116 } 117 118 public SslClientConfig getSslClientConfig() { 120 return (SslClientConfig)this.getValue(SSL_CLIENT_CONFIG); 121 } 122 123 public void setIiopListener(int index, IiopListener value) { 125 this.setValue(IIOP_LISTENER, index, value); 126 } 127 128 public IiopListener getIiopListener(int index) { 130 return (IiopListener)this.getValue(IIOP_LISTENER, index); 131 } 132 133 public void setIiopListener(IiopListener[] value) { 135 this.setValue(IIOP_LISTENER, value); 136 } 137 138 public IiopListener[] getIiopListener() { 140 return (IiopListener[])this.getValues(IIOP_LISTENER); 141 } 142 143 public int sizeIiopListener() { 145 return this.size(IIOP_LISTENER); 146 } 147 148 public int addIiopListener(IiopListener value) 150 throws ConfigException{ 151 return addIiopListener(value, true); 152 } 153 154 public int addIiopListener(IiopListener value, boolean overwrite) 156 throws ConfigException{ 157 IiopListener old = getIiopListenerById(value.getId()); 158 if(old != null) { 159 throw new ConfigException(StringManager.getManager(IiopService.class).getString("cannotAddDuplicate", "IiopListener")); 160 } 161 return this.addValue(IIOP_LISTENER, value, overwrite); 162 } 163 164 public int removeIiopListener(IiopListener value){ 169 return this.removeValue(IIOP_LISTENER, value); 170 } 171 172 public int removeIiopListener(IiopListener value, boolean overwrite) 178 throws StaleWriteConfigException{ 179 return this.removeValue(IIOP_LISTENER, value, overwrite); 180 } 181 182 public IiopListener getIiopListenerById(String id) { 183 if (null != id) { id = id.trim(); } 184 IiopListener[] o = getIiopListener(); 185 if (o == null) return null; 186 187 for (int i=0; i < o.length; i++) { 188 if(o[i].getAttributeValue(Common.convertName(ServerTags.ID)).equals(id)) { 189 return o[i]; 190 } 191 } 192 193 return null; 194 195 } 196 200 public boolean isClientAuthenticationRequired() { 201 return toBoolean(getAttributeValue(ServerTags.CLIENT_AUTHENTICATION_REQUIRED)); 202 } 203 208 public void setClientAuthenticationRequired(boolean v, boolean overwrite) throws StaleWriteConfigException { 209 setAttributeValue(ServerTags.CLIENT_AUTHENTICATION_REQUIRED, ""+(v==true), overwrite); 210 } 211 215 public void setClientAuthenticationRequired(boolean v) { 216 setAttributeValue(ServerTags.CLIENT_AUTHENTICATION_REQUIRED, ""+(v==true)); 217 } 218 221 public static String getDefaultClientAuthenticationRequired() { 222 return "false".trim(); 223 } 224 228 public Orb newOrb() { 229 return new Orb(); 230 } 231 232 236 public SslClientConfig newSslClientConfig() { 237 return new SslClientConfig(); 238 } 239 240 244 public IiopListener newIiopListener() { 245 return new IiopListener(); 246 } 247 248 253 protected String getRelativeXPath() { 254 String ret = null; 255 ret = "iiop-service"; 256 return (null != ret ? ret.trim() : null); 257 } 258 259 262 public static String getDefaultAttributeValue(String attr) { 263 if(attr == null) return null; 264 attr = attr.trim(); 265 if(attr.equals(ServerTags.CLIENT_AUTHENTICATION_REQUIRED)) return "false".trim(); 266 return null; 267 } 268 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 270 comparators.add(c); 271 } 272 273 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 275 comparators.remove(c); 276 } 277 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 278 } 279 280 public void dump(StringBuffer str, String indent){ 282 String s; 283 Object o; 284 org.netbeans.modules.schema2beans.BaseBean n; 285 str.append(indent); 286 str.append("Orb"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getOrb(); 288 if (n != null) 289 n.dump(str, indent + "\t"); else 291 str.append(indent+"\tnull"); this.dumpAttributes(ORB, 0, str, indent); 293 294 str.append(indent); 295 str.append("SslClientConfig"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getSslClientConfig(); 297 if (n != null) 298 n.dump(str, indent + "\t"); else 300 str.append(indent+"\tnull"); this.dumpAttributes(SSL_CLIENT_CONFIG, 0, str, indent); 302 303 str.append(indent); 304 str.append("IiopListener["+this.sizeIiopListener()+"]"); for(int i=0; i<this.sizeIiopListener(); i++) 306 { 307 str.append(indent+"\t"); 308 str.append("#"+i+":"); 309 n = (org.netbeans.modules.schema2beans.BaseBean) this.getIiopListener(i); 310 if (n != null) 311 n.dump(str, indent + "\t"); else 313 str.append(indent+"\tnull"); this.dumpAttributes(IIOP_LISTENER, i, str, indent); 315 } 316 317 } 318 public String dumpBeanNode(){ 319 StringBuffer str = new StringBuffer (); 320 str.append("IiopService\n"); this.dump(str, "\n "); return str.toString(); 323 }} 324 325 327 | Popular Tags |