1 23 24 29 30 package com.sun.enterprise.tools.common.dd.connector; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 39 public class ResourceAdapter extends com.sun.enterprise.tools.common.dd.SunBaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String JNDINAME = "JndiName"; static public final String MAXPOOLSIZE = "MaxPoolSize"; static public final String STEADYPOOLSIZE = "SteadyPoolSize"; static public final String MAXWAITTIMEINMILLIS = "MaxWaitTimeInMillis"; static public final String IDLETIMEOUTINSECONDS = "IdleTimeoutInSeconds"; static public final String DESCRIPTION = "Description"; static public final String PROPERTY = "PropertyElement"; static public final String PROPERTYELEMENTNAME = "PropertyElementName"; static public final String PROPERTYELEMENTVALUE = "PropertyElementValue"; 54 public ResourceAdapter() { 55 this(Common.USE_DEFAULT_VALUES); 56 } 57 58 public ResourceAdapter(int options) 59 { 60 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 61 this.createProperty("description", DESCRIPTION, 64 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 65 String .class); 66 this.createProperty("property", PROPERTY, 68 Common.TYPE_0_N | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 69 Boolean .class); 70 this.createAttribute(PROPERTY, "name", "Name", 71 AttrProp.CDATA | AttrProp.REQUIRED, 72 null, null); 73 this.createAttribute(PROPERTY, "value", "Value", 74 AttrProp.CDATA | AttrProp.REQUIRED, 75 null, null); 76 this.initialize(options); 77 } 78 79 void initialize(int options) 81 { 82 83 } 84 85 public void setJndiName(java.lang.String value) { 87 setAttributeValue(JNDINAME, value); 88 } 89 90 public java.lang.String getJndiName() { 92 return getAttributeValue(JNDINAME); 93 } 94 95 public void setMaxPoolSize(java.lang.String value) { 97 setAttributeValue(MAXPOOLSIZE, value); 98 } 99 100 public java.lang.String getMaxPoolSize() { 102 return getAttributeValue(MAXPOOLSIZE); 103 } 104 105 public void setSteadyPoolSize(java.lang.String value) { 107 setAttributeValue(STEADYPOOLSIZE, value); 108 } 109 110 public java.lang.String getSteadyPoolSize() { 112 return getAttributeValue(STEADYPOOLSIZE); 113 } 114 115 public void setMaxWaitTimeInMillis(java.lang.String value) { 117 setAttributeValue(MAXWAITTIMEINMILLIS, value); 118 } 119 120 public java.lang.String getMaxWaitTimeInMillis() { 122 return getAttributeValue(MAXWAITTIMEINMILLIS); 123 } 124 125 public void setIdleTimeoutInSeconds(java.lang.String value) { 127 setAttributeValue(IDLETIMEOUTINSECONDS, value); 128 } 129 130 public java.lang.String getIdleTimeoutInSeconds() { 132 return getAttributeValue(IDLETIMEOUTINSECONDS); 133 } 134 135 public void setDescription(String value) { 137 this.setValue(DESCRIPTION, value); 138 } 139 140 public String getDescription() { 142 return (String )this.getValue(DESCRIPTION); 143 } 144 145 public void setPropertyElement(int index, boolean value) { 147 this.setValue(PROPERTY, index, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 148 } 149 150 public boolean isPropertyElement(int index) { 152 Boolean ret = (Boolean )this.getValue(PROPERTY, index); 153 if (ret == null) 154 ret = (Boolean )Common.defaultScalarValue(Common.TYPE_BOOLEAN); 155 return ((java.lang.Boolean )ret).booleanValue(); 156 } 157 158 public void setPropertyElement(boolean[] value) { 160 Boolean [] values = null; 161 if (value != null) 162 { 163 values = new Boolean [value.length]; 164 for (int i=0; i<value.length; i++) 165 values[i] = new Boolean (value[i]); 166 } 167 this.setValue(PROPERTY, values); 168 } 169 170 public boolean[] getPropertyElement() { 172 boolean[] ret = null; 173 Boolean [] values = (Boolean [])this.getValues(PROPERTY); 174 if (values != null) 175 { 176 ret = new boolean[values.length]; 177 for (int i=0; i<values.length; i++) 178 ret[i] = values[i].booleanValue(); 179 } 180 return ret; 181 } 182 183 public int sizePropertyElement() { 185 return this.size(PROPERTY); 186 } 187 188 public int addPropertyElement(boolean value) { 190 return this.addValue(PROPERTY, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 191 } 192 193 public int removePropertyElement(boolean value) { 198 return this.removeValue(PROPERTY, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 199 } 200 201 public void removePropertyElement(int index) { 205 this.removeValue(PROPERTY, index); 206 } 207 208 public void setPropertyElementName(int index, java.lang.String value) { 210 if (size(PROPERTY) == 0) { 212 addValue(PROPERTY, ""); 213 } 214 setAttributeValue(PROPERTY, index, "Name", value); 215 } 216 217 public java.lang.String getPropertyElementName(int index) { 219 if (size(PROPERTY) == 0) { 221 return null; 222 } else { 223 return getAttributeValue(PROPERTY, index, "Name"); 224 } 225 } 226 227 public void setPropertyElementValue(int index, java.lang.String value) { 229 if (size(PROPERTY) == 0) { 231 addValue(PROPERTY, ""); 232 } 233 setAttributeValue(PROPERTY, index, "Value", value); 234 } 235 236 public java.lang.String getPropertyElementValue(int index) { 238 if (size(PROPERTY) == 0) { 240 return null; 241 } else { 242 return getAttributeValue(PROPERTY, index, "Value"); 243 } 244 } 245 246 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 248 comparators.add(c); 249 } 250 251 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 253 comparators.remove(c); 254 } 255 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 256 boolean restrictionFailure = false; 257 if (getJndiName() == null) { 259 throw new org.netbeans.modules.schema2beans.ValidateException("getJndiName() == null", "jndiName", this); } 261 if (getMaxPoolSize() == null) { 263 throw new org.netbeans.modules.schema2beans.ValidateException("getMaxPoolSize() == null", "maxPoolSize", this); } 265 if (getSteadyPoolSize() == null) { 267 throw new org.netbeans.modules.schema2beans.ValidateException("getSteadyPoolSize() == null", "steadyPoolSize", this); } 269 if (getMaxWaitTimeInMillis() == null) { 271 throw new org.netbeans.modules.schema2beans.ValidateException("getMaxWaitTimeInMillis() == null", "maxWaitTimeInMillis", this); } 273 if (getIdleTimeoutInSeconds() == null) { 275 throw new org.netbeans.modules.schema2beans.ValidateException("getIdleTimeoutInSeconds() == null", "idleTimeoutInSeconds", this); } 277 if (getDescription() != null) { 279 } 280 for (int _index = 0; _index < sizePropertyElement(); ++_index) { 282 boolean element = isPropertyElement(_index); 283 } 284 } 287 288 public void dump(StringBuffer str, String indent){ 290 String s; 291 Object o; 292 org.netbeans.modules.schema2beans.BaseBean n; 293 str.append(indent); 294 str.append("Description"); str.append(indent+"\t"); str.append("<"); s = this.getDescription(); 298 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(DESCRIPTION, 0, str, indent); 301 302 str.append(indent); 303 str.append("PropertyElement["+this.sizePropertyElement()+"]"); for(int i=0; i<this.sizePropertyElement(); i++) 305 { 306 str.append(indent+"\t"); 307 str.append("#"+i+":"); 308 str.append(indent+"\t"); str.append((this.isPropertyElement(i)?"true":"false")); 310 this.dumpAttributes(PROPERTY, i, str, indent); 311 } 312 313 } 314 public String dumpBeanNode(){ 315 StringBuffer str = new StringBuffer (); 316 str.append("ResourceAdapter\n"); this.dump(str, "\n "); return str.toString(); 319 }} 320 321 323 324 395 | Popular Tags |