KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > clientbeans > 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.clientbeans;
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.ENUM | AttrProp.REQUIRED,
68                         new String JavaDoc[] {
69                             "client",
70                             "server",
71                             "client-server"
72                         }, null);
73         this.createAttribute(PROVIDER_CONFIG, "class-name", "ClassName",
74                         AttrProp.CDATA | AttrProp.REQUIRED,
75                         null, null);
76         this.initialize(options);
77     }
78
79     // Setting the default values of the properties
80
void initialize(int options) {
81
82     }
83
84     // This attribute is an array containing at least one element
85
public void setProviderConfig(int index, ProviderConfig value) {
86         this.setValue(PROVIDER_CONFIG, index, value);
87     }
88
89     // Get Method
90
public ProviderConfig getProviderConfig(int index) {
91         return (ProviderConfig)this.getValue(PROVIDER_CONFIG, index);
92     }
93
94     // This attribute is an array containing at least one element
95
public void setProviderConfig(ProviderConfig[] value) {
96         this.setValue(PROVIDER_CONFIG, value);
97     }
98
99     // Getter Method
100
public ProviderConfig[] getProviderConfig() {
101         return (ProviderConfig[])this.getValues(PROVIDER_CONFIG);
102     }
103
104     // Return the number of properties
105
public int sizeProviderConfig() {
106         return this.size(PROVIDER_CONFIG);
107     }
108
109     // Add a new element returning its index in the list
110
public int addProviderConfig(ProviderConfig value)
111             throws ConfigException{
112         return addProviderConfig(value, true);
113     }
114
115     // Add a new element returning its index in the list with a boolean flag
116
public int addProviderConfig(ProviderConfig value, boolean overwrite)
117             throws ConfigException{
118         ProviderConfig old = getProviderConfigByProviderId(value.getProviderId());
119         if(old != null) {
120             throw new ConfigException(StringManager.getManager(MessageSecurityConfig.class).getString("cannotAddDuplicate", "ProviderConfig"));
121         }
122         return this.addValue(PROVIDER_CONFIG, value, overwrite);
123     }
124
125     //
126
// Remove an element using its reference
127
// Returns the index the element had in the list
128
//
129
public int removeProviderConfig(ProviderConfig value){
130         return this.removeValue(PROVIDER_CONFIG, value);
131     }
132
133     //
134
// Remove an element using its reference
135
// Returns the index the element had in the list
136
// with boolean overwrite
137
//
138
public int removeProviderConfig(ProviderConfig value, boolean overwrite)
139             throws StaleWriteConfigException{
140         return this.removeValue(PROVIDER_CONFIG, value, overwrite);
141     }
142
143     public ProviderConfig getProviderConfigByProviderId(String JavaDoc id) {
144      if (null != id) { id = id.trim(); }
145     ProviderConfig[] o = getProviderConfig();
146      if (o == null) return null;
147
148      for (int i=0; i < o.length; i++) {
149          if(o[i].getAttributeValue(Common.convertName(ClientTags.PROVIDER_ID)).equals(id)) {
150              return o[i];
151          }
152      }
153
154         return null;
155         
156     }
157     /**
158     * Getter for AuthLayer of the Element message-security-config
159     * @return the AuthLayer of the Element message-security-config
160     */

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

169     public void setAuthLayer(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
170         setAttributeValue(ClientTags.AUTH_LAYER, v, overwrite);
171     }
172     /**
173     * Modify the AuthLayer of the Element message-security-config
174     * @param v the new value
175     */

176     public void setAuthLayer(String JavaDoc v) {
177         setAttributeValue(ClientTags.AUTH_LAYER, v);
178     }
179     /**
180     * Getter for DefaultProvider of the Element message-security-config
181     * @return the DefaultProvider of the Element message-security-config
182     */

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

191     public void setDefaultProvider(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
192         setAttributeValue(ClientTags.DEFAULT_PROVIDER, v, overwrite);
193     }
194     /**
195     * Modify the DefaultProvider of the Element message-security-config
196     * @param v the new value
197     */

198     public void setDefaultProvider(String JavaDoc v) {
199         setAttributeValue(ClientTags.DEFAULT_PROVIDER, v);
200     }
201     /**
202     * Getter for DefaultClientProvider of the Element message-security-config
203     * @return the DefaultClientProvider of the Element message-security-config
204     */

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

213     public void setDefaultClientProvider(String JavaDoc v, boolean overwrite) throws StaleWriteConfigException {
214         setAttributeValue(ClientTags.DEFAULT_CLIENT_PROVIDER, v, overwrite);
215     }
216     /**
217     * Modify the DefaultClientProvider of the Element message-security-config
218     * @param v the new value
219     */

220     public void setDefaultClientProvider(String JavaDoc v) {
221         setAttributeValue(ClientTags.DEFAULT_CLIENT_PROVIDER, v);
222     }
223     /**
224      * Create a new bean using it's default constructor.
225      * This does not add it to any bean graph.
226      */

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

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

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

291
Popular Tags