KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > common > dd > connector > RoleMap


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 RoleMap matches the schema element role-map
26  *
27  * Generated on Thu Jul 31 18:16:39 PDT 2003
28  */

29
30 package com.sun.enterprise.tools.common.dd.connector;
31
32 import org.w3c.dom.*;
33 import org.netbeans.modules.schema2beans.*;
34 import java.beans.*;
35 import java.util.*;
36
37 // BEGIN_NOI18N
38

39 public class RoleMap extends com.sun.enterprise.tools.common.dd.SunBaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc MAPID = "MapId"; // NOI18N
45
static public final String JavaDoc DESCRIPTION = "Description"; // NOI18N
46
static public final String JavaDoc MAP_ELEMENT = "MapElement"; // NOI18N
47

48     public RoleMap() {
49         this(Common.USE_DEFAULT_VALUES);
50     }
51
52     public RoleMap(int options)
53     {
54         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
55         // Properties (see root bean comments for the bean graph)
56
this.createProperty("description", // NOI18N
57
DESCRIPTION,
58             Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY,
59             String JavaDoc.class);
60         this.createProperty("map-element", // NOI18N
61
MAP_ELEMENT,
62             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
63             MapElement.class);
64         this.initialize(options);
65     }
66
67     // Setting the default values of the properties
68
void initialize(int options)
69     {
70     
71     }
72
73     // This attribute is mandatory
74
public void setMapId(java.lang.String JavaDoc value) {
75         setAttributeValue(MAPID, value);
76     }
77
78     //
79
public java.lang.String JavaDoc getMapId() {
80         return getAttributeValue(MAPID);
81     }
82
83     // This attribute is optional
84
public void setDescription(String JavaDoc value) {
85         this.setValue(DESCRIPTION, value);
86     }
87
88     //
89
public String JavaDoc getDescription() {
90         return (String JavaDoc)this.getValue(DESCRIPTION);
91     }
92
93     // This attribute is an array, possibly empty
94
public void setMapElement(int index, MapElement value) {
95         this.setValue(MAP_ELEMENT, index, value);
96     }
97
98     //
99
public MapElement getMapElement(int index) {
100         return (MapElement)this.getValue(MAP_ELEMENT, index);
101     }
102
103     // This attribute is an array, possibly empty
104
public void setMapElement(MapElement[] value) {
105         this.setValue(MAP_ELEMENT, value);
106     }
107
108     //
109
public MapElement[] getMapElement() {
110         return (MapElement[])this.getValues(MAP_ELEMENT);
111     }
112
113     // Return the number of properties
114
public int sizeMapElement() {
115         return this.size(MAP_ELEMENT);
116     }
117
118     // Add a new element returning its index in the list
119
public int addMapElement(com.sun.enterprise.tools.common.dd.connector.MapElement value) {
120         return this.addValue(MAP_ELEMENT, value);
121     }
122
123     //
124
// Remove an element using its reference
125
// Returns the index the element had in the list
126
//
127
public int removeMapElement(com.sun.enterprise.tools.common.dd.connector.MapElement value) {
128         return this.removeValue(MAP_ELEMENT, value);
129     }
130
131     //
132
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
133         comparators.add(c);
134     }
135
136     //
137
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
138         comparators.remove(c);
139     }
140     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
141         boolean restrictionFailure = false;
142         // Validating property mapId
143
if (getMapId() == null) {
144             throw new org.netbeans.modules.schema2beans.ValidateException("getMapId() == null", "mapId", this); // NOI18N
145
}
146         // Validating property description
147
if (getDescription() != null) {
148         }
149         // Validating property mapElement
150
for (int _index = 0; _index < sizeMapElement(); ++_index) {
151             com.sun.enterprise.tools.common.dd.connector.MapElement element = getMapElement(_index);
152             if (element != null) {
153                 element.validate();
154             }
155         }
156     }
157
158     // Dump the content of this bean returning it as a String
159
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
160         String JavaDoc s;
161         Object JavaDoc o;
162         org.netbeans.modules.schema2beans.BaseBean n;
163         str.append(indent);
164         str.append("Description"); // NOI18N
165
str.append(indent+"\t"); // NOI18N
166
str.append("<"); // NOI18N
167
s = this.getDescription();
168         str.append((s==null?"null":s.trim())); // NOI18N
169
str.append(">\n"); // NOI18N
170
this.dumpAttributes(DESCRIPTION, 0, str, indent);
171
172         str.append(indent);
173         str.append("MapElement["+this.sizeMapElement()+"]"); // NOI18N
174
for(int i=0; i<this.sizeMapElement(); i++)
175         {
176             str.append(indent+"\t");
177             str.append("#"+i+":");
178             n = (org.netbeans.modules.schema2beans.BaseBean) this.getMapElement(i);
179             if (n != null)
180                 n.dump(str, indent + "\t"); // NOI18N
181
else
182                 str.append(indent+"\tnull"); // NOI18N
183
this.dumpAttributes(MAP_ELEMENT, i, str, indent);
184         }
185
186     }
187     public String JavaDoc dumpBeanNode(){
188         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
189         str.append("RoleMap\n"); // NOI18N
190
this.dump(str, "\n "); // NOI18N
191
return str.toString();
192     }}
193
194 // END_NOI18N
195

196
197 /*
198         The following schema file has been used for generation:
199
200 <!--
201   XML DTD for Sun ONE Application Server specific J2EE Resource Adapter
202   deployment descriptor. This is a companion DTD to connector_1_5.xsd
203
204   $Revision: 1.3 $
205 -->
206
207 <!-- Each deployed Resource Adapter (RAR) Module, will have ias-ra.xml
208      associated with it, which specifies several dynamic configuration
209      properties. Key aspects are pool sizing and security role maps.
210  -->
211 <!ELEMENT sun-connector (resource-adapter, role-map?)>
212
213 <!-- Resource adapter configuration
214
215      jndi-name name by which, this adapter will appear in JNDI tree
216      max-pool-size maximum size of connection to EIS
217      steady-pool-size initial and minimum number of connections to be maintained
218      max-wait-in-millis if a connection is not readily found, caller will have to
219                         wait this long, before a connection is created. A value of
220                         0 implies, wait till a connection becomes available. If the
221                         pool is completely utilized and the timer expires, an
222                         exception will be delivered to the application.
223
224      idle-timeout-in-seconds A timer thread periodically removed unused connections.
225                              The interval at which this thread runs. All idle
226                              connections will be removed, while mainataining
227                              the configured steady-pool-size.
228 -->
229 <!ELEMENT resource-adapter (description?, property*)>
230 <!ATTLIST resource-adapter jndi-name CDATA #REQUIRED
231                            max-pool-size CDATA "32"
232                            steady-pool-size CDATA "4"
233                            max-wait-time-in-millis CDATA "10000"
234                            idle-timeout-in-seconds CDATA "1000">
235
236 <!-- Perform mapping from principal received during Servlet/EJB
237      authentication, to credentials accepted by the EIS. This
238      mapping is optional. The map consists of several 2-tuples
239      map-id is the name of the mapping
240  -->
241 <!ELEMENT role-map (description?, map-element*)>
242 <!ATTLIST role-map map-id CDATA #REQUIRED>
243                 
244
245 <!-- It is possible to map multiple (server) principal to the
246      same backend principal.
247 -->
248 <!ELEMENT map-element (principal+, backend-principal)>
249
250 <!-- Principal of the Servlet and EJB client -->
251 <!ELEMENT principal (description?)>
252 <!ATTLIST principal user-name CDATA #REQUIRED>
253  
254 <!-- Backend EIS principal -->
255 <!ELEMENT backend-principal EMPTY>
256 <!ATTLIST backend-principal user-name CDATA #REQUIRED
257                             password CDATA #REQUIRED
258                             credential CDATA #REQUIRED>
259
260 <!ELEMENT description (#PCDATA)>
261
262 <!-- Syntax for supplying properties as name value pairs -->
263 <!ELEMENT property EMPTY>
264 <!ATTLIST property name CDATA #REQUIRED
265                    value CDATA #REQUIRED>
266
267 */

268
Popular Tags