KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > common > dd > webapp > CacheHelper


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 CacheHelper matches the schema element cache-helper
26  *
27  * Generated on Tue Sep 02 18:08:42 PDT 2003
28  */

29
30 package com.sun.enterprise.tools.common.dd.webapp;
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 CacheHelper extends com.sun.enterprise.tools.common.dd.SunBaseBean
40 {
41
42     static Vector comparators = new Vector();
43
44     static public final String JavaDoc NAME = "Name"; // NOI18N
45
static public final String JavaDoc CLASSNAME = "ClassName"; // NOI18N
46
static public final String JavaDoc PROPERTY = "WebProperty"; // NOI18N
47

48     public CacheHelper() {
49         this(Common.USE_DEFAULT_VALUES);
50     }
51
52     public CacheHelper(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("property", // NOI18N
57
PROPERTY,
58             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
59             WebProperty.class);
60         this.createAttribute(PROPERTY, "name", "Name",
61                         AttrProp.CDATA | AttrProp.REQUIRED,
62                         null, null);
63         this.createAttribute(PROPERTY, "value", "Value",
64                         AttrProp.CDATA | AttrProp.REQUIRED,
65                         null, null);
66         this.initialize(options);
67     }
68
69     // Setting the default values of the properties
70
void initialize(int options)
71     {
72     
73     }
74
75     // This attribute is mandatory
76
public void setName(java.lang.String JavaDoc value) {
77         setAttributeValue(NAME, value);
78     }
79
80     //
81
public java.lang.String JavaDoc getName() {
82         return getAttributeValue(NAME);
83     }
84
85     // This attribute is mandatory
86
public void setClassName(java.lang.String JavaDoc value) {
87         setAttributeValue(CLASSNAME, value);
88     }
89
90     //
91
public java.lang.String JavaDoc getClassName() {
92         return getAttributeValue(CLASSNAME);
93     }
94
95     // This attribute is an array, possibly empty
96
public void setWebProperty(int index, WebProperty value) {
97         this.setValue(PROPERTY, index, value);
98     }
99
100     //
101
public WebProperty getWebProperty(int index) {
102         return (WebProperty)this.getValue(PROPERTY, index);
103     }
104
105     // This attribute is an array, possibly empty
106
public void setWebProperty(WebProperty[] value) {
107         this.setValue(PROPERTY, value);
108     }
109
110     //
111
public WebProperty[] getWebProperty() {
112         return (WebProperty[])this.getValues(PROPERTY);
113     }
114
115     // Return the number of properties
116
public int sizeWebProperty() {
117         return this.size(PROPERTY);
118     }
119
120     // Add a new element returning its index in the list
121
public int addWebProperty(com.sun.enterprise.tools.common.dd.webapp.WebProperty value) {
122         return this.addValue(PROPERTY, value);
123     }
124
125     //
126
// Remove an element using its reference
127
// Returns the index the element had in the list
128
//
129
public int removeWebProperty(com.sun.enterprise.tools.common.dd.webapp.WebProperty value) {
130         return this.removeValue(PROPERTY, value);
131     }
132
133     //
134
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
135         comparators.add(c);
136     }
137
138     //
139
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
140         comparators.remove(c);
141     }
142     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
143         boolean restrictionFailure = false;
144         // Validating property name
145
if (getName() == null) {
146             throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); // NOI18N
147
}
148         // Validating property className
149
if (getClassName() == null) {
150             throw new org.netbeans.modules.schema2beans.ValidateException("getClassName() == null", "className", this); // NOI18N
151
}
152         // Validating property webProperty
153
for (int _index = 0; _index < sizeWebProperty(); ++_index) {
154             com.sun.enterprise.tools.common.dd.webapp.WebProperty element = getWebProperty(_index);
155             if (element != null) {
156                 element.validate();
157             }
158         }
159     }
160
161     // Dump the content of this bean returning it as a String
162
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
163         String JavaDoc s;
164         Object JavaDoc o;
165         org.netbeans.modules.schema2beans.BaseBean n;
166         str.append(indent);
167         str.append("WebProperty["+this.sizeWebProperty()+"]"); // NOI18N
168
for(int i=0; i<this.sizeWebProperty(); i++)
169         {
170             str.append(indent+"\t");
171             str.append("#"+i+":");
172             n = (org.netbeans.modules.schema2beans.BaseBean) this.getWebProperty(i);
173             if (n != null)
174                 n.dump(str, indent + "\t"); // NOI18N
175
else
176                 str.append(indent+"\tnull"); // NOI18N
177
this.dumpAttributes(PROPERTY, i, str, indent);
178         }
179
180     }
181     public String JavaDoc dumpBeanNode(){
182         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
183         str.append("CacheHelper\n"); // NOI18N
184
this.dump(str, "\n "); // NOI18N
185
return str.toString();
186     }}
187
188 // END_NOI18N
189

190
191 /*
192         The following schema file has been used for generation:
193
194 <!--
195   XML DTD for Sun ONE Application Server specific Web Application
196   deployment descriptor. This is a companion DTD for web-app_2_4.xsd
197
198   $Revision: 1.3 $
199 -->
200
201 <!-- root element for vendor specific web application (module) configuration -->
202 <!ELEMENT sun-web-app (context-root?, security-role-mapping*, servlet*, session-config?,
203                        ejb-ref*, resource-ref*, resource-env-ref*, service-ref*,
204                        cache?, class-loader?,
205                        jsp-config?, locale-charset-info?, property*,
206                    message-destination*, webservice-description*)>
207
208 <!--
209  Context Root for the web application when the war file is a standalone module.
210  When the war module is part of the J2EE Application, use the application.xml
211 -->
212 <!ELEMENT context-root (#PCDATA)>
213
214 <!ELEMENT security-role-mapping (role-name, (principal-name | group-name)+)>
215 <!ELEMENT role-name (#PCDATA)>
216
217 <!ELEMENT principal-name (#PCDATA)>
218 <!ELEMENT group-name (#PCDATA)>
219
220 <!ELEMENT servlet (servlet-name, principal-name?, webservice-endpoint*)>
221
222 <!ELEMENT session-config (session-manager?, session-properties?, cookie-properties?)>
223
224 <!ELEMENT session-manager (manager-properties?, store-properties?)>
225 <!ATTLIST session-manager persistence-type CDATA "memory">
226
227 <!ELEMENT manager-properties (property*)>
228 <!ELEMENT store-properties (property*)>
229 <!ELEMENT session-properties (property*)>
230 <!ELEMENT cookie-properties (property*)>
231
232 <!ELEMENT jndi-name (#PCDATA)>
233
234 <!ELEMENT resource-env-ref (resource-env-ref-name, jndi-name)>
235 <!ELEMENT resource-env-ref-name (#PCDATA)>
236            
237 <!ELEMENT resource-ref (res-ref-name, jndi-name, default-resource-principal?)>
238 <!ELEMENT res-ref-name (#PCDATA)>
239
240 <!ELEMENT default-resource-principal ( name, password)>
241
242 <!--
243 This node holds information about a logical message destination
244 -->
245 <!ELEMENT message-destination (message-destination-name, jndi-name)>
246
247 <!--
248 This node holds the name of a logical message destination
249 -->
250 <!ELEMENT message-destination-name (#PCDATA)>
251
252 <!--
253 This text nodes holds a name string.
254 -->
255 <!ELEMENT name (#PCDATA)>
256
257 <!--
258 This element holds password text.
259 -->
260 <!ELEMENT password (#PCDATA)>
261
262
263 <!ELEMENT ejb-ref (ejb-ref-name, jndi-name)>
264 <!ELEMENT ejb-ref-name (#PCDATA)>
265
266 <!-- cache element configures the cache for web application. iAS 7.0 web container
267      supports one such cache object per application: i.e. <cache> is a sub element
268      of <ias-web-app>. A cache can have zero or more cache-mapping elements and
269      zero or more customizable cache-helper classes.
270                                                                                    
271         max-entries Maximum number of entries this cache may hold. [4096]
272         timeout-in-seconds Default timeout for the cache entries in seconds. [30]
273         enabled Is this cache enabled? [false]
274 -->
275 <!ELEMENT cache (cache-helper*, default-helper?, property*, cache-mapping*)>
276 <!ATTLIST cache max-entries CDATA "4096"
277                  timeout-in-seconds CDATA "30"
278                  enabled CDATA "false">
279
280 <!-- cache-helper specifies customizable class which implements CacheHelper interface.
281
282      name Unique name for the helper class; this is referenced in
283                               the cache-mapping elements (see below).
284                               "default" is reserved for the built-in default helper.
285      class-name Fully qualified class name of the cache-helper; this class
286                               must extend the com.sun.appserv.web.CacheHelper class.
287 -->
288 <!ELEMENT cache-helper (property*)>
289 <!ATTLIST cache-helper name CDATA #REQUIRED
290                        class-name CDATA #REQUIRED>
291
292 <!--
293 Default, built-in cache-helper properties
294 -->
295 <!ELEMENT default-helper (property*)>
296
297 <!--
298 cache-mapping element defines what to be cached, the key to be used, any other
299 constraints to be applied and a customizable cache-helper to programmatically
300 hook this information.
301 -->
302 <!ELEMENT cache-mapping ((servlet-name | url-pattern),
303                         (cache-helper-ref |
304                         (timeout?, refresh-field?, http-method*, key-field*, constraint-field*)))>
305
306 <!--
307 servlet-name element defines a named servlet to which this caching is enabled.
308 the specified name must be present in the web application deployment descriptor
309 (web.xml)
310 -->
311 <!ELEMENT servlet-name (#PCDATA)>
312
313 <!--
314 url-pattern element specifies the url pattern to which caching is to be enabled.
315 See Servlet 2.3 specification section SRV. 11.2 for the applicable patterns.
316 -->
317 <!ELEMENT url-pattern (#PCDATA)>
318
319 <!--
320 cache-helper-ref s a reference to the cache-helper used by this cache-mapping
321 -->
322 <!ELEMENT cache-helper-ref (#PCDATA)>
323
324 <!--
325 timeout element defines the cache timeout in seconds applicable for this mapping.
326 default is to use cache object's timeout. The timeout value is specified statically
327 ere (e.g. <timeout> 60 </timeout> or dynamically via fields in the relevant scope.
328
329    name Name of the field where this timeout could be found
330    scope Scope of the field. default scope is request attribute.
331 -->
332 <!ELEMENT timeout (#PCDATA)>
333 <!ATTLIST timeout name CDATA #REQUIRED
334                    scope CDATA 'request.attribute'>
335
336 <!--
337 http-method specifies HTTP method eligible for caching default is GET.
338 -->
339 <!ELEMENT http-method (#PCDATA)>
340
341 <!--
342 specifies the request parameter name that triggers refresh. the cached entry
343 is refreshed when there such a request parameter is set to "true"
344 example:
345 <cache-mapping>
346     <url-pattern> /quote </url-pattern>
347     <refresh-field name="refresh" scope="request.parameter"/>
348 </cache-mapping>
349 -->
350 <!ELEMENT refresh-field EMPTY>
351 <!ATTLIST refresh-field name CDATA #REQUIRED
352                         scope CDATA 'request.parameter'>
353 <!--
354 key-field specifies a component of the key; container looks for the named
355 field in the given scope to access the cached entry. Default is to use
356 the Servlet Path (the path section that corresponds to the servlet mapping
357 which activated this request). See Servlet 2.3 specification section SRV 4.4
358 on Servlet Path.
359
360   name Name of the field to look for in the given scope
361   scope Scope of the field. default scope is request parameter.
362 -->
363 <!ELEMENT key-field EMPTY>
364 <!ATTLIST key-field name CDATA #REQUIRED
365                     scope CDATA 'request.parameter'>
366
367 <!--
368 constraint-field specifies a field whose value is used as a cacheability constraint.
369   
370   name Name of the field to look for in the given scope
371   scope Scope of the field. Default scope is request parameter.
372   cache-on-match Should this constraint check pass, is the response cacheable?
373                            Default is true (i.e. cache the response on success match).
374                            Useful to turn off caching when there is an attribute in the
375                            scope (e.g. don't cache when there is an attribute called UID
376                            in the session.attribute scope).
377   cache-on-match-failure Should the constraint check fail, is response not cacheable?
378                            Default is false (i.e. a failure in enforcing the constraint
379                            would negate caching). Useful to turn on caching when the
380                            an an attribute is not present (e.g. turn on caching
381                            when there is no session or session attribute called UID).
382
383   Example 1: don't cache when there is a session attribute
384   <constraint-field name="UID" scope="session.attribute" cache-on-match="false">
385
386   Example 2: do cache only when there is no session attribute
387   <constraint-field name="UID" scope="session.attribute"
388                     cache-on-match-failure="false">
389 -->
390 <!ELEMENT constraint-field (constraint-field-value*)>
391 <!ATTLIST constraint-field name CDATA #REQUIRED
392                             scope CDATA 'request.parameter'
393                             cache-on-match CDATA 'true'
394                             cache-on-match-failure CDATA 'false'>
395
396 <!--
397 value element specifies the applicable value and a matching expression for a constraint-field
398   match-expr Expression used to match the value. Default is 'equals'.
399
400   Example 1: cache when the category matches with any value other than a specific value
401   <constraint-field name="category" scope="request.parameter>
402     <value match-expr="equals" cache-on-match-failure="true">
403          bogus
404     </value>
405   </constraint-field>
406 -->
407 <!ELEMENT constraint-field-value (#PCDATA)>
408 <!ATTLIST constraint-field-value match-expr CDATA 'equals'
409                             cache-on-match CDATA 'true'
410                             cache-on-match-failure CDATA 'false'>
411
412 <!ELEMENT class-loader EMPTY>
413 <!ATTLIST class-loader extra-class-path CDATA #IMPLIED
414                        delegate CDATA 'true'>
415
416 <!ELEMENT jsp-config (property*)>
417
418 <!ELEMENT locale-charset-info (locale-charset-map+, parameter-encoding?)>
419 <!ATTLIST locale-charset-info default-locale CDATA #REQUIRED>
420
421 <!ELEMENT locale-charset-map (description?)>
422 <!ATTLIST locale-charset-map locale CDATA #REQUIRED
423                              agent CDATA #IMPLIED
424                              charset CDATA #REQUIRED>
425
426 <!ELEMENT parameter-encoding EMPTY>
427 <!ATTLIST parameter-encoding form-hint-field CDATA #IMPLIED
428                  default-charset CDATA #IMPLIED>
429
430 <!--
431 Syntax for supplying properties as name value pairs
432 -->
433 <!ELEMENT property (description?)>
434 <!ATTLIST property name CDATA #REQUIRED
435                    value CDATA #REQUIRED>
436
437 <!ELEMENT description (#PCDATA)>
438
439 <!--
440 This text nodes holds a value string.
441 -->
442 <!ELEMENT value (#PCDATA)>
443
444
445 <!--
446                     W E B S E R V I C E S
447 -->
448 <!--
449 Runtime settings for a web service reference. In the simplest case,
450 there is no runtime information required for a service ref. Runtime info
451 is only needed in the following cases :
452  * to define the port that should be used to resolve a container-managed port
453  * to define default Stub/Call property settings for Stub objects
454  * to define the URL of a final WSDL document to be used instead of
455 the one packaged with a service-ref
456 -->
457 <!ELEMENT service-ref ( service-ref-name, port-info*, call-property*, wsdl-override?, service-impl-class?, service-qname? )>
458
459 <!--
460 Coded name (relative to java:comp/env) for a service-reference
461 -->
462 <!ELEMENT service-ref-name ( #PCDATA )>
463
464 <!--
465 Information for a port within a service-reference.
466
467 Either service-endpoint-interface or wsdl-port or both
468 (service-endpoint-interface and wsdl-port) should be specified.
469
470 If both are specified, wsdl-port represents the
471 port the container should choose for container-managed port selection.
472
473 The same wsdl-port value must not appear in
474 more than one port-info entry within the same service-ref.
475
476 If a particular service-endpoint-interface is using container-managed port
477 selection, it must not appear in more than one port-info entry
478 within the same service-ref.
479
480 -->
481 <!ELEMENT port-info ( service-endpoint-interface?, wsdl-port?, stub-property*, call-property* )>
482
483 <!--
484 Fully qualified name of service endpoint interface
485 -->
486 <!ELEMENT service-endpoint-interface ( #PCDATA )>
487 <!--
488 Port used in port-info.
489 -->
490 <!ELEMENT wsdl-port ( namespaceURI, localpart )>
491
492 <!--
493 JAXRPC property values that should be set on a stub before it's returned to
494 to the web service client. The property names can be any properties supported
495 by the JAXRPC Stub implementation. See javadoc for javax.xml.rpc.Stub
496 -->
497 <!ELEMENT stub-property ( name, value )>
498
499 <!--
500 JAXRPC property values that should be set on a Call object before it's
501 returned to the web service client. The property names can be any
502 properties supported by the JAXRPC Call implementation. See javadoc
503 for javax.xml.rpc.Call
504 -->
505 <!ELEMENT call-property ( name, value )>
506
507 <!--
508 This is a valid URL pointing to a final WSDL document. It is optional.
509 If specified, the WSDL document at this URL will be used during
510 deployment instead of the WSDL document associated with the
511 service-ref in the standard deployment descriptor.
512
513 Examples :
514
515   // available via HTTP
516   <wsdl-override>http://localhost:8000/myservice/myport?WSDL</wsdl-override>
517
518   // in a file
519   <wsdl-override>file:/home/user1/myfinalwsdl.wsdl</wsdl-override>
520
521 -->
522 <!ELEMENT wsdl-override ( #PCDATA )>
523
524 <!--
525 Name of generated service implementation class. This is not set by the
526 deployer. It is derived during deployment.
527 -->
528 <!ELEMENT service-impl-class ( #PCDATA )>
529
530 <!--
531 The service-qname element declares the specific WSDL service
532 element that is being refered to. It is not set by the deployer.
533 It is derived during deployment.
534 -->
535 <!ELEMENT service-qname (namespaceURI, localpart)>
536
537 <!--
538 Runtime information about a web service.
539
540 wsdl-publish-location is optionally used to specify
541 where the final wsdl and any dependent files should be stored. This location
542 resides on the file system from which deployment is initiated.
543
544 -->
545 <!ELEMENT webservice-description ( webservice-description-name, wsdl-publish-location? )>
546
547 <!--
548 Unique name of a webservice within a module
549 -->
550 <!ELEMENT webservice-description-name ( #PCDATA )>
551
552 <!--
553 file: URL of a directory to which a web-service-description's wsdl should be
554 published during deployment. Any required files will be published to this
555 directory, preserving their location relative to the module-specific
556 wsdl directory(META-INF/wsdl or WEB-INF/wsdl).
557
558 Example :
559
560   For an ejb.jar whose webservices.xml wsdl-file element contains
561     META-INF/wsdl/a/Foo.wsdl
562
563   <wsdl-publish-location>file:/home/user1/publish
564   </wsdl-publish-location>
565
566   The final wsdl will be stored in /home/user1/publish/a/Foo.wsdl
567
568 -->
569 <!ELEMENT wsdl-publish-location ( #PCDATA )>
570
571 <!--
572 Information about a web service endpoint.
573 -->
574 <!ELEMENT webservice-endpoint ( port-component-name, endpoint-address-uri?, login-config?, transport-guarantee?, service-qname?, tie-class?, servlet-impl-class? )>
575
576 <!--
577 Unique name of a port component within a module
578 -->
579 <!ELEMENT port-component-name ( #PCDATA )>
580
581 <!--
582 Relative path combined with web server root to form fully qualified
583 endpoint address for a web service endpoint. For servlet endpoints, this
584 value is relative to the servlet's web application context root. In
585 all cases, this value must be a fixed pattern(i.e. no "*" allowed).
586 If the web service endpoint is a servlet that only implements a single
587 endpoint has only one url-pattern, it is not necessary to set
588 this value since the container can derive it from web.xml.
589 -->
590 <!ELEMENT endpoint-address-uri ( #PCDATA )>
591
592 <!--
593 The name of tie implementation class for a port-component. This is
594 not specified by the deployer. It is derived during deployment.
595 -->
596 <!ELEMENT tie-class (#PCDATA)>
597
598 <!--
599 Optional authentication configuration for an EJB web service endpoint.
600 Not needed for servet web service endpoints. Their security configuration
601 is contained in the standard web application descriptor.
602 -->
603 <!ELEMENT login-config ( auth-method )>
604
605 <!--
606 The auth-method element is used to configure the authentication
607 mechanism for the web application. As a prerequisite to gaining access
608 to any web resources which are protected by an authorization
609 constraint, a user must have authenticated using the configured
610 mechanism.
611 -->
612
613 <!ELEMENT auth-method (#PCDATA)>
614
615 <!--
616 Name of application-written servlet impl class contained in deployed war.
617 This is not set by the deployer. It is derived by the container
618 during deployment.
619 -->
620 <!ELEMENT servlet-impl-class (#PCDATA)>
621
622 <!--
623 The transport-guarantee element specifies that the communication
624 between client and server should be NONE, INTEGRAL, or
625 CONFIDENTIAL. NONE means that the application does not require any
626 transport guarantees. A value of INTEGRAL means that the application
627 requires that the data sent between the client and server be sent in
628 such a way that it can't be changed in transit. CONFIDENTIAL means
629 that the application requires that the data be transmitted in a
630 fashion that prevents other entities from observing the contents of
631 the transmission. In most cases, the presence of the INTEGRAL or
632 CONFIDENTIAL flag will indicate that the use of SSL is required.
633 -->
634
635 <!ELEMENT transport-guarantee (#PCDATA)>
636
637 <!--
638 Runtime settings for a web service reference. In the simplest case,
639 there is no runtime information required for a service ref. Runtime info
640 is only needed in the following cases :
641  * to define the port that should be used to resolve a container-managed port
642  * to define default Stub/Call property settings for Stub objects
643  * to define the URL of a final WSDL document to be used instead of
644 the one packaged with a service-ref
645 -->
646
647 <!--
648 The localpart element indicates the local part of a QNAME.
649 -->
650 <!ELEMENT localpart (#PCDATA)>
651
652 <!--
653 The namespaceURI element indicates a URI.
654 -->
655 <!ELEMENT namespaceURI (#PCDATA)>
656
657 */

658
Popular Tags