KickJava   Java API By Example, From Geeks To Geeks.

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


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 MapElement matches the schema element map-element
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 MapElement extends com.sun.enterprise.tools.common.dd.SunBaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc PRINCIPAL = "Principal"; // NOI18N
45
static public final String JavaDoc BACKEND_PRINCIPAL = "BackendPrincipal"; // NOI18N
46
static public final String JavaDoc BACKENDPRINCIPALUSERNAME = "BackendPrincipalUserName"; // NOI18N
47
static public final String JavaDoc BACKENDPRINCIPALPASSWORD = "BackendPrincipalPassword"; // NOI18N
48
static public final String JavaDoc BACKENDPRINCIPALCREDENTIAL = "BackendPrincipalCredential"; // NOI18N
49

50     public MapElement() {
51         this(Common.USE_DEFAULT_VALUES);
52     }
53
54     public MapElement(int options)
55     {
56         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
57         // Properties (see root bean comments for the bean graph)
58
this.createProperty("principal", // NOI18N
59
PRINCIPAL,
60             Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY,
61             Principal.class);
62         this.createAttribute(PRINCIPAL, "user-name", "UserName",
63                         AttrProp.CDATA | AttrProp.REQUIRED,
64                         null, null);
65         this.createProperty("backend-principal", // NOI18N
66
BACKEND_PRINCIPAL,
67             Common.TYPE_0_1 | Common.TYPE_BOOLEAN | Common.TYPE_KEY,
68             Boolean JavaDoc.class);
69         this.createAttribute(BACKEND_PRINCIPAL, "user-name", "UserName",
70                         AttrProp.CDATA | AttrProp.REQUIRED,
71                         null, null);
72         this.createAttribute(BACKEND_PRINCIPAL, "password", "Password",
73                         AttrProp.CDATA | AttrProp.REQUIRED,
74                         null, null);
75         this.createAttribute(BACKEND_PRINCIPAL, "credential", "Credential",
76                         AttrProp.CDATA | AttrProp.REQUIRED,
77                         null, null);
78         this.initialize(options);
79     }
80
81     // Setting the default values of the properties
82
void initialize(int options)
83     {
84     
85     }
86
87     // This attribute is an array containing at least one element
88
public void setPrincipal(int index, Principal value) {
89         this.setValue(PRINCIPAL, index, value);
90     }
91
92     //
93
public Principal getPrincipal(int index) {
94         return (Principal)this.getValue(PRINCIPAL, index);
95     }
96
97     // This attribute is an array containing at least one element
98
public void setPrincipal(Principal[] value) {
99         this.setValue(PRINCIPAL, value);
100     }
101
102     //
103
public Principal[] getPrincipal() {
104         return (Principal[])this.getValues(PRINCIPAL);
105     }
106
107     // Return the number of properties
108
public int sizePrincipal() {
109         return this.size(PRINCIPAL);
110     }
111
112     // Add a new element returning its index in the list
113
public int addPrincipal(com.sun.enterprise.tools.common.dd.connector.Principal value) {
114         return this.addValue(PRINCIPAL, value);
115     }
116
117     //
118
// Remove an element using its reference
119
// Returns the index the element had in the list
120
//
121
public int removePrincipal(com.sun.enterprise.tools.common.dd.connector.Principal value) {
122         return this.removeValue(PRINCIPAL, value);
123     }
124
125     // This attribute is mandatory
126
public void setBackendPrincipal(boolean value) {
127         this.setValue(BACKEND_PRINCIPAL, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
128     }
129
130     //
131
public boolean isBackendPrincipal() {
132         Boolean JavaDoc ret = (Boolean JavaDoc)this.getValue(BACKEND_PRINCIPAL);
133         if (ret == null)
134             ret = (Boolean JavaDoc)Common.defaultScalarValue(Common.TYPE_BOOLEAN);
135         return ((java.lang.Boolean JavaDoc)ret).booleanValue();
136     }
137
138     // This attribute is mandatory
139
public void setBackendPrincipalUserName(java.lang.String JavaDoc value) {
140         // Make sure we've got a place to put this attribute.
141
if (size(BACKEND_PRINCIPAL) == 0) {
142             setValue(BACKEND_PRINCIPAL, "");
143         }
144         setAttributeValue(BACKEND_PRINCIPAL, "UserName", value);
145     }
146
147     //
148
public java.lang.String JavaDoc getBackendPrincipalUserName() {
149         // If our element does not exist, then the attribute does not exist.
150
if (size(BACKEND_PRINCIPAL) == 0) {
151             return null;
152         } else {
153             return getAttributeValue(BACKEND_PRINCIPAL, "UserName");
154         }
155     }
156
157     // This attribute is mandatory
158
public void setBackendPrincipalPassword(java.lang.String JavaDoc value) {
159         // Make sure we've got a place to put this attribute.
160
if (size(BACKEND_PRINCIPAL) == 0) {
161             setValue(BACKEND_PRINCIPAL, "");
162         }
163         setAttributeValue(BACKEND_PRINCIPAL, "Password", value);
164     }
165
166     //
167
public java.lang.String JavaDoc getBackendPrincipalPassword() {
168         // If our element does not exist, then the attribute does not exist.
169
if (size(BACKEND_PRINCIPAL) == 0) {
170             return null;
171         } else {
172             return getAttributeValue(BACKEND_PRINCIPAL, "Password");
173         }
174     }
175
176     // This attribute is mandatory
177
public void setBackendPrincipalCredential(java.lang.String JavaDoc value) {
178         // Make sure we've got a place to put this attribute.
179
if (size(BACKEND_PRINCIPAL) == 0) {
180             setValue(BACKEND_PRINCIPAL, "");
181         }
182         setAttributeValue(BACKEND_PRINCIPAL, "Credential", value);
183     }
184
185     //
186
public java.lang.String JavaDoc getBackendPrincipalCredential() {
187         // If our element does not exist, then the attribute does not exist.
188
if (size(BACKEND_PRINCIPAL) == 0) {
189             return null;
190         } else {
191             return getAttributeValue(BACKEND_PRINCIPAL, "Credential");
192         }
193     }
194
195     //
196
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
197         comparators.add(c);
198     }
199
200     //
201
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
202         comparators.remove(c);
203     }
204     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
205         boolean restrictionFailure = false;
206         // Validating property principal
207
if (sizePrincipal() == 0) {
208             throw new org.netbeans.modules.schema2beans.ValidateException("sizePrincipal() == 0", "principal", this); // NOI18N
209
}
210         for (int _index = 0; _index < sizePrincipal(); ++_index) {
211             com.sun.enterprise.tools.common.dd.connector.Principal element = getPrincipal(_index);
212             if (element != null) {
213                 element.validate();
214             }
215         }
216         // Validating property backendPrincipal
217
// Validating property backendPrincipalUserName
218
if (getBackendPrincipalUserName() == null) {
219             throw new org.netbeans.modules.schema2beans.ValidateException("getBackendPrincipalUserName() == null", "backendPrincipalUserName", this); // NOI18N
220
}
221         // Validating property backendPrincipalPassword
222
if (getBackendPrincipalPassword() == null) {
223             throw new org.netbeans.modules.schema2beans.ValidateException("getBackendPrincipalPassword() == null", "backendPrincipalPassword", this); // NOI18N
224
}
225         // Validating property backendPrincipalCredential
226
if (getBackendPrincipalCredential() == null) {
227             throw new org.netbeans.modules.schema2beans.ValidateException("getBackendPrincipalCredential() == null", "backendPrincipalCredential", this); // NOI18N
228
}
229     }
230
231     // Dump the content of this bean returning it as a String
232
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
233         String JavaDoc s;
234         Object JavaDoc o;
235         org.netbeans.modules.schema2beans.BaseBean n;
236         str.append(indent);
237         str.append("Principal["+this.sizePrincipal()+"]"); // NOI18N
238
for(int i=0; i<this.sizePrincipal(); i++)
239         {
240             str.append(indent+"\t");
241             str.append("#"+i+":");
242             n = (org.netbeans.modules.schema2beans.BaseBean) this.getPrincipal(i);
243             if (n != null)
244                 n.dump(str, indent + "\t"); // NOI18N
245
else
246                 str.append(indent+"\tnull"); // NOI18N
247
this.dumpAttributes(PRINCIPAL, i, str, indent);
248         }
249
250         str.append(indent);
251         str.append("BackendPrincipal"); // NOI18N
252
str.append(indent+"\t"); // NOI18N
253
str.append((this.isBackendPrincipal()?"true":"false"));
254         this.dumpAttributes(BACKEND_PRINCIPAL, 0, str, indent);
255
256     }
257     public String JavaDoc dumpBeanNode(){
258         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
259         str.append("MapElement\n"); // NOI18N
260
this.dump(str, "\n "); // NOI18N
261
return str.toString();
262     }}
263
264 // END_NOI18N
265

266
267 /*
268         The following schema file has been used for generation:
269
270 <!--
271   XML DTD for Sun ONE Application Server specific J2EE Resource Adapter
272   deployment descriptor. This is a companion DTD to connector_1_5.xsd
273
274   $Revision: 1.3 $
275 -->
276
277 <!-- Each deployed Resource Adapter (RAR) Module, will have ias-ra.xml
278      associated with it, which specifies several dynamic configuration
279      properties. Key aspects are pool sizing and security role maps.
280  -->
281 <!ELEMENT sun-connector (resource-adapter, role-map?)>
282
283 <!-- Resource adapter configuration
284
285      jndi-name name by which, this adapter will appear in JNDI tree
286      max-pool-size maximum size of connection to EIS
287      steady-pool-size initial and minimum number of connections to be maintained
288      max-wait-in-millis if a connection is not readily found, caller will have to
289                         wait this long, before a connection is created. A value of
290                         0 implies, wait till a connection becomes available. If the
291                         pool is completely utilized and the timer expires, an
292                         exception will be delivered to the application.
293
294      idle-timeout-in-seconds A timer thread periodically removed unused connections.
295                              The interval at which this thread runs. All idle
296                              connections will be removed, while mainataining
297                              the configured steady-pool-size.
298 -->
299 <!ELEMENT resource-adapter (description?, property*)>
300 <!ATTLIST resource-adapter jndi-name CDATA #REQUIRED
301                            max-pool-size CDATA "32"
302                            steady-pool-size CDATA "4"
303                            max-wait-time-in-millis CDATA "10000"
304                            idle-timeout-in-seconds CDATA "1000">
305
306 <!-- Perform mapping from principal received during Servlet/EJB
307      authentication, to credentials accepted by the EIS. This
308      mapping is optional. The map consists of several 2-tuples
309      map-id is the name of the mapping
310  -->
311 <!ELEMENT role-map (description?, map-element*)>
312 <!ATTLIST role-map map-id CDATA #REQUIRED>
313                 
314
315 <!-- It is possible to map multiple (server) principal to the
316      same backend principal.
317 -->
318 <!ELEMENT map-element (principal+, backend-principal)>
319
320 <!-- Principal of the Servlet and EJB client -->
321 <!ELEMENT principal (description?)>
322 <!ATTLIST principal user-name CDATA #REQUIRED>
323  
324 <!-- Backend EIS principal -->
325 <!ELEMENT backend-principal EMPTY>
326 <!ATTLIST backend-principal user-name CDATA #REQUIRED
327                             password CDATA #REQUIRED
328                             credential CDATA #REQUIRED>
329
330 <!ELEMENT description (#PCDATA)>
331
332 <!-- Syntax for supplying properties as name value pairs -->
333 <!ELEMENT property EMPTY>
334 <!ATTLIST property name CDATA #REQUIRED
335                    value CDATA #REQUIRED>
336
337 */

338
Popular Tags