KickJava   Java API By Example, From Geeks To Geeks.

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


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 SecurityService matches the DTD element security-service
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 SecurityService 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 AUTH_REALM = "AuthRealm";
50     static public final String JavaDoc JACC_PROVIDER = "JaccProvider";
51     static public final String JavaDoc AUDIT_MODULE = "AuditModule";
52     static public final String JavaDoc MESSAGE_SECURITY_CONFIG = "MessageSecurityConfig";
53     static public final String JavaDoc ELEMENT_PROPERTY = "ElementProperty";
54
55     public SecurityService() {
56         this(Common.USE_DEFAULT_VALUES);
57     }
58
59     public SecurityService(int options)
60     {
61         super(comparators, runtimeVersion);
62         // Properties (see root bean comments for the bean graph)
63
initPropertyTables(5);
64         this.createProperty("auth-realm", AUTH_REALM,
65             Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY,
66             AuthRealm.class);
67         this.createAttribute(AUTH_REALM, "name", "Name",
68                         AttrProp.CDATA | AttrProp.REQUIRED,
69                         null, null);
70         this.createAttribute(AUTH_REALM, "classname", "Classname",
71                         AttrProp.CDATA | AttrProp.REQUIRED,
72                         null, null);
73         this.createProperty("jacc-provider", JACC_PROVIDER,
74             Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY,
75             JaccProvider.class);
76         this.createAttribute(JACC_PROVIDER, "name", "Name",
77                         AttrProp.CDATA | AttrProp.REQUIRED,
78                         null, null);
79         this.createAttribute(JACC_PROVIDER, "policy-provider", "PolicyProvider",
80                         AttrProp.CDATA | AttrProp.REQUIRED,
81                         null, null);
82         this.createAttribute(JACC_PROVIDER, "policy-configuration-factory-provider", "PolicyConfigurationFactoryProvider",
83                         AttrProp.CDATA | AttrProp.REQUIRED,
84                         null, null);
85         this.createProperty("audit-module", AUDIT_MODULE,
86             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
87             AuditModule.class);
88         this.createAttribute(AUDIT_MODULE, "name", "Name",
89                         AttrProp.CDATA | AttrProp.REQUIRED,
90                         null, null);
91         this.createAttribute(AUDIT_MODULE, "classname", "Classname",
92                         AttrProp.CDATA | AttrProp.REQUIRED,
93                         null, null);
94         this.createProperty("message-security-config", MESSAGE_SECURITY_CONFIG,
95             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
96             MessageSecurityConfig.class);
97         this.createAttribute(MESSAGE_SECURITY_CONFIG, "auth-layer", "AuthLayer",
98                         AttrProp.CDATA | AttrProp.REQUIRED,
99                         null, null);
100         this.createAttribute(MESSAGE_SECURITY_CONFIG, "default-provider", "DefaultProvider",
101                         AttrProp.CDATA | AttrProp.IMPLIED,
102                         null, null);
103         this.createAttribute(MESSAGE_SECURITY_CONFIG, "default-client-provider", "DefaultClientProvider",
104                         AttrProp.CDATA | AttrProp.IMPLIED,
105                         null, null);
106         this.createProperty("property", ELEMENT_PROPERTY,
107             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
108             ElementProperty.class);
109         this.createAttribute(ELEMENT_PROPERTY, "name", "Name",
110                         AttrProp.CDATA | AttrProp.REQUIRED,
111                         null, null);
112         this.createAttribute(ELEMENT_PROPERTY, "value", "Value",
113                         AttrProp.CDATA | AttrProp.REQUIRED,
114                         null, null);
115         this.initialize(options);
116     }
117
118     // Setting the default values of the properties
119
void initialize(int options) {
120
121     }
122
123     // This attribute is an array containing at least one element
124
public void setAuthRealm(int index, AuthRealm value) {
125         this.setValue(AUTH_REALM, index, value);
126     }
127
128     // Get Method
129
public AuthRealm getAuthRealm(int index) {
130         return (AuthRealm)this.getValue(AUTH_REALM, index);
131     }
132
133     // This attribute is an array containing at least one element
134
public void setAuthRealm(AuthRealm[] value) {
135         this.setValue(AUTH_REALM, value);
136     }
137
138     // Getter Method
139
public AuthRealm[] getAuthRealm() {
140         return (AuthRealm[])this.getValues(AUTH_REALM);
141     }
142
143     // Return the number of properties
144
public int sizeAuthRealm() {
145         return this.size(AUTH_REALM);
146     }
147
148     // Add a new element returning its index in the list
149
public int addAuthRealm(AuthRealm value)
150             throws ConfigException{
151         return addAuthRealm(value, true);
152     }
153
154     // Add a new element returning its index in the list with a boolean flag
155
public int addAuthRealm(AuthRealm value, boolean overwrite)
156             throws ConfigException{
157         AuthRealm old = getAuthRealmByName(value.getName());
158         if(old != null) {
159             throw new ConfigException(StringManager.getManager(SecurityService.class).getString("cannotAddDuplicate", "AuthRealm"));
160         }
161         return this.addValue(AUTH_REALM, value, overwrite);
162     }
163
164     //
165
// Remove an element using its reference
166
// Returns the index the element had in the list
167
//
168
public int removeAuthRealm(AuthRealm value){
169         return this.removeValue(AUTH_REALM, value);
170     }
171
172     //
173
// Remove an element using its reference
174
// Returns the index the element had in the list
175
// with boolean overwrite
176
//
177
public int removeAuthRealm(AuthRealm value, boolean overwrite)
178             throws StaleWriteConfigException{
179         return this.removeValue(AUTH_REALM, value, overwrite);
180     }
181
182     public AuthRealm getAuthRealmByName(String JavaDoc id) {
183      if (null != id) { id = id.trim(); }
184     AuthRealm[] o = getAuthRealm();
185      if (o == null) return null;
186
187      for (int i=0; i < o.length; i++) {
188          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
189              return o[i];
190          }
191      }
192
193         return null;
194         
195     }
196     // This attribute is an array containing at least one element
197
public void setJaccProvider(int index, JaccProvider value) {
198         this.setValue(JACC_PROVIDER, index, value);
199     }
200
201     // Get Method
202
public JaccProvider getJaccProvider(int index) {
203         return (JaccProvider)this.getValue(JACC_PROVIDER, index);
204     }
205
206     // This attribute is an array containing at least one element
207
public void setJaccProvider(JaccProvider[] value) {
208         this.setValue(JACC_PROVIDER, value);
209     }
210
211     // Getter Method
212
public JaccProvider[] getJaccProvider() {
213         return (JaccProvider[])this.getValues(JACC_PROVIDER);
214     }
215
216     // Return the number of properties
217
public int sizeJaccProvider() {
218         return this.size(JACC_PROVIDER);
219     }
220
221     // Add a new element returning its index in the list
222
public int addJaccProvider(JaccProvider value)
223             throws ConfigException{
224         return addJaccProvider(value, true);
225     }
226
227     // Add a new element returning its index in the list with a boolean flag
228
public int addJaccProvider(JaccProvider value, boolean overwrite)
229             throws ConfigException{
230         JaccProvider old = getJaccProviderByName(value.getName());
231         if(old != null) {
232             throw new ConfigException(StringManager.getManager(SecurityService.class).getString("cannotAddDuplicate", "JaccProvider"));
233         }
234         return this.addValue(JACC_PROVIDER, value, overwrite);
235     }
236
237     //
238
// Remove an element using its reference
239
// Returns the index the element had in the list
240
//
241
public int removeJaccProvider(JaccProvider value){
242         return this.removeValue(JACC_PROVIDER, value);
243     }
244
245     //
246
// Remove an element using its reference
247
// Returns the index the element had in the list
248
// with boolean overwrite
249
//
250
public int removeJaccProvider(JaccProvider value, boolean overwrite)
251             throws StaleWriteConfigException{
252         return this.removeValue(JACC_PROVIDER, value, overwrite);
253     }
254
255     public JaccProvider getJaccProviderByName(String JavaDoc id) {
256      if (null != id) { id = id.trim(); }
257     JaccProvider[] o = getJaccProvider();
258      if (o == null) return null;
259
260      for (int i=0; i < o.length; i++) {
261          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
262              return o[i];
263          }
264      }
265
266         return null;
267         
268     }
269     // This attribute is an array, possibly empty
270
public void setAuditModule(int index, AuditModule value) {
271         this.setValue(AUDIT_MODULE, index, value);
272     }
273
274     // Get Method
275
public AuditModule getAuditModule(int index) {
276         return (AuditModule)this.getValue(AUDIT_MODULE, index);
277     }
278
279     // This attribute is an array, possibly empty
280
public void setAuditModule(AuditModule[] value) {
281         this.setValue(AUDIT_MODULE, value);
282     }
283
284     // Getter Method
285
public AuditModule[] getAuditModule() {
286         return (AuditModule[])this.getValues(AUDIT_MODULE);
287     }
288
289     // Return the number of properties
290
public int sizeAuditModule() {
291         return this.size(AUDIT_MODULE);
292     }
293
294     // Add a new element returning its index in the list
295
public int addAuditModule(AuditModule value)
296             throws ConfigException{
297         return addAuditModule(value, true);
298     }
299
300     // Add a new element returning its index in the list with a boolean flag
301
public int addAuditModule(AuditModule value, boolean overwrite)
302             throws ConfigException{
303         AuditModule old = getAuditModuleByName(value.getName());
304         if(old != null) {
305             throw new ConfigException(StringManager.getManager(SecurityService.class).getString("cannotAddDuplicate", "AuditModule"));
306         }
307         return this.addValue(AUDIT_MODULE, value, overwrite);
308     }
309
310     //
311
// Remove an element using its reference
312
// Returns the index the element had in the list
313
//
314
public int removeAuditModule(AuditModule value){
315         return this.removeValue(AUDIT_MODULE, value);
316     }
317
318     //
319
// Remove an element using its reference
320
// Returns the index the element had in the list
321
// with boolean overwrite
322
//
323
public int removeAuditModule(AuditModule value, boolean overwrite)
324             throws StaleWriteConfigException{
325         return this.removeValue(AUDIT_MODULE, value, overwrite);
326     }
327
328     public AuditModule getAuditModuleByName(String JavaDoc id) {
329      if (null != id) { id = id.trim(); }
330     AuditModule[] o = getAuditModule();
331      if (o == null) return null;
332
333      for (int i=0; i < o.length; i++) {
334          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
335              return o[i];
336          }
337      }
338
339         return null;
340         
341     }
342     // This attribute is an array, possibly empty
343
public void setMessageSecurityConfig(int index, MessageSecurityConfig value) {
344         this.setValue(MESSAGE_SECURITY_CONFIG, index, value);
345     }
346
347     // Get Method
348
public MessageSecurityConfig getMessageSecurityConfig(int index) {
349         return (MessageSecurityConfig)this.getValue(MESSAGE_SECURITY_CONFIG, index);
350     }
351
352     // This attribute is an array, possibly empty
353
public void setMessageSecurityConfig(MessageSecurityConfig[] value) {
354         this.setValue(MESSAGE_SECURITY_CONFIG, value);
355     }
356
357     // Getter Method
358
public MessageSecurityConfig[] getMessageSecurityConfig() {
359         return (MessageSecurityConfig[])this.getValues(MESSAGE_SECURITY_CONFIG);
360     }
361
362     // Return the number of properties
363
public int sizeMessageSecurityConfig() {
364         return this.size(MESSAGE_SECURITY_CONFIG);
365     }
366
367     // Add a new element returning its index in the list
368
public int addMessageSecurityConfig(MessageSecurityConfig value)
369             throws ConfigException{
370         return addMessageSecurityConfig(value, true);
371     }
372
373     // Add a new element returning its index in the list with a boolean flag
374
public int addMessageSecurityConfig(MessageSecurityConfig value, boolean overwrite)
375             throws ConfigException{
376         MessageSecurityConfig old = getMessageSecurityConfigByAuthLayer(value.getAuthLayer());
377         if(old != null) {
378             throw new ConfigException(StringManager.getManager(SecurityService.class).getString("cannotAddDuplicate", "MessageSecurityConfig"));
379         }
380         return this.addValue(MESSAGE_SECURITY_CONFIG, value, overwrite);
381     }
382
383     //
384
// Remove an element using its reference
385
// Returns the index the element had in the list
386
//
387
public int removeMessageSecurityConfig(MessageSecurityConfig value){
388         return this.removeValue(MESSAGE_SECURITY_CONFIG, value);
389     }
390
391     //
392
// Remove an element using its reference
393
// Returns the index the element had in the list
394
// with boolean overwrite
395
//
396
public int removeMessageSecurityConfig(MessageSecurityConfig value, boolean overwrite)
397             throws StaleWriteConfigException{
398         return this.removeValue(MESSAGE_SECURITY_CONFIG, value, overwrite);
399     }
400
401     public MessageSecurityConfig getMessageSecurityConfigByAuthLayer(String JavaDoc id) {
402      if (null != id) { id = id.trim(); }
403     MessageSecurityConfig[] o = getMessageSecurityConfig();
404      if (o == null) return null;
405
406      for (int i=0; i < o.length; i++) {
407          if(o[i].getAttributeValue(Common.convertName(ServerTags.AUTH_LAYER)).equals(id)) {
408              return o[i];
409          }
410      }
411
412         return null;
413         
414     }
415     // This attribute is an array, possibly empty
416
public void setElementProperty(int index, ElementProperty value) {
417         this.setValue(ELEMENT_PROPERTY, index, value);
418     }
419
420     // Get Method
421
public ElementProperty getElementProperty(int index) {
422         return (ElementProperty)this.getValue(ELEMENT_PROPERTY, index);
423     }
424
425     // This attribute is an array, possibly empty
426
public void setElementProperty(ElementProperty[] value) {
427         this.setValue(ELEMENT_PROPERTY, value);
428     }
429
430     // Getter Method
431
public ElementProperty[] getElementProperty() {
432         return (ElementProperty[])this.getValues(ELEMENT_PROPERTY);
433     }
434
435     // Return the number of properties
436
public int sizeElementProperty() {
437         return this.size(ELEMENT_PROPERTY);
438     }
439
440     // Add a new element returning its index in the list
441
public int addElementProperty(ElementProperty value)
442             throws ConfigException{
443         return addElementProperty(value, true);
444     }
445
446     // Add a new element returning its index in the list with a boolean flag
447
public int addElementProperty(ElementProperty value, boolean overwrite)
448             throws ConfigException{
449         ElementProperty old = getElementPropertyByName(value.getName());
450         if(old != null) {
451             throw new ConfigException(StringManager.getManager(SecurityService.class).getString("cannotAddDuplicate", "ElementProperty"));
452         }
453         return this.addValue(ELEMENT_PROPERTY, value, overwrite);
454     }
455
456     //
457
// Remove an element using its reference
458
// Returns the index the element had in the list
459
//
460
public int removeElementProperty(ElementProperty value){
461         return this.removeValue(ELEMENT_PROPERTY, value);
462     }
463
464     //
465
// Remove an element using its reference
466
// Returns the index the element had in the list
467
// with boolean overwrite
468
//
469
public int removeElementProperty(ElementProperty value, boolean overwrite)
470             throws StaleWriteConfigException{
471         return this.removeValue(ELEMENT_PROPERTY, value, overwrite);
472     }
473
474     public ElementProperty getElementPropertyByName(String JavaDoc id) {
475      if (null != id) { id = id.trim(); }
476     ElementProperty[] o = getElementProperty();
477      if (o == null) return null;
478
479      for (int i=0; i < o.length; i++) {
480          if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
481              return o[i];
482          }
483      }
484
485         return null;
486         
487     }
488     /**
489     * Getter for DefaultRealm of the Element security-service
490     * @return the DefaultRealm of the Element security-service
491     */

492     public String JavaDoc getDefaultRealm() {
493         return getAttributeValue(ServerTags.DEFAULT_REALM);
494     }
495     /**
496     * Modify the DefaultRealm of the Element security-service
497     * @param v the new value
498     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
499     */

500     public void setDefaultRealm(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
501         setAttributeValue(ServerTags.DEFAULT_REALM, v, overwrite);
502     }
503     /**
504     * Modify the DefaultRealm of the Element security-service
505     * @param v the new value
506     */

507     public void setDefaultRealm(String JavaDoc v) {
508         setAttributeValue(ServerTags.DEFAULT_REALM, v);
509     }
510     /**
511     * Get the default value of DefaultRealm from dtd
512     */

513     public static String JavaDoc getDefaultDefaultRealm() {
514         return "file".trim();
515     }
516     /**
517     * Getter for DefaultPrincipal of the Element security-service
518     * @return the DefaultPrincipal of the Element security-service
519     */

520     public String JavaDoc getDefaultPrincipal() {
521             return getAttributeValue(ServerTags.DEFAULT_PRINCIPAL);
522     }
523     /**
524     * Modify the DefaultPrincipal of the Element security-service
525     * @param v the new value
526     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
527     */

528     public void setDefaultPrincipal(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
529         setAttributeValue(ServerTags.DEFAULT_PRINCIPAL, v, overwrite);
530     }
531     /**
532     * Modify the DefaultPrincipal of the Element security-service
533     * @param v the new value
534     */

535     public void setDefaultPrincipal(String JavaDoc v) {
536         setAttributeValue(ServerTags.DEFAULT_PRINCIPAL, v);
537     }
538     /**
539     * Getter for DefaultPrincipalPassword of the Element security-service
540     * @return the DefaultPrincipalPassword of the Element security-service
541     */

542     public String JavaDoc getDefaultPrincipalPassword() {
543             return getAttributeValue(ServerTags.DEFAULT_PRINCIPAL_PASSWORD);
544     }
545     /**
546     * Modify the DefaultPrincipalPassword of the Element security-service
547     * @param v the new value
548     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
549     */

550     public void setDefaultPrincipalPassword(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
551         setAttributeValue(ServerTags.DEFAULT_PRINCIPAL_PASSWORD, v, overwrite);
552     }
553     /**
554     * Modify the DefaultPrincipalPassword of the Element security-service
555     * @param v the new value
556     */

557     public void setDefaultPrincipalPassword(String JavaDoc v) {
558         setAttributeValue(ServerTags.DEFAULT_PRINCIPAL_PASSWORD, v);
559     }
560     /**
561     * Getter for AnonymousRole of the Element security-service
562     * @return the AnonymousRole of the Element security-service
563     */

564     public String JavaDoc getAnonymousRole() {
565         return getAttributeValue(ServerTags.ANONYMOUS_ROLE);
566     }
567     /**
568     * Modify the AnonymousRole of the Element security-service
569     * @param v the new value
570     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
571     */

572     public void setAnonymousRole(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
573         setAttributeValue(ServerTags.ANONYMOUS_ROLE, v, overwrite);
574     }
575     /**
576     * Modify the AnonymousRole of the Element security-service
577     * @param v the new value
578     */

579     public void setAnonymousRole(String JavaDoc v) {
580         setAttributeValue(ServerTags.ANONYMOUS_ROLE, v);
581     }
582     /**
583     * Get the default value of AnonymousRole from dtd
584     */

585     public static String JavaDoc getDefaultAnonymousRole() {
586         return "ANYONE".trim();
587     }
588     /**
589     * Getter for AuditEnabled of the Element security-service
590     * @return the AuditEnabled of the Element security-service
591     */

592     public boolean isAuditEnabled() {
593         return toBoolean(getAttributeValue(ServerTags.AUDIT_ENABLED));
594     }
595     /**
596     * Modify the AuditEnabled of the Element security-service
597     * @param v the new value
598     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
599     */

600     public void setAuditEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException {
601         setAttributeValue(ServerTags.AUDIT_ENABLED, ""+(v==true), overwrite);
602     }
603     /**
604     * Modify the AuditEnabled of the Element security-service
605     * @param v the new value
606     */

607     public void setAuditEnabled(boolean v) {
608         setAttributeValue(ServerTags.AUDIT_ENABLED, ""+(v==true));
609     }
610     /**
611     * Get the default value of AuditEnabled from dtd
612     */

613     public static String JavaDoc getDefaultAuditEnabled() {
614         return "false".trim();
615     }
616     /**
617     * Getter for Jacc of the Element security-service
618     * @return the Jacc of the Element security-service
619     */

620     public String JavaDoc getJacc() {
621         return getAttributeValue(ServerTags.JACC);
622     }
623     /**
624     * Modify the Jacc of the Element security-service
625     * @param v the new value
626     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
627     */

628     public void setJacc(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
629         setAttributeValue(ServerTags.JACC, v, overwrite);
630     }
631     /**
632     * Modify the Jacc of the Element security-service
633     * @param v the new value
634     */

635     public void setJacc(String JavaDoc v) {
636         setAttributeValue(ServerTags.JACC, v);
637     }
638     /**
639     * Get the default value of Jacc from dtd
640     */

641     public static String JavaDoc getDefaultJacc() {
642         return "default".trim();
643     }
644     /**
645     * Getter for AuditModules of the Element security-service
646     * @return the AuditModules of the Element security-service
647     */

648     public String JavaDoc getAuditModules() {
649         return getAttributeValue(ServerTags.AUDIT_MODULES);
650     }
651     /**
652     * Modify the AuditModules of the Element security-service
653     * @param v the new value
654     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
655     */

656     public void setAuditModules(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
657         setAttributeValue(ServerTags.AUDIT_MODULES, v, overwrite);
658     }
659     /**
660     * Modify the AuditModules of the Element security-service
661     * @param v the new value
662     */

663     public void setAuditModules(String JavaDoc v) {
664         setAttributeValue(ServerTags.AUDIT_MODULES, v);
665     }
666     /**
667     * Get the default value of AuditModules from dtd
668     */

669     public static String JavaDoc getDefaultAuditModules() {
670         return "default".trim();
671     }
672     /**
673     * Getter for ActivateDefaultPrincipalToRoleMapping of the Element security-service
674     * @return the ActivateDefaultPrincipalToRoleMapping of the Element security-service
675     */

676     public boolean isActivateDefaultPrincipalToRoleMapping() {
677         return toBoolean(getAttributeValue(ServerTags.ACTIVATE_DEFAULT_PRINCIPAL_TO_ROLE_MAPPING));
678     }
679     /**
680     * Modify the ActivateDefaultPrincipalToRoleMapping of the Element security-service
681     * @param v the new value
682     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
683     */

684     public void setActivateDefaultPrincipalToRoleMapping(boolean v, boolean overwrite) throws StaleWriteConfigException {
685         setAttributeValue(ServerTags.ACTIVATE_DEFAULT_PRINCIPAL_TO_ROLE_MAPPING, ""+(v==true), overwrite);
686     }
687     /**
688     * Modify the ActivateDefaultPrincipalToRoleMapping of the Element security-service
689     * @param v the new value
690     */

691     public void setActivateDefaultPrincipalToRoleMapping(boolean v) {
692         setAttributeValue(ServerTags.ACTIVATE_DEFAULT_PRINCIPAL_TO_ROLE_MAPPING, ""+(v==true));
693     }
694     /**
695     * Get the default value of ActivateDefaultPrincipalToRoleMapping from dtd
696     */

697     public static String JavaDoc getDefaultActivateDefaultPrincipalToRoleMapping() {
698         return "false".trim();
699     }
700     /**
701     * Getter for MappedPrincipalClass of the Element security-service
702     * @return the MappedPrincipalClass of the Element security-service
703     */

704     public String JavaDoc getMappedPrincipalClass() {
705             return getAttributeValue(ServerTags.MAPPED_PRINCIPAL_CLASS);
706     }
707     /**
708     * Modify the MappedPrincipalClass of the Element security-service
709     * @param v the new value
710     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
711     */

712     public void setMappedPrincipalClass(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
713         setAttributeValue(ServerTags.MAPPED_PRINCIPAL_CLASS, v, overwrite);
714     }
715     /**
716     * Modify the MappedPrincipalClass of the Element security-service
717     * @param v the new value
718     */

719     public void setMappedPrincipalClass(String JavaDoc v) {
720         setAttributeValue(ServerTags.MAPPED_PRINCIPAL_CLASS, v);
721     }
722     /**
723      * Create a new bean using it's default constructor.
724      * This does not add it to any bean graph.
725      */

726     public AuthRealm newAuthRealm() {
727         return new AuthRealm();
728     }
729
730     /**
731      * Create a new bean using it's default constructor.
732      * This does not add it to any bean graph.
733      */

734     public JaccProvider newJaccProvider() {
735         return new JaccProvider();
736     }
737
738     /**
739      * Create a new bean using it's default constructor.
740      * This does not add it to any bean graph.
741      */

742     public AuditModule newAuditModule() {
743         return new AuditModule();
744     }
745
746     /**
747      * Create a new bean using it's default constructor.
748      * This does not add it to any bean graph.
749      */

750     public MessageSecurityConfig newMessageSecurityConfig() {
751         return new MessageSecurityConfig();
752     }
753
754     /**
755      * Create a new bean using it's default constructor.
756      * This does not add it to any bean graph.
757      */

758     public ElementProperty newElementProperty() {
759         return new ElementProperty();
760     }
761
762     /**
763     * get the xpath representation for this element
764     * returns something like abc[@name='value'] or abc
765     * depending on the type of the bean
766     */

767     protected String JavaDoc getRelativeXPath() {
768         String JavaDoc ret = null;
769         ret = "security-service";
770         return (null != ret ? ret.trim() : null);
771     }
772
773     /*
774     * generic method to get default value from dtd
775     */

776     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
777         if(attr == null) return null;
778         attr = attr.trim();
779         if(attr.equals(ServerTags.DEFAULT_REALM)) return "file".trim();
780         if(attr.equals(ServerTags.ANONYMOUS_ROLE)) return "ANYONE".trim();
781         if(attr.equals(ServerTags.AUDIT_ENABLED)) return "false".trim();
782         if(attr.equals(ServerTags.JACC)) return "default".trim();
783         if(attr.equals(ServerTags.AUDIT_MODULES)) return "default".trim();
784         if(attr.equals(ServerTags.ACTIVATE_DEFAULT_PRINCIPAL_TO_ROLE_MAPPING)) return "false".trim();
785     return null;
786     }
787     //
788
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
789         comparators.add(c);
790     }
791
792     //
793
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
794         comparators.remove(c);
795     }
796     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
797     }
798
799     // Dump the content of this bean returning it as a String
800
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
801         String JavaDoc s;
802         Object JavaDoc o;
803         org.netbeans.modules.schema2beans.BaseBean n;
804         str.append(indent);
805         str.append("AuthRealm["+this.sizeAuthRealm()+"]"); // NOI18N
806
for(int i=0; i<this.sizeAuthRealm(); i++)
807         {
808             str.append(indent+"\t");
809             str.append("#"+i+":");
810             n = (org.netbeans.modules.schema2beans.BaseBean) this.getAuthRealm(i);
811             if (n != null)
812                 n.dump(str, indent + "\t"); // NOI18N
813
else
814                 str.append(indent+"\tnull"); // NOI18N
815
this.dumpAttributes(AUTH_REALM, i, str, indent);
816         }
817
818         str.append(indent);
819         str.append("JaccProvider["+this.sizeJaccProvider()+"]"); // NOI18N
820
for(int i=0; i<this.sizeJaccProvider(); i++)
821         {
822             str.append(indent+"\t");
823             str.append("#"+i+":");
824             n = (org.netbeans.modules.schema2beans.BaseBean) this.getJaccProvider(i);
825             if (n != null)
826                 n.dump(str, indent + "\t"); // NOI18N
827
else
828                 str.append(indent+"\tnull"); // NOI18N
829
this.dumpAttributes(JACC_PROVIDER, i, str, indent);
830         }
831
832         str.append(indent);
833         str.append("AuditModule["+this.sizeAuditModule()+"]"); // NOI18N
834
for(int i=0; i<this.sizeAuditModule(); i++)
835         {
836             str.append(indent+"\t");
837             str.append("#"+i+":");
838             n = (org.netbeans.modules.schema2beans.BaseBean) this.getAuditModule(i);
839             if (n != null)
840                 n.dump(str, indent + "\t"); // NOI18N
841
else
842                 str.append(indent+"\tnull"); // NOI18N
843
this.dumpAttributes(AUDIT_MODULE, i, str, indent);
844         }
845
846         str.append(indent);
847         str.append("MessageSecurityConfig["+this.sizeMessageSecurityConfig()+"]"); // NOI18N
848
for(int i=0; i<this.sizeMessageSecurityConfig(); i++)
849         {
850             str.append(indent+"\t");
851             str.append("#"+i+":");
852             n = (org.netbeans.modules.schema2beans.BaseBean) this.getMessageSecurityConfig(i);
853             if (n != null)
854                 n.dump(str, indent + "\t"); // NOI18N
855
else
856                 str.append(indent+"\tnull"); // NOI18N
857
this.dumpAttributes(MESSAGE_SECURITY_CONFIG, i, str, indent);
858         }
859
860         str.append(indent);
861         str.append("ElementProperty["+this.sizeElementProperty()+"]"); // NOI18N
862
for(int i=0; i<this.sizeElementProperty(); i++)
863         {
864             str.append(indent+"\t");
865             str.append("#"+i+":");
866             n = (org.netbeans.modules.schema2beans.BaseBean) this.getElementProperty(i);
867             if (n != null)
868                 n.dump(str, indent + "\t"); // NOI18N
869
else
870                 str.append(indent+"\tnull"); // NOI18N
871
this.dumpAttributes(ELEMENT_PROPERTY, i, str, indent);
872         }
873
874     }
875     public String JavaDoc dumpBeanNode(){
876         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
877         str.append("SecurityService\n"); // NOI18N
878
this.dump(str, "\n "); // NOI18N
879
return str.toString();
880     }}
881
882 // END_NOI18N
883

884
Popular Tags