KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > serverbeans > Applications


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23  
24 /**
25  * This generated bean class Applications matches the DTD element applications
26  *
27  */

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 JavaDoc;
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 // BEGIN_NOI18N
42

43 public class Applications extends ConfigBean implements Serializable JavaDoc
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 JavaDoc LIFECYCLE_MODULE = "LifecycleModule";
50     static public final String JavaDoc J2EE_APPLICATION = "J2eeApplication";
51     static public final String JavaDoc EJB_MODULE = "EjbModule";
52     static public final String JavaDoc WEB_MODULE = "WebModule";
53     static public final String JavaDoc CONNECTOR_MODULE = "ConnectorModule";
54     static public final String JavaDoc APPCLIENT_MODULE = "AppclientModule";
55     static public final String JavaDoc MBEAN = "Mbean";
56
57     public Applications() {
58         this(Common.USE_DEFAULT_VALUES);
59     }
60
61     public Applications(int options)
62     {
63         super(comparators, runtimeVersion);
64         // Properties (see root bean comments for the bean graph)
65
initPropertyTables(7);
66         this.createProperty("lifecycle-module", LIFECYCLE_MODULE, Common.SEQUENCE_OR |
67             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
68             LifecycleModule.class);
69         this.createAttribute(LIFECYCLE_MODULE, "name", "Name",
70                         AttrProp.CDATA | AttrProp.REQUIRED,
71                         null, null);
72         this.createAttribute(LIFECYCLE_MODULE, "class-name", "ClassName",
73                         AttrProp.CDATA | AttrProp.REQUIRED,
74                         null, null);
75         this.createAttribute(LIFECYCLE_MODULE, "classpath", "Classpath",
76                         AttrProp.CDATA | AttrProp.IMPLIED,
77                         null, null);
78         this.createAttribute(LIFECYCLE_MODULE, "load-order", "LoadOrder",
79                         AttrProp.CDATA | AttrProp.IMPLIED,
80                         null, null);
81         this.createAttribute(LIFECYCLE_MODULE, "is-failure-fatal", "IsFailureFatal",
82                         AttrProp.CDATA,
83                         null, "false");
84         this.createAttribute(LIFECYCLE_MODULE, "enabled", "Enabled",
85                         AttrProp.CDATA,
86                         null, "true");
87         this.createProperty("j2ee-application", J2EE_APPLICATION, Common.SEQUENCE_OR |
88             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
89             J2eeApplication.class);
90         this.createAttribute(J2EE_APPLICATION, "name", "Name",
91                         AttrProp.CDATA | AttrProp.REQUIRED,
92                         null, null);
93         this.createAttribute(J2EE_APPLICATION, "location", "Location",
94                         AttrProp.CDATA | AttrProp.REQUIRED,
95                         null, null);
96         this.createAttribute(J2EE_APPLICATION, "object-type", "ObjectType",
97                         AttrProp.CDATA,
98                         null, "user");
99         this.createAttribute(J2EE_APPLICATION, "enabled", "Enabled",
100                         AttrProp.CDATA,
101                         null, "true");
102         this.createAttribute(J2EE_APPLICATION, "libraries", "Libraries",
103                         AttrProp.CDATA | AttrProp.IMPLIED,
104                         null, null);
105         this.createAttribute(J2EE_APPLICATION, "availability-enabled", "AvailabilityEnabled",
106                         AttrProp.CDATA,
107                         null, "false");
108         this.createAttribute(J2EE_APPLICATION, "directory-deployed", "DirectoryDeployed",
109                         AttrProp.CDATA,
110                         null, "false");
111         this.createAttribute(J2EE_APPLICATION, "java-web-start-enabled", "JavaWebStartEnabled",
112                         AttrProp.CDATA,
113                         null, "true");
114         this.createProperty("ejb-module", EJB_MODULE, Common.SEQUENCE_OR |
115             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
116             EjbModule.class);
117         this.createAttribute(EJB_MODULE, "name", "Name",
118                         AttrProp.CDATA | AttrProp.REQUIRED,
119                         null, null);
120         this.createAttribute(EJB_MODULE, "location", "Location",
121                         AttrProp.CDATA | AttrProp.REQUIRED,
122                         null, null);
123         this.createAttribute(EJB_MODULE, "object-type", "ObjectType",
124                         AttrProp.CDATA,
125                         null, "user");
126         this.createAttribute(EJB_MODULE, "enabled", "Enabled",
127                         AttrProp.CDATA,
128                         null, "true");
129         this.createAttribute(EJB_MODULE, "libraries", "Libraries",
130                         AttrProp.CDATA | AttrProp.IMPLIED,
131                         null, null);
132         this.createAttribute(EJB_MODULE, "availability-enabled", "AvailabilityEnabled",
133                         AttrProp.CDATA,
134                         null, "false");
135         this.createAttribute(EJB_MODULE, "directory-deployed", "DirectoryDeployed",
136                         AttrProp.CDATA,
137                         null, "false");
138         this.createProperty("web-module", WEB_MODULE, Common.SEQUENCE_OR |
139             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
140             WebModule.class);
141         this.createAttribute(WEB_MODULE, "name", "Name",
142                         AttrProp.CDATA | AttrProp.REQUIRED,
143                         null, null);
144         this.createAttribute(WEB_MODULE, "context-root", "ContextRoot",
145                         AttrProp.CDATA | AttrProp.REQUIRED,
146                         null, null);
147         this.createAttribute(WEB_MODULE, "location", "Location",
148                         AttrProp.CDATA | AttrProp.REQUIRED,
149                         null, null);
150         this.createAttribute(WEB_MODULE, "object-type", "ObjectType",
151                         AttrProp.CDATA,
152                         null, "user");
153         this.createAttribute(WEB_MODULE, "enabled", "Enabled",
154                         AttrProp.CDATA,
155                         null, "true");
156         this.createAttribute(WEB_MODULE, "libraries", "Libraries",
157                         AttrProp.CDATA | AttrProp.IMPLIED,
158                         null, null);
159         this.createAttribute(WEB_MODULE, "availability-enabled", "AvailabilityEnabled",
160                         AttrProp.CDATA,
161                         null, "false");
162         this.createAttribute(WEB_MODULE, "directory-deployed", "DirectoryDeployed",
163                         AttrProp.CDATA,
164                         null, "false");
165         this.createProperty("connector-module", CONNECTOR_MODULE, Common.SEQUENCE_OR |
166             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
167             ConnectorModule.class);
168         this.createAttribute(CONNECTOR_MODULE, "name", "Name",
169                         AttrProp.CDATA | AttrProp.REQUIRED,
170                         null, null);
171         this.createAttribute(CONNECTOR_MODULE, "location", "Location",
172                         AttrProp.CDATA | AttrProp.REQUIRED,
173                         null, null);
174         this.createAttribute(CONNECTOR_MODULE, "object-type", "ObjectType",
175                         AttrProp.CDATA,
176                         null, "user");
177         this.createAttribute(CONNECTOR_MODULE, "enabled", "Enabled",
178                         AttrProp.CDATA,
179                         null, "true");
180         this.createAttribute(CONNECTOR_MODULE, "directory-deployed", "DirectoryDeployed",
181                         AttrProp.CDATA,
182                         null, "false");
183         this.createProperty("appclient-module", APPCLIENT_MODULE, Common.SEQUENCE_OR |
184             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
185             AppclientModule.class);
186         this.createAttribute(APPCLIENT_MODULE, "name", "Name",
187                         AttrProp.CDATA | AttrProp.REQUIRED,
188                         null, null);
189         this.createAttribute(APPCLIENT_MODULE, "location", "Location",
190                         AttrProp.CDATA | AttrProp.REQUIRED,
191                         null, null);
192         this.createAttribute(APPCLIENT_MODULE, "directory-deployed", "DirectoryDeployed",
193                         AttrProp.CDATA,
194                         null, "false");
195         this.createAttribute(APPCLIENT_MODULE, "java-web-start-enabled", "JavaWebStartEnabled",
196                         AttrProp.CDATA,
197                         null, "true");
198         this.createProperty("mbean", MBEAN, Common.SEQUENCE_OR |
199             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
200             Mbean.class);
201         this.createAttribute(MBEAN, "name", "Name",
202                         AttrProp.CDATA | AttrProp.REQUIRED,
203                         null, null);
204         this.createAttribute(MBEAN, "object-type", "ObjectType",
205                         AttrProp.CDATA,
206                         null, "user");
207         this.createAttribute(MBEAN, "impl-class-name", "ImplClassName",
208                         AttrProp.CDATA | AttrProp.REQUIRED,
209                         null, null);
210         this.createAttribute(MBEAN, "object-name", "ObjectName",
211                         AttrProp.CDATA | AttrProp.IMPLIED,
212                         null, null);
213         this.createAttribute(MBEAN, "enabled", "Enabled",
214                         AttrProp.CDATA,
215                         null, "true");
216         this.initialize(options);
217     }
218
219     // Setting the default values of the properties
220
void initialize(int options) {
221
222     }
223
224     // This attribute is an array, possibly empty
225
public void setLifecycleModule(int index, LifecycleModule value) {
226         this.setValue(LIFECYCLE_MODULE, index, value);
227     }
228
229     // Get Method
230
public LifecycleModule getLifecycleModule(int index) {
231         return (LifecycleModule)this.getValue(LIFECYCLE_MODULE, index);
232     }
233
234     // This attribute is an array, possibly empty
235
public void setLifecycleModule(LifecycleModule[] value) {
236         this.setValue(LIFECYCLE_MODULE, value);
237     }
238
239     // Getter Method
240
public LifecycleModule[] getLifecycleModule() {
241         return (LifecycleModule[])this.getValues(LIFECYCLE_MODULE);
242     }
243
244     // Return the number of properties
245
public int sizeLifecycleModule() {
246         return this.size(LIFECYCLE_MODULE);
247     }
248
249     // Add a new element returning its index in the list
250
public int addLifecycleModule(LifecycleModule value)
251             throws ConfigException{
252         return addLifecycleModule(value, true);
253     }
254
255     // Add a new element returning its index in the list with a boolean flag
256
public int addLifecycleModule(LifecycleModule value, boolean overwrite)
257             throws ConfigException{
258         LifecycleModule old = getLifecycleModuleByName(value.getName());
259         if(old != null) {
260             throw new ConfigException(StringManager.getManager(Applications.class).getString("cannotAddDuplicate", "LifecycleModule"));
261         }
262         return this.addValue(LIFECYCLE_MODULE, value, overwrite);
263     }
264
265     //
266
// Remove an element using its reference
267
// Returns the index the element had in the list
268
//
269
public int removeLifecycleModule(LifecycleModule value){
270         return this.removeValue(LIFECYCLE_MODULE, value);
271     }
272
273     //
274
// Remove an element using its reference
275
// Returns the index the element had in the list
276
// with boolean overwrite
277
//
278
public int removeLifecycleModule(LifecycleModule value, boolean overwrite)
279             throws StaleWriteConfigException{
280         return this.removeValue(LIFECYCLE_MODULE, value, overwrite);
281     }
282
283     public LifecycleModule getLifecycleModuleByName(String JavaDoc id) {
284      if (null != id) { id = id.trim(); }
285     LifecycleModule[] o = getLifecycleModule();
286      if (o == null) return null;
287
288      for (int i=0; i < o.length; i++) {
289          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
290              return o[i];
291          }
292      }
293
294         return null;
295         
296     }
297     // This attribute is an array, possibly empty
298
public void setJ2eeApplication(int index, J2eeApplication value) {
299         this.setValue(J2EE_APPLICATION, index, value);
300     }
301
302     // Get Method
303
public J2eeApplication getJ2eeApplication(int index) {
304         return (J2eeApplication)this.getValue(J2EE_APPLICATION, index);
305     }
306
307     // This attribute is an array, possibly empty
308
public void setJ2eeApplication(J2eeApplication[] value) {
309         this.setValue(J2EE_APPLICATION, value);
310     }
311
312     // Getter Method
313
public J2eeApplication[] getJ2eeApplication() {
314         return (J2eeApplication[])this.getValues(J2EE_APPLICATION);
315     }
316
317     // Return the number of properties
318
public int sizeJ2eeApplication() {
319         return this.size(J2EE_APPLICATION);
320     }
321
322     // Add a new element returning its index in the list
323
public int addJ2eeApplication(J2eeApplication value)
324             throws ConfigException{
325         return addJ2eeApplication(value, true);
326     }
327
328     // Add a new element returning its index in the list with a boolean flag
329
public int addJ2eeApplication(J2eeApplication value, boolean overwrite)
330             throws ConfigException{
331         J2eeApplication old = getJ2eeApplicationByName(value.getName());
332         if(old != null) {
333             throw new ConfigException(StringManager.getManager(Applications.class).getString("cannotAddDuplicate", "J2eeApplication"));
334         }
335         return this.addValue(J2EE_APPLICATION, value, overwrite);
336     }
337
338     //
339
// Remove an element using its reference
340
// Returns the index the element had in the list
341
//
342
public int removeJ2eeApplication(J2eeApplication value){
343         return this.removeValue(J2EE_APPLICATION, value);
344     }
345
346     //
347
// Remove an element using its reference
348
// Returns the index the element had in the list
349
// with boolean overwrite
350
//
351
public int removeJ2eeApplication(J2eeApplication value, boolean overwrite)
352             throws StaleWriteConfigException{
353         return this.removeValue(J2EE_APPLICATION, value, overwrite);
354     }
355
356     public J2eeApplication getJ2eeApplicationByName(String JavaDoc id) {
357      if (null != id) { id = id.trim(); }
358     J2eeApplication[] o = getJ2eeApplication();
359      if (o == null) return null;
360
361      for (int i=0; i < o.length; i++) {
362          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
363              return o[i];
364          }
365      }
366
367         return null;
368         
369     }
370     // This attribute is an array, possibly empty
371
public void setEjbModule(int index, EjbModule value) {
372         this.setValue(EJB_MODULE, index, value);
373     }
374
375     // Get Method
376
public EjbModule getEjbModule(int index) {
377         return (EjbModule)this.getValue(EJB_MODULE, index);
378     }
379
380     // This attribute is an array, possibly empty
381
public void setEjbModule(EjbModule[] value) {
382         this.setValue(EJB_MODULE, value);
383     }
384
385     // Getter Method
386
public EjbModule[] getEjbModule() {
387         return (EjbModule[])this.getValues(EJB_MODULE);
388     }
389
390     // Return the number of properties
391
public int sizeEjbModule() {
392         return this.size(EJB_MODULE);
393     }
394
395     // Add a new element returning its index in the list
396
public int addEjbModule(EjbModule value)
397             throws ConfigException{
398         return addEjbModule(value, true);
399     }
400
401     // Add a new element returning its index in the list with a boolean flag
402
public int addEjbModule(EjbModule value, boolean overwrite)
403             throws ConfigException{
404         EjbModule old = getEjbModuleByName(value.getName());
405         if(old != null) {
406             throw new ConfigException(StringManager.getManager(Applications.class).getString("cannotAddDuplicate", "EjbModule"));
407         }
408         return this.addValue(EJB_MODULE, value, overwrite);
409     }
410
411     //
412
// Remove an element using its reference
413
// Returns the index the element had in the list
414
//
415
public int removeEjbModule(EjbModule value){
416         return this.removeValue(EJB_MODULE, value);
417     }
418
419     //
420
// Remove an element using its reference
421
// Returns the index the element had in the list
422
// with boolean overwrite
423
//
424
public int removeEjbModule(EjbModule value, boolean overwrite)
425             throws StaleWriteConfigException{
426         return this.removeValue(EJB_MODULE, value, overwrite);
427     }
428
429     public EjbModule getEjbModuleByName(String JavaDoc id) {
430      if (null != id) { id = id.trim(); }
431     EjbModule[] o = getEjbModule();
432      if (o == null) return null;
433
434      for (int i=0; i < o.length; i++) {
435          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
436              return o[i];
437          }
438      }
439
440         return null;
441         
442     }
443     // This attribute is an array, possibly empty
444
public void setWebModule(int index, WebModule value) {
445         this.setValue(WEB_MODULE, index, value);
446     }
447
448     // Get Method
449
public WebModule getWebModule(int index) {
450         return (WebModule)this.getValue(WEB_MODULE, index);
451     }
452
453     // This attribute is an array, possibly empty
454
public void setWebModule(WebModule[] value) {
455         this.setValue(WEB_MODULE, value);
456     }
457
458     // Getter Method
459
public WebModule[] getWebModule() {
460         return (WebModule[])this.getValues(WEB_MODULE);
461     }
462
463     // Return the number of properties
464
public int sizeWebModule() {
465         return this.size(WEB_MODULE);
466     }
467
468     // Add a new element returning its index in the list
469
public int addWebModule(WebModule value)
470             throws ConfigException{
471         return addWebModule(value, true);
472     }
473
474     // Add a new element returning its index in the list with a boolean flag
475
public int addWebModule(WebModule value, boolean overwrite)
476             throws ConfigException{
477         WebModule old = getWebModuleByName(value.getName());
478         if(old != null) {
479             throw new ConfigException(StringManager.getManager(Applications.class).getString("cannotAddDuplicate", "WebModule"));
480         }
481         return this.addValue(WEB_MODULE, value, overwrite);
482     }
483
484     //
485
// Remove an element using its reference
486
// Returns the index the element had in the list
487
//
488
public int removeWebModule(WebModule value){
489         return this.removeValue(WEB_MODULE, value);
490     }
491
492     //
493
// Remove an element using its reference
494
// Returns the index the element had in the list
495
// with boolean overwrite
496
//
497
public int removeWebModule(WebModule value, boolean overwrite)
498             throws StaleWriteConfigException{
499         return this.removeValue(WEB_MODULE, value, overwrite);
500     }
501
502     public WebModule getWebModuleByName(String JavaDoc id) {
503      if (null != id) { id = id.trim(); }
504     WebModule[] o = getWebModule();
505      if (o == null) return null;
506
507      for (int i=0; i < o.length; i++) {
508          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
509              return o[i];
510          }
511      }
512
513         return null;
514         
515     }
516     // This attribute is an array, possibly empty
517
public void setConnectorModule(int index, ConnectorModule value) {
518         this.setValue(CONNECTOR_MODULE, index, value);
519     }
520
521     // Get Method
522
public ConnectorModule getConnectorModule(int index) {
523         return (ConnectorModule)this.getValue(CONNECTOR_MODULE, index);
524     }
525
526     // This attribute is an array, possibly empty
527
public void setConnectorModule(ConnectorModule[] value) {
528         this.setValue(CONNECTOR_MODULE, value);
529     }
530
531     // Getter Method
532
public ConnectorModule[] getConnectorModule() {
533         return (ConnectorModule[])this.getValues(CONNECTOR_MODULE);
534     }
535
536     // Return the number of properties
537
public int sizeConnectorModule() {
538         return this.size(CONNECTOR_MODULE);
539     }
540
541     // Add a new element returning its index in the list
542
public int addConnectorModule(ConnectorModule value)
543             throws ConfigException{
544         return addConnectorModule(value, true);
545     }
546
547     // Add a new element returning its index in the list with a boolean flag
548
public int addConnectorModule(ConnectorModule value, boolean overwrite)
549             throws ConfigException{
550         ConnectorModule old = getConnectorModuleByName(value.getName());
551         if(old != null) {
552             throw new ConfigException(StringManager.getManager(Applications.class).getString("cannotAddDuplicate", "ConnectorModule"));
553         }
554         return this.addValue(CONNECTOR_MODULE, value, overwrite);
555     }
556
557     //
558
// Remove an element using its reference
559
// Returns the index the element had in the list
560
//
561
public int removeConnectorModule(ConnectorModule value){
562         return this.removeValue(CONNECTOR_MODULE, value);
563     }
564
565     //
566
// Remove an element using its reference
567
// Returns the index the element had in the list
568
// with boolean overwrite
569
//
570
public int removeConnectorModule(ConnectorModule value, boolean overwrite)
571             throws StaleWriteConfigException{
572         return this.removeValue(CONNECTOR_MODULE, value, overwrite);
573     }
574
575     public ConnectorModule getConnectorModuleByName(String JavaDoc id) {
576      if (null != id) { id = id.trim(); }
577     ConnectorModule[] o = getConnectorModule();
578      if (o == null) return null;
579
580      for (int i=0; i < o.length; i++) {
581          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
582              return o[i];
583          }
584      }
585
586         return null;
587         
588     }
589     // This attribute is an array, possibly empty
590
public void setAppclientModule(int index, AppclientModule value) {
591         this.setValue(APPCLIENT_MODULE, index, value);
592     }
593
594     // Get Method
595
public AppclientModule getAppclientModule(int index) {
596         return (AppclientModule)this.getValue(APPCLIENT_MODULE, index);
597     }
598
599     // This attribute is an array, possibly empty
600
public void setAppclientModule(AppclientModule[] value) {
601         this.setValue(APPCLIENT_MODULE, value);
602     }
603
604     // Getter Method
605
public AppclientModule[] getAppclientModule() {
606         return (AppclientModule[])this.getValues(APPCLIENT_MODULE);
607     }
608
609     // Return the number of properties
610
public int sizeAppclientModule() {
611         return this.size(APPCLIENT_MODULE);
612     }
613
614     // Add a new element returning its index in the list
615
public int addAppclientModule(AppclientModule value)
616             throws ConfigException{
617         return addAppclientModule(value, true);
618     }
619
620     // Add a new element returning its index in the list with a boolean flag
621
public int addAppclientModule(AppclientModule value, boolean overwrite)
622             throws ConfigException{
623         AppclientModule old = getAppclientModuleByName(value.getName());
624         if(old != null) {
625             throw new ConfigException(StringManager.getManager(Applications.class).getString("cannotAddDuplicate", "AppclientModule"));
626         }
627         return this.addValue(APPCLIENT_MODULE, value, overwrite);
628     }
629
630     //
631
// Remove an element using its reference
632
// Returns the index the element had in the list
633
//
634
public int removeAppclientModule(AppclientModule value){
635         return this.removeValue(APPCLIENT_MODULE, value);
636     }
637
638     //
639
// Remove an element using its reference
640
// Returns the index the element had in the list
641
// with boolean overwrite
642
//
643
public int removeAppclientModule(AppclientModule value, boolean overwrite)
644             throws StaleWriteConfigException{
645         return this.removeValue(APPCLIENT_MODULE, value, overwrite);
646     }
647
648     public AppclientModule getAppclientModuleByName(String JavaDoc id) {
649      if (null != id) { id = id.trim(); }
650     AppclientModule[] o = getAppclientModule();
651      if (o == null) return null;
652
653      for (int i=0; i < o.length; i++) {
654          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
655              return o[i];
656          }
657      }
658
659         return null;
660         
661     }
662     // This attribute is an array, possibly empty
663
public void setMbean(int index, Mbean value) {
664         this.setValue(MBEAN, index, value);
665     }
666
667     // Get Method
668
public Mbean getMbean(int index) {
669         return (Mbean)this.getValue(MBEAN, index);
670     }
671
672     // This attribute is an array, possibly empty
673
public void setMbean(Mbean[] value) {
674         this.setValue(MBEAN, value);
675     }
676
677     // Getter Method
678
public Mbean[] getMbean() {
679         return (Mbean[])this.getValues(MBEAN);
680     }
681
682     // Return the number of properties
683
public int sizeMbean() {
684         return this.size(MBEAN);
685     }
686
687     // Add a new element returning its index in the list
688
public int addMbean(Mbean value)
689             throws ConfigException{
690         return addMbean(value, true);
691     }
692
693     // Add a new element returning its index in the list with a boolean flag
694
public int addMbean(Mbean value, boolean overwrite)
695             throws ConfigException{
696         Mbean old = getMbeanByName(value.getName());
697         if(old != null) {
698             throw new ConfigException(StringManager.getManager(Applications.class).getString("cannotAddDuplicate", "Mbean"));
699         }
700         return this.addValue(MBEAN, value, overwrite);
701     }
702
703     //
704
// Remove an element using its reference
705
// Returns the index the element had in the list
706
//
707
public int removeMbean(Mbean value){
708         return this.removeValue(MBEAN, value);
709     }
710
711     //
712
// Remove an element using its reference
713
// Returns the index the element had in the list
714
// with boolean overwrite
715
//
716
public int removeMbean(Mbean value, boolean overwrite)
717             throws StaleWriteConfigException{
718         return this.removeValue(MBEAN, value, overwrite);
719     }
720
721     public Mbean getMbeanByName(String JavaDoc id) {
722      if (null != id) { id = id.trim(); }
723     Mbean[] o = getMbean();
724      if (o == null) return null;
725
726      for (int i=0; i < o.length; i++) {
727          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
728              return o[i];
729          }
730      }
731
732         return null;
733         
734     }
735     /**
736      * Create a new bean using it's default constructor.
737      * This does not add it to any bean graph.
738      */

739     public LifecycleModule newLifecycleModule() {
740         return new LifecycleModule();
741     }
742
743     /**
744      * Create a new bean using it's default constructor.
745      * This does not add it to any bean graph.
746      */

747     public J2eeApplication newJ2eeApplication() {
748         return new J2eeApplication();
749     }
750
751     /**
752      * Create a new bean using it's default constructor.
753      * This does not add it to any bean graph.
754      */

755     public EjbModule newEjbModule() {
756         return new EjbModule();
757     }
758
759     /**
760      * Create a new bean using it's default constructor.
761      * This does not add it to any bean graph.
762      */

763     public WebModule newWebModule() {
764         return new WebModule();
765     }
766
767     /**
768      * Create a new bean using it's default constructor.
769      * This does not add it to any bean graph.
770      */

771     public ConnectorModule newConnectorModule() {
772         return new ConnectorModule();
773     }
774
775     /**
776      * Create a new bean using it's default constructor.
777      * This does not add it to any bean graph.
778      */

779     public AppclientModule newAppclientModule() {
780         return new AppclientModule();
781     }
782
783     /**
784      * Create a new bean using it's default constructor.
785      * This does not add it to any bean graph.
786      */

787     public Mbean newMbean() {
788         return new Mbean();
789     }
790
791     /**
792     * get the xpath representation for this element
793     * returns something like abc[@name='value'] or abc
794     * depending on the type of the bean
795     */

796     protected String JavaDoc getRelativeXPath() {
797         String JavaDoc ret = null;
798         ret = "applications";
799         return (null != ret ? ret.trim() : null);
800     }
801
802     /*
803     * generic method to get default value from dtd
804     */

805     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
806         if(attr == null) return null;
807         attr = attr.trim();
808     return null;
809     }
810     //
811
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
812         comparators.add(c);
813     }
814
815     //
816
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
817         comparators.remove(c);
818     }
819     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
820     }
821
822     // Dump the content of this bean returning it as a String
823
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
824         String JavaDoc s;
825         Object JavaDoc o;
826         org.netbeans.modules.schema2beans.BaseBean n;
827         str.append(indent);
828         str.append("LifecycleModule["+this.sizeLifecycleModule()+"]"); // NOI18N
829
for(int i=0; i<this.sizeLifecycleModule(); i++)
830         {
831             str.append(indent+"\t");
832             str.append("#"+i+":");
833             n = (org.netbeans.modules.schema2beans.BaseBean) this.getLifecycleModule(i);
834             if (n != null)
835                 n.dump(str, indent + "\t"); // NOI18N
836
else
837                 str.append(indent+"\tnull"); // NOI18N
838
this.dumpAttributes(LIFECYCLE_MODULE, i, str, indent);
839         }
840
841         str.append(indent);
842         str.append("J2eeApplication["+this.sizeJ2eeApplication()+"]"); // NOI18N
843
for(int i=0; i<this.sizeJ2eeApplication(); i++)
844         {
845             str.append(indent+"\t");
846             str.append("#"+i+":");
847             n = (org.netbeans.modules.schema2beans.BaseBean) this.getJ2eeApplication(i);
848             if (n != null)
849                 n.dump(str, indent + "\t"); // NOI18N
850
else
851                 str.append(indent+"\tnull"); // NOI18N
852
this.dumpAttributes(J2EE_APPLICATION, i, str, indent);
853         }
854
855         str.append(indent);
856         str.append("EjbModule["+this.sizeEjbModule()+"]"); // NOI18N
857
for(int i=0; i<this.sizeEjbModule(); i++)
858         {
859             str.append(indent+"\t");
860             str.append("#"+i+":");
861             n = (org.netbeans.modules.schema2beans.BaseBean) this.getEjbModule(i);
862             if (n != null)
863                 n.dump(str, indent + "\t"); // NOI18N
864
else
865                 str.append(indent+"\tnull"); // NOI18N
866
this.dumpAttributes(EJB_MODULE, i, str, indent);
867         }
868
869         str.append(indent);
870         str.append("WebModule["+this.sizeWebModule()+"]"); // NOI18N
871
for(int i=0; i<this.sizeWebModule(); i++)
872         {
873             str.append(indent+"\t");
874             str.append("#"+i+":");
875             n = (org.netbeans.modules.schema2beans.BaseBean) this.getWebModule(i);
876             if (n != null)
877                 n.dump(str, indent + "\t"); // NOI18N
878
else
879                 str.append(indent+"\tnull"); // NOI18N
880
this.dumpAttributes(WEB_MODULE, i, str, indent);
881         }
882
883         str.append(indent);
884         str.append("ConnectorModule["+this.sizeConnectorModule()+"]"); // NOI18N
885
for(int i=0; i<this.sizeConnectorModule(); i++)
886         {
887             str.append(indent+"\t");
888             str.append("#"+i+":");
889             n = (org.netbeans.modules.schema2beans.BaseBean) this.getConnectorModule(i);
890             if (n != null)
891                 n.dump(str, indent + "\t"); // NOI18N
892
else
893                 str.append(indent+"\tnull"); // NOI18N
894
this.dumpAttributes(CONNECTOR_MODULE, i, str, indent);
895         }
896
897         str.append(indent);
898         str.append("AppclientModule["+this.sizeAppclientModule()+"]"); // NOI18N
899
for(int i=0; i<this.sizeAppclientModule(); i++)
900         {
901             str.append(indent+"\t");
902             str.append("#"+i+":");
903             n = (org.netbeans.modules.schema2beans.BaseBean) this.getAppclientModule(i);
904             if (n != null)
905                 n.dump(str, indent + "\t"); // NOI18N
906
else
907                 str.append(indent+"\tnull"); // NOI18N
908
this.dumpAttributes(APPCLIENT_MODULE, i, str, indent);
909         }
910
911         str.append(indent);
912         str.append("Mbean["+this.sizeMbean()+"]"); // NOI18N
913
for(int i=0; i<this.sizeMbean(); i++)
914         {
915             str.append(indent+"\t");
916             str.append("#"+i+":");
917             n = (org.netbeans.modules.schema2beans.BaseBean) this.getMbean(i);
918             if (n != null)
919                 n.dump(str, indent + "\t"); // NOI18N
920
else
921                 str.append(indent+"\tnull"); // NOI18N
922
this.dumpAttributes(MBEAN, i, str, indent);
923         }
924
925     }
926     public String JavaDoc dumpBeanNode(){
927         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
928         str.append("Applications\n"); // NOI18N
929
this.dump(str, "\n "); // NOI18N
930
return str.toString();
931     }}
932
933 // END_NOI18N
934

935
Popular Tags