KickJava   Java API By Example, From Geeks To Geeks.

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


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 MessageSecurityConfig matches the DTD element message-security-config
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 MessageSecurityConfig 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 PROVIDER_CONFIG = "ProviderConfig";
50
51     public MessageSecurityConfig() {
52         this(Common.USE_DEFAULT_VALUES);
53     }
54
55     public MessageSecurityConfig(int options)
56     {
57         super(comparators, runtimeVersion);
58         // Properties (see root bean comments for the bean graph)
59
initPropertyTables(1);
60         this.createProperty("provider-config", PROVIDER_CONFIG,
61             Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY,
62             ProviderConfig.class);
63         this.createAttribute(PROVIDER_CONFIG, "provider-id", "ProviderId",
64                         AttrProp.CDATA | AttrProp.REQUIRED,
65                         null, null);
66         this.createAttribute(PROVIDER_CONFIG, "provider-type", "ProviderType",
67                         AttrProp.CDATA | AttrProp.REQUIRED,
68                         null, null);
69         this.createAttribute(PROVIDER_CONFIG, "class-name", "ClassName",
70                         AttrProp.CDATA | AttrProp.REQUIRED,
71                         null, null);
72         this.initialize(options);
73     }
74
75     // Setting the default values of the properties
76
void initialize(int options) {
77
78     }
79
80     // This attribute is an array containing at least one element
81
public void setProviderConfig(int index, ProviderConfig value) {
82         this.setValue(PROVIDER_CONFIG, index, value);
83     }
84
85     // Get Method
86
public ProviderConfig getProviderConfig(int index) {
87         return (ProviderConfig)this.getValue(PROVIDER_CONFIG, index);
88     }
89
90     // This attribute is an array containing at least one element
91
public void setProviderConfig(ProviderConfig[] value) {
92         this.setValue(PROVIDER_CONFIG, value);
93     }
94
95     // Getter Method
96
public ProviderConfig[] getProviderConfig() {
97         return (ProviderConfig[])this.getValues(PROVIDER_CONFIG);
98     }
99
100     // Return the number of properties
101
public int sizeProviderConfig() {
102         return this.size(PROVIDER_CONFIG);
103     }
104
105     // Add a new element returning its index in the list
106
public int addProviderConfig(ProviderConfig value)
107             throws ConfigException{
108         return addProviderConfig(value, true);
109     }
110
111     // Add a new element returning its index in the list with a boolean flag
112
public int addProviderConfig(ProviderConfig value, boolean overwrite)
113             throws ConfigException{
114         ProviderConfig old = getProviderConfigByProviderId(value.getProviderId());
115         if(old != null) {
116             throw new ConfigException(StringManager.getManager(MessageSecurityConfig.class).getString("cannotAddDuplicate", "ProviderConfig"));
117         }
118         return this.addValue(PROVIDER_CONFIG, value, overwrite);
119     }
120
121     //
122
// Remove an element using its reference
123
// Returns the index the element had in the list
124
//
125
public int removeProviderConfig(ProviderConfig value){
126         return this.removeValue(PROVIDER_CONFIG, value);
127     }
128
129     //
130
// Remove an element using its reference
131
// Returns the index the element had in the list
132
// with boolean overwrite
133
//
134
public int removeProviderConfig(ProviderConfig value, boolean overwrite)
135             throws StaleWriteConfigException{
136         return this.removeValue(PROVIDER_CONFIG, value, overwrite);
137     }
138
139     public ProviderConfig getProviderConfigByProviderId(String JavaDoc id) {
140      if (null != id) { id = id.trim(); }
141     ProviderConfig[] o = getProviderConfig();
142      if (o == null) return null;
143
144      for (int i=0; i < o.length; i++) {
145          if(o[i].getAttributeValue(Common.convertName(ServerTags.PROVIDER_ID)).equals(id)) {
146              return o[i];
147          }
148      }
149
150         return null;
151         
152     }
153     /**
154     * Getter for AuthLayer of the Element message-security-config
155     * @return the AuthLayer of the Element message-security-config
156     */

157     public String JavaDoc getAuthLayer() {
158         return getAttributeValue(ServerTags.AUTH_LAYER);
159     }
160     /**
161     * Modify the AuthLayer of the Element message-security-config
162     * @param v the new value
163     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
164     */

165     public void setAuthLayer(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
166         setAttributeValue(ServerTags.AUTH_LAYER, v, overwrite);
167     }
168     /**
169     * Modify the AuthLayer of the Element message-security-config
170     * @param v the new value
171     */

172     public void setAuthLayer(String JavaDoc v) {
173         setAttributeValue(ServerTags.AUTH_LAYER, v);
174     }
175     /**
176     * Getter for DefaultProvider of the Element message-security-config
177     * @return the DefaultProvider of the Element message-security-config
178     */

179     public String JavaDoc getDefaultProvider() {
180             return getAttributeValue(ServerTags.DEFAULT_PROVIDER);
181     }
182     /**
183     * Modify the DefaultProvider of the Element message-security-config
184     * @param v the new value
185     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
186     */

187     public void setDefaultProvider(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
188         setAttributeValue(ServerTags.DEFAULT_PROVIDER, v, overwrite);
189     }
190     /**
191     * Modify the DefaultProvider of the Element message-security-config
192     * @param v the new value
193     */

194     public void setDefaultProvider(String JavaDoc v) {
195         setAttributeValue(ServerTags.DEFAULT_PROVIDER, v);
196     }
197     /**
198     * Getter for DefaultClientProvider of the Element message-security-config
199     * @return the DefaultClientProvider of the Element message-security-config
200     */

201     public String JavaDoc getDefaultClientProvider() {
202             return getAttributeValue(ServerTags.DEFAULT_CLIENT_PROVIDER);
203     }
204     /**
205     * Modify the DefaultClientProvider of the Element message-security-config
206     * @param v the new value
207     * @throws StaleWriteConfigException if overwrite is false and file changed on disk
208     */

209     public void setDefaultClientProvider(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
210         setAttributeValue(ServerTags.DEFAULT_CLIENT_PROVIDER, v, overwrite);
211     }
212     /**
213     * Modify the DefaultClientProvider of the Element message-security-config
214     * @param v the new value
215     */

216     public void setDefaultClientProvider(String JavaDoc v) {
217         setAttributeValue(ServerTags.DEFAULT_CLIENT_PROVIDER, v);
218     }
219     /**
220      * Create a new bean using it's default constructor.
221      * This does not add it to any bean graph.
222      */

223     public ProviderConfig newProviderConfig() {
224         return new ProviderConfig();
225     }
226
227     /**
228     * get the xpath representation for this element
229     * returns something like abc[@name='value'] or abc
230     * depending on the type of the bean
231     */

232     protected String JavaDoc getRelativeXPath() {
233         String JavaDoc ret = null;
234         ret = "message-security-config" + (canHaveSiblings() ? "[@auth-layer='" + getAttributeValue("auth-layer") +"']" : "") ;
235         return (null != ret ? ret.trim() : null);
236     }
237
238     /*
239     * generic method to get default value from dtd
240     */

241     public static String JavaDoc getDefaultAttributeValue(String JavaDoc attr) {
242         if(attr == null) return null;
243         attr = attr.trim();
244     return null;
245     }
246     //
247
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
248         comparators.add(c);
249     }
250
251     //
252
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     }
257
258     // Dump the content of this bean returning it as a String
259
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
260         String JavaDoc s;
261         Object JavaDoc o;
262         org.netbeans.modules.schema2beans.BaseBean n;
263         str.append(indent);
264         str.append("ProviderConfig["+this.sizeProviderConfig()+"]"); // NOI18N
265
for(int i=0; i<this.sizeProviderConfig(); i++)
266         {
267             str.append(indent+"\t");
268             str.append("#"+i+":");
269             n = (org.netbeans.modules.schema2beans.BaseBean) this.getProviderConfig(i);
270             if (n != null)
271                 n.dump(str, indent + "\t"); // NOI18N
272
else
273                 str.append(indent+"\tnull"); // NOI18N
274
this.dumpAttributes(PROVIDER_CONFIG, i, str, indent);
275         }
276
277     }
278     public String JavaDoc dumpBeanNode(){
279         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
280         str.append("MessageSecurityConfig\n"); // NOI18N
281
this.dump(str, "\n "); // NOI18N
282
return str.toString();
283     }}
284
285 // END_NOI18N
286

287
Popular Tags