1 6 7 package com.sun.enterprise.tools.common.dd.ejb; 8 9 import org.w3c.dom.*; 10 import org.netbeans.modules.schema2beans.*; 11 import java.beans.*; 12 import java.util.*; 13 import com.sun.enterprise.tools.common.dd.MessageDestination; 14 import com.sun.enterprise.tools.common.dd.WebserviceDescription; 15 16 18 public class EnterpriseBeans extends com.sun.enterprise.tools.common.dd.SunBaseBean 19 { 20 21 static Vector comparators = new Vector(); 22 23 static public final String NAME = "Name"; static public final String UNIQUE_ID = "UniqueId"; static public final String EJB = "Ejb"; static public final String PM_DESCRIPTORS = "PmDescriptors"; static public final String CMP_RESOURCE = "CmpResource"; static public final String MESSAGE_DESTINATION = "MessageDestination"; static public final String WEBSERVICE_DESCRIPTION = "WebserviceDescription"; 31 public EnterpriseBeans() { 32 this(Common.USE_DEFAULT_VALUES); 33 } 34 35 public EnterpriseBeans(int options) 36 { 37 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 38 this.createProperty("name", NAME, 41 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 42 String .class); 43 this.createProperty("unique-id", UNIQUE_ID, 45 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 46 String .class); 47 this.createProperty("ejb", EJB, 49 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 50 Ejb.class); 51 this.createAttribute(EJB, "availability-enabled", "AvailabilityEnabled", 52 AttrProp.CDATA | AttrProp.IMPLIED, 53 null, null); 54 this.createProperty("pm-descriptors", PM_DESCRIPTORS, 56 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 57 PmDescriptors.class); 58 this.createProperty("cmp-resource", CMP_RESOURCE, 60 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 61 CmpResource.class); 62 this.createProperty("message-destination", MESSAGE_DESTINATION, 64 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 65 MessageDestination.class); 66 this.createProperty("webservice-description", WEBSERVICE_DESCRIPTION, 68 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 69 WebserviceDescription.class); 70 this.initialize(options); 71 } 72 73 void initialize(int options) 75 { 76 77 } 78 79 public void setName(String value) { 81 this.setValue(NAME, value); 82 } 83 84 public String getName() { 86 return (String )this.getValue(NAME); 87 } 88 89 public void setUniqueId(String value) { 91 this.setValue(UNIQUE_ID, value); 92 } 93 94 public String getUniqueId() { 96 return (String )this.getValue(UNIQUE_ID); 97 } 98 99 public void setEjb(int index, Ejb value) { 101 this.setValue(EJB, index, value); 102 } 103 104 public Ejb getEjb(int index) { 106 return (Ejb)this.getValue(EJB, index); 107 } 108 109 public void setEjb(Ejb[] value) { 111 this.setValue(EJB, value); 112 } 113 114 public Ejb[] getEjb() { 116 return (Ejb[])this.getValues(EJB); 117 } 118 119 public int sizeEjb() { 121 return this.size(EJB); 122 } 123 124 public int addEjb(Ejb value) { 126 return this.addValue(EJB, value); 127 } 128 129 public int removeEjb(Ejb value) { 134 return this.removeValue(EJB, value); 135 } 136 137 public void setPmDescriptors(PmDescriptors value) { 139 this.setValue(PM_DESCRIPTORS, value); 140 } 141 142 public PmDescriptors getPmDescriptors() { 144 return (PmDescriptors)this.getValue(PM_DESCRIPTORS); 145 } 146 147 public void setCmpResource(CmpResource value) { 149 this.setValue(CMP_RESOURCE, value); 150 } 151 152 public CmpResource getCmpResource() { 154 return (CmpResource)this.getValue(CMP_RESOURCE); 155 } 156 157 public void setMessageDestination(int index, MessageDestination value) { 159 this.setValue(MESSAGE_DESTINATION, index, value); 160 } 161 162 public MessageDestination getMessageDestination(int index) { 164 return (MessageDestination)this.getValue(MESSAGE_DESTINATION, index); 165 } 166 167 public void setMessageDestination(MessageDestination[] value) { 169 this.setValue(MESSAGE_DESTINATION, value); 170 } 171 172 public MessageDestination[] getMessageDestination() { 174 return (MessageDestination[])this.getValues(MESSAGE_DESTINATION); 175 } 176 177 public int sizeMessageDestination() { 179 return this.size(MESSAGE_DESTINATION); 180 } 181 182 public int addMessageDestination(MessageDestination value) { 184 return this.addValue(MESSAGE_DESTINATION, value); 185 } 186 187 public int removeMessageDestination(MessageDestination value) { 192 return this.removeValue(MESSAGE_DESTINATION, value); 193 } 194 195 public void setWebserviceDescription(int index, WebserviceDescription value) { 197 this.setValue(WEBSERVICE_DESCRIPTION, index, value); 198 } 199 200 public WebserviceDescription getWebserviceDescription(int index) { 202 return (WebserviceDescription)this.getValue(WEBSERVICE_DESCRIPTION, index); 203 } 204 205 public void setWebserviceDescription(WebserviceDescription[] value) { 207 this.setValue(WEBSERVICE_DESCRIPTION, value); 208 } 209 210 public WebserviceDescription[] getWebserviceDescription() { 212 return (WebserviceDescription[])this.getValues(WEBSERVICE_DESCRIPTION); 213 } 214 215 public int sizeWebserviceDescription() { 217 return this.size(WEBSERVICE_DESCRIPTION); 218 } 219 220 public int addWebserviceDescription(WebserviceDescription value) { 222 return this.addValue(WEBSERVICE_DESCRIPTION, value); 223 } 224 225 public int removeWebserviceDescription(WebserviceDescription value) { 230 return this.removeValue(WEBSERVICE_DESCRIPTION, value); 231 } 232 233 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 235 comparators.add(c); 236 } 237 238 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 240 comparators.remove(c); 241 } 242 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 243 boolean restrictionFailure = false; 244 if (getName() != null) { 246 } 247 if (getUniqueId() != null) { 249 } 250 for (int _index = 0; _index < sizeEjb(); ++_index) { 252 Ejb element = getEjb(_index); 253 if (element != null) { 254 element.validate(); 255 } 256 } 257 if (getPmDescriptors() != null) { 259 getPmDescriptors().validate(); 260 } 261 if (getCmpResource() != null) { 263 getCmpResource().validate(); 264 } 265 for (int _index = 0; _index < sizeMessageDestination(); ++_index) { 267 MessageDestination element = getMessageDestination(_index); 268 if (element != null) { 269 element.validate(); 270 } 271 } 272 for (int _index = 0; _index < sizeWebserviceDescription(); 274 ++_index) { 275 WebserviceDescription element = getWebserviceDescription(_index); 276 if (element != null) { 277 element.validate(); 278 } 279 } 280 } 281 282 public void dump(StringBuffer str, String indent){ 284 String s; 285 Object o; 286 org.netbeans.modules.schema2beans.BaseBean n; 287 str.append(indent); 288 str.append("Name"); str.append(indent+"\t"); str.append("<"); s = this.getName(); 292 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(NAME, 0, str, indent); 295 296 str.append(indent); 297 str.append("UniqueId"); str.append(indent+"\t"); str.append("<"); s = this.getUniqueId(); 301 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(UNIQUE_ID, 0, str, indent); 304 305 str.append(indent); 306 str.append("Ejb["+this.sizeEjb()+"]"); for(int i=0; i<this.sizeEjb(); i++) 308 { 309 str.append(indent+"\t"); 310 str.append("#"+i+":"); 311 n = (org.netbeans.modules.schema2beans.BaseBean) this.getEjb(i); 312 if (n != null) 313 n.dump(str, indent + "\t"); else 315 str.append(indent+"\tnull"); this.dumpAttributes(EJB, i, str, indent); 317 } 318 319 str.append(indent); 320 str.append("PmDescriptors"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getPmDescriptors(); 322 if (n != null) 323 n.dump(str, indent + "\t"); else 325 str.append(indent+"\tnull"); this.dumpAttributes(PM_DESCRIPTORS, 0, str, indent); 327 328 str.append(indent); 329 str.append("CmpResource"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getCmpResource(); 331 if (n != null) 332 n.dump(str, indent + "\t"); else 334 str.append(indent+"\tnull"); this.dumpAttributes(CMP_RESOURCE, 0, str, indent); 336 337 str.append(indent); 338 str.append("MessageDestination["+this.sizeMessageDestination()+"]"); for(int i=0; i<this.sizeMessageDestination(); i++) 340 { 341 str.append(indent+"\t"); 342 str.append("#"+i+":"); 343 n = (org.netbeans.modules.schema2beans.BaseBean) this.getMessageDestination(i); 344 if (n != null) 345 n.dump(str, indent + "\t"); else 347 str.append(indent+"\tnull"); this.dumpAttributes(MESSAGE_DESTINATION, i, str, indent); 349 } 350 351 str.append(indent); 352 str.append("WebserviceDescription["+this.sizeWebserviceDescription()+"]"); for(int i=0; i<this.sizeWebserviceDescription(); i++) 354 { 355 str.append(indent+"\t"); 356 str.append("#"+i+":"); 357 n = (org.netbeans.modules.schema2beans.BaseBean) this.getWebserviceDescription(i); 358 if (n != null) 359 n.dump(str, indent + "\t"); else 361 str.append(indent+"\tnull"); this.dumpAttributes(WEBSERVICE_DESCRIPTION, i, str, indent); 363 } 364 365 } 366 public String dumpBeanNode(){ 367 StringBuffer str = new StringBuffer (); 368 str.append("EnterpriseBeans\n"); this.dump(str, "\n "); return str.toString(); 371 }} 372 373 375 376 398 | Popular Tags |