KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > core > StandardDefaultContext


1
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the "License"). You may not use this file except
7  * in compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * glassfish/bootstrap/legal/CDDLv1.0.txt or
11  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * HEADER in each file and include the License file at
17  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
18  * add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your
20  * own identifying information: Portions Copyright [yyyy]
21  * [name of copyright owner]
22  *
23  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24  *
25  * Portions Copyright Apache Software Foundation.
26  */

27
28
29 package org.apache.catalina.core;
30
31 import java.beans.PropertyChangeListener JavaDoc;
32 import java.beans.PropertyChangeSupport JavaDoc;
33 import java.lang.reflect.Constructor JavaDoc;
34 import java.util.ArrayList JavaDoc;
35 import java.util.Enumeration JavaDoc;
36 import java.util.HashMap JavaDoc;
37 import java.util.Hashtable JavaDoc;
38 import java.util.Vector JavaDoc;
39
40
41 import javax.management.MBeanRegistration JavaDoc;
42 import javax.management.MBeanServer JavaDoc;
43 import javax.management.MalformedObjectNameException JavaDoc;
44 import javax.management.ObjectName JavaDoc;
45 import javax.naming.directory.DirContext JavaDoc;
46  
47 import org.apache.catalina.Container;
48 import org.apache.catalina.Context;
49 import org.apache.catalina.DefaultContext;
50 import org.apache.catalina.Lifecycle;
51 import org.apache.catalina.LifecycleEvent;
52 import org.apache.catalina.LifecycleListener;
53 import org.apache.catalina.Loader;
54 import org.apache.catalina.Manager;
55 import org.apache.catalina.deploy.ApplicationParameter;
56 import org.apache.catalina.deploy.ContextEjb;
57 import org.apache.catalina.deploy.ContextEnvironment;
58 import org.apache.catalina.deploy.ContextResource;
59 import org.apache.catalina.deploy.ContextResourceLink;
60 import org.apache.catalina.deploy.NamingResources;
61 import org.apache.catalina.deploy.ResourceParams;
62 import org.apache.catalina.loader.WebappLoader;
63 import org.apache.catalina.mbeans.MBeanUtils;
64 import org.apache.catalina.util.StringManager;
65 import com.sun.org.apache.commons.modeler.ManagedBean;
66 import com.sun.org.apache.commons.modeler.Registry;
67 import org.apache.naming.ContextAccessController;
68
69 /**
70  * Used to store the default configuration a Host will use
71  * when creating a Context. A Context configured in server.xml
72  * can override these defaults by setting the Context attribute
73  * <CODE>override="true"</CODE>.
74  *
75  * @author Glenn Nielsen
76  * @version $Revision: 1.4 $ $Date: 2006/03/12 01:27:01 $
77  */

78
79 public class StandardDefaultContext
80     implements DefaultContext, LifecycleListener, MBeanRegistration JavaDoc {
81
82
83     // ----------------------------------------------------------- Constructors
84

85
86     /**
87      * Create the DefaultContext
88      */

89     public StandardDefaultContext() {
90
91         namingResources.setContainer(this);
92
93     }
94
95
96     // ----------------------------------------------------- Instance Variables
97

98
99     /**
100      * Contexts we are currently associated with.
101      */

102     private Hashtable JavaDoc contexts = new Hashtable JavaDoc();
103
104
105     /**
106      * The set of application listener class names configured for this
107      * application, in the order they were encountered in the web.xml file.
108      */

109     private String JavaDoc applicationListeners[] = new String JavaDoc[0];
110
111
112     /**
113      * The set of application parameters defined for this application.
114      */

115     private ApplicationParameter applicationParameters[] =
116         new ApplicationParameter[0];
117
118
119     /**
120      * Should we attempt to use cookies for session id communication?
121      */

122     private boolean cookies = true;
123
124
125     /**
126      * Should we allow the <code>ServletContext.getContext()</code> method
127      * to access the context of other web applications in this server?
128      */

129     private boolean crossContext = true;
130
131
132     /**
133      * The descriptive information string for this implementation.
134      */

135     private static final String JavaDoc info =
136         "org.apache.catalina.core.DefaultContext/1.0";
137
138
139     /**
140      * The set of classnames of InstanceListeners that will be added
141      * to each newly created Wrapper by <code>createWrapper()</code>.
142      */

143     private String JavaDoc instanceListeners[] = new String JavaDoc[0];
144
145
146     /**
147      * The Java class name of the default Mapper class for this Container.
148      */

149     private String JavaDoc mapperClass =
150         "org.apache.catalina.core.StandardContextMapper";
151
152
153     /**
154      * The associated naming resources.
155      */

156     private NamingResources namingResources = new NamingResources();
157
158
159     /**
160      * The context initialization parameters for this web application,
161      * keyed by name.
162      */

163     private HashMap JavaDoc parameters = new HashMap JavaDoc();
164
165
166     /**
167      * The reloadable flag for this web application.
168      */

169     private boolean reloadable = false;
170
171
172     /**
173      * The swallowOutput flag for this web application.
174      */

175     private boolean swallowOutput = false;
176
177
178     /**
179      * The set of classnames of LifecycleListeners that will be added
180      * to each newly created Wrapper by <code>createWrapper()</code>.
181      */

182     private String JavaDoc wrapperLifecycles[] = new String JavaDoc[0];
183
184
185     /**
186      * The set of classnames of ContainerListeners that will be added
187      * to each newly created Wrapper by <code>createWrapper()</code>.
188      */

189     private String JavaDoc wrapperListeners[] = new String JavaDoc[0];
190
191
192     /**
193      * Java class name of the Wrapper class implementation we use.
194      */

195     private String JavaDoc wrapperClass = "org.apache.catalina.core.StandardWrapper";
196
197
198     /**
199      * JNDI use flag.
200      */

201     private boolean useNaming = true;
202
203
204     /**
205      * The resources DirContext object with which this Container is
206      * associated.
207      *
208      */

209     DirContext JavaDoc dirContext = null;
210
211
212     /**
213      * The human-readable name of this Container.
214      */

215     protected String JavaDoc name = "defaultContext";
216
217
218     /**
219      * The parent Container to which this Container is a child.
220      */

221     protected Container parent = null;
222
223
224     /**
225      * The Context LifecycleListener's
226      */

227     protected Vector JavaDoc lifecycle = new Vector JavaDoc();
228
229
230     /**
231      * The Loader implementation with which this Container is associated.
232      */

233     protected Loader loader = null;
234
235
236     /**
237      * The Manager implementation with which this Container is associated.
238      */

239     protected Manager manager = null;
240
241
242     /**
243      * Case sensitivity.
244      */

245     protected boolean caseSensitive = true;
246
247
248     /**
249      * Allow linking.
250      */

251     protected boolean allowLinking = false;
252
253
254     /**
255      * Cache max size in KB.
256      */

257     protected int cacheMaxSize = 10240; // 10 MB
258

259
260     /**
261      * Cache TTL in ms.
262      */

263     protected int cacheTTL = 5000;
264
265
266     /**
267      * CachingAllowed.
268      */

269     protected boolean cachingAllowed = true;
270
271
272     /**
273      * Frequency of manager checks.
274      */

275     protected int managerChecksFrequency = 6;
276
277
278     /**
279      * The string manager for this package.
280      */

281     protected static final StringManager sm =
282         StringManager.getManager(Constants.Package);
283
284
285     /**
286      * The property change support for this component.
287      */

288     protected PropertyChangeSupport JavaDoc support = new PropertyChangeSupport JavaDoc(this);
289
290
291     // ----------------------------------------------------- Context Properties
292

293
294     /**
295      * Set case sensitivity.
296      */

297     public void setCaseSensitive(boolean caseSensitive) {
298         this.caseSensitive = caseSensitive;
299     }
300
301
302     /**
303      * Is case sensitive ?
304      */

305     public boolean isCaseSensitive() {
306         return caseSensitive;
307     }
308
309
310     /**
311      * Set allow linking.
312      */

313     public void setAllowLinking(boolean allowLinking) {
314         this.allowLinking = allowLinking;
315     }
316
317
318     /**
319      * Is linking allowed.
320      */

321     public boolean isAllowLinking() {
322         return allowLinking;
323     }
324
325
326     /**
327      * Set cache TTL.
328      */

329     public void setCacheTTL(int cacheTTL) {
330         this.cacheTTL = cacheTTL;
331     }
332
333
334     /**
335      * Get cache TTL.
336      */

337     public int getCacheTTL() {
338         return cacheTTL;
339     }
340
341
342     /**
343      * Return the maximum size of the cache in KB.
344      */

345     public int getCacheMaxSize() {
346         return cacheMaxSize;
347     }
348
349
350     /**
351      * Set the maximum size of the cache in KB.
352      */

353     public void setCacheMaxSize(int cacheMaxSize) {
354         this.cacheMaxSize = cacheMaxSize;
355     }
356
357
358     /**
359      * Set cachingAllowed.
360      */

361     public void setCachingAllowed(boolean cachingAllowed) {
362         this.cachingAllowed = cachingAllowed;
363     }
364
365
366     /**
367      * Is cachingAllowed ?
368      */

369     public boolean isCachingAllowed() {
370         return cachingAllowed;
371     }
372
373
374     /**
375      * Set the manager checks frequency.
376      */

377     public void setManagerChecksFrequency(int managerChecksFrequency) {
378         this.managerChecksFrequency = managerChecksFrequency;
379     }
380
381
382     /**
383      * Get manager checks frquency.
384      */

385     public int getManagerChecksFrequency() {
386         return managerChecksFrequency;
387     }
388  
389
390     /**
391      * Returns true if the internal naming support is used.
392      */

393     public boolean isUseNaming() {
394
395         return (useNaming);
396
397     }
398
399
400     /**
401      * Enables or disables naming.
402      */

403     public void setUseNaming(boolean useNaming) {
404         this.useNaming = useNaming;
405     }
406
407
408     /**
409      * Return the "use cookies for session ids" flag.
410      */

411     public boolean getCookies() {
412
413         return (this.cookies);
414
415     }
416
417
418     /**
419      * Set the "use cookies for session ids" flag.
420      *
421      * @param cookies The new flag
422      */

423     public void setCookies(boolean cookies) {
424         boolean oldCookies = this.cookies;
425         this.cookies = cookies;
426
427     }
428
429
430     /**
431      * Return the "allow crossing servlet contexts" flag.
432      */

433     public boolean getCrossContext() {
434
435         return (this.crossContext);
436
437     }
438
439
440     /**
441      * Set the "allow crossing servlet contexts" flag.
442      *
443      * @param crossContext The new cross contexts flag
444      */

445     public void setCrossContext(boolean crossContext) {
446         boolean oldCrossContext = this.crossContext;
447         this.crossContext = crossContext;
448
449     }
450
451
452     /**
453      * Return descriptive information about this Container implementation and
454      * the corresponding version number, in the format
455      * <code>&lt;description&gt;/&lt;version&gt;</code>.
456      */

457     public String JavaDoc getInfo() {
458
459         return (info);
460
461     }
462
463
464     /**
465      * Return the reloadable flag for this web application.
466      */

467     public boolean getReloadable() {
468
469         return (this.reloadable);
470
471     }
472
473
474     /**
475      * Set the reloadable flag for this web application.
476      *
477      * @param reloadable The new reloadable flag
478      */

479     public void setReloadable(boolean reloadable) {
480         boolean oldReloadable = this.reloadable;
481         this.reloadable = reloadable;
482
483     }
484
485
486     /**
487      * Return the swallowOutput flag for this web application.
488      */

489     public boolean getSwallowOutput() {
490
491         return (this.swallowOutput);
492
493     }
494
495
496     /**
497      * Set the swallowOutput flag for this web application.
498      *
499      * @param swallowOutput The new swallowOutput flag
500      */

501     public void setSwallowOutput(boolean swallowOutput) {
502         boolean oldSwallowOutput = this.swallowOutput;
503         this.swallowOutput = swallowOutput;
504
505     }
506
507
508     /**
509      * Return the Java class name of the Wrapper implementation used
510      * for servlets registered in this Context.
511      */

512     public String JavaDoc getWrapperClass() {
513
514         return (this.wrapperClass);
515
516     }
517
518
519     /**
520      * Set the Java class name of the Wrapper implementation used
521      * for servlets registered in this Context.
522      *
523      * @param wrapperClass The new wrapper class
524      */

525     public void setWrapperClass(String JavaDoc wrapperClass) {
526         this.wrapperClass = wrapperClass;
527
528     }
529
530
531     /**
532      * Set the resources DirContext object with which this Container is
533      * associated.
534      *
535      * @param resources The newly associated DirContext
536      */

537     public void setResources(DirContext JavaDoc resources) {
538         this.dirContext = resources;
539
540     }
541
542     /**
543      * Get the resources DirContext object with which this Container is
544      * associated.
545      *
546      * @param resources The new associated DirContext
547      */

548     public DirContext JavaDoc getResources() {
549
550         return this.dirContext;
551
552     }
553
554
555     /**
556      * Return the Loader with which this Container is associated. If there is
557      * no associated Loader return <code>null</code>.
558      */

559     public Loader getLoader() {
560
561         return loader;
562
563     }
564
565
566     /**
567      * Set the Loader with which this Context is associated.
568      *
569      * @param loader The newly associated loader
570      */

571     public void setLoader(Loader loader) {
572         Loader oldLoader = this.loader;
573         this.loader = loader;
574
575         // Report this property change to interested listeners
576
support.firePropertyChange("loader", oldLoader, this.loader);
577     }
578
579
580     /**
581      * Return the Manager with which this Container is associated. If there is
582      * no associated Manager return <code>null</code>.
583      */

584     public Manager getManager() {
585
586         return manager;
587
588     }
589
590
591     /**
592      * Set the Manager with which this Container is associated.
593      *
594      * @param manager The newly associated Manager
595      */

596     public void setManager(Manager manager) {
597         Manager oldManager = this.manager;
598         this.manager = manager;
599         
600         // Report this property change to interested listeners
601
support.firePropertyChange("manager", oldManager, this.manager);
602     }
603
604
605     // ------------------------------------------------------ Lifecycle Methods
606

607
608     /**
609      * Add a lifecycle event listener to this component.
610      *
611      * @param listener The listener to add
612      */

613     public void addLifecycleListener(LifecycleListener listener) {
614         lifecycle.add(listener);
615     }
616
617
618     // ------------------------------------------------------ Public Properties
619

620     /**
621      * The name of this DefaultContext
622      */

623
624     public String JavaDoc getName() {
625         return (this.name);
626     }
627
628     public void setName(String JavaDoc name) {
629         this.name = name;
630     }
631
632
633     /**
634      * Return the Container for which this Container is a child, if there is
635      * one. If there is no defined parent, return <code>null</code>.
636      */

637     public Container getParent() {
638
639         return (parent);
640
641     }
642
643
644     /**
645      * Set the parent Container to which this Container is being added as a
646      * child. This Container may refuse to become attached to the specified
647      * Container by throwing an exception.
648      *
649      * @param container Container to which this Container is being added
650      * as a child
651      *
652      * @exception IllegalArgumentException if this Container refuses to become
653      * attached to the specified Container
654      */

655     public void setParent(Container container) {
656         Container oldParent = this.parent;
657         this.parent = container;
658         support.firePropertyChange("parent", oldParent, this.parent);
659
660     }
661
662     // -------------------------------------------------------- Context Methods
663

664
665     /**
666      * Add a new Listener class name to the set of Listeners
667      * configured for this application.
668      *
669      * @param listener Java class name of a listener class
670      */

671     public void addApplicationListener(String JavaDoc listener) {
672
673         synchronized (applicationListeners) {
674             String JavaDoc results[] =new String JavaDoc[applicationListeners.length + 1];
675             for (int i = 0; i < applicationListeners.length; i++)
676                 results[i] = applicationListeners[i];
677             results[applicationListeners.length] = listener;
678             applicationListeners = results;
679         }
680
681     }
682
683
684     /**
685      * Add a new application parameter for this application.
686      *
687      * @param parameter The new application parameter
688      */

689     public void addApplicationParameter(ApplicationParameter parameter) {
690
691         synchronized (applicationParameters) {
692             ApplicationParameter results[] =
693                 new ApplicationParameter[applicationParameters.length + 1];
694             System.arraycopy(applicationParameters, 0, results, 0,
695                              applicationParameters.length);
696             results[applicationParameters.length] = parameter;
697             applicationParameters = results;
698         }
699
700     }
701
702
703     /**
704      * Add an EJB resource reference for this web application.
705      *
706      * @param ejb New EJB resource reference
707      */

708     public void addEjb(ContextEjb ejb) {
709
710         namingResources.addEjb(ejb);
711
712     }
713
714
715     /**
716      * Add an environment entry for this web application.
717      *
718      * @param environment New environment entry
719      */

720     public void addEnvironment(ContextEnvironment environment) {
721
722         namingResources.addEnvironment(environment);
723
724     }
725
726
727     /**
728      * Add resource parameters for this web application.
729      *
730      * @param resourceParameters New resource parameters
731      */

732     public void addResourceParams(ResourceParams resourceParameters) {
733
734         namingResources.addResourceParams(resourceParameters);
735
736     }
737
738
739     /**
740      * Add the classname of an InstanceListener to be added to each
741      * Wrapper appended to this Context.
742      *
743      * @param listener Java class name of an InstanceListener class
744      */

745     public void addInstanceListener(String JavaDoc listener) {
746
747         synchronized (instanceListeners) {
748             String JavaDoc results[] =new String JavaDoc[instanceListeners.length + 1];
749             for (int i = 0; i < instanceListeners.length; i++)
750                 results[i] = instanceListeners[i];
751             results[instanceListeners.length] = listener;
752             instanceListeners = results;
753         }
754
755     }
756
757
758     /**
759      * Add a new context initialization parameter, replacing any existing
760      * value for the specified name.
761      *
762      * @param name Name of the new parameter
763      * @param value Value of the new parameter
764      *
765      * @exception IllegalArgumentException if the name or value is missing,
766      * or if this context initialization parameter has already been
767      * registered
768      */

769     public void addParameter(String JavaDoc name, String JavaDoc value) {
770         // Validate the proposed context initialization parameter
771
if ((name == null) || (value == null))
772             throw new IllegalArgumentException JavaDoc
773                 (sm.getString("standardContext.parameter.required"));
774         if (parameters.get(name) != null)
775             throw new IllegalArgumentException JavaDoc
776                 (sm.getString("standardContext.parameter.duplicate", name));
777
778         // Add this parameter to our defined set
779
synchronized (parameters) {
780             parameters.put(name, value);
781         }
782
783     }
784
785
786     /**
787      * Add a property change listener to this component.
788      *
789      * @param listener The listener to add
790      */

791     public void addPropertyChangeListener(PropertyChangeListener JavaDoc listener) {
792
793         support.addPropertyChangeListener(listener);
794
795     }
796     
797     
798     /**
799      * Add a resource reference for this web application.
800      *
801      * @param resource New resource reference
802      */

803     public void addResource(ContextResource resource) {
804
805         namingResources.addResource(resource);
806
807     }
808
809
810     /**
811      * Add a resource environment reference for this web application.
812      *
813      * @param name The resource environment reference name
814      * @param type The resource environment reference type
815      */

816     public void addResourceEnvRef(String JavaDoc name, String JavaDoc type) {
817
818         namingResources.addResourceEnvRef(name, type);
819
820     }
821
822
823     /**
824      * Add a resource link for this web application.
825      *
826      * @param resource New resource link
827      */

828     public void addResourceLink(ContextResourceLink resourceLink) {
829
830         namingResources.addResourceLink(resourceLink);
831
832     }
833
834
835     /**
836      * Add the classname of a LifecycleListener to be added to each
837      * Wrapper appended to this Context.
838      *
839      * @param listener Java class name of a LifecycleListener class
840      */

841     public void addWrapperLifecycle(String JavaDoc listener) {
842
843         synchronized (wrapperLifecycles) {
844             String JavaDoc results[] =new String JavaDoc[wrapperLifecycles.length + 1];
845             for (int i = 0; i < wrapperLifecycles.length; i++)
846                 results[i] = wrapperLifecycles[i];
847             results[wrapperLifecycles.length] = listener;
848             wrapperLifecycles = results;
849         }
850
851     }
852
853
854     /**
855      * Add the classname of a ContainerListener to be added to each
856      * Wrapper appended to this Context.
857      *
858      * @param listener Java class name of a ContainerListener class
859      */

860     public void addWrapperListener(String JavaDoc listener) {
861
862         synchronized (wrapperListeners) {
863             String JavaDoc results[] =new String JavaDoc[wrapperListeners.length + 1];
864             for (int i = 0; i < wrapperListeners.length; i++)
865                 results[i] = wrapperListeners[i];
866             results[wrapperListeners.length] = listener;
867             wrapperListeners = results;
868         }
869
870     }
871
872
873     /**
874      * Return the set of application listener class names configured
875      * for this application.
876      */

877     public String JavaDoc[] findApplicationListeners() {
878
879         return (applicationListeners);
880
881     }
882
883
884     /**
885      * Return the set of application parameters for this application.
886      */

887     public ApplicationParameter[] findApplicationParameters() {
888
889         return (applicationParameters);
890
891     }
892
893
894     /**
895      * Return the EJB resource reference with the specified name, if any;
896      * otherwise, return <code>null</code>.
897      *
898      * @param name Name of the desired EJB resource reference
899      */

900     public ContextEjb findEjb(String JavaDoc name) {
901
902         return namingResources.findEjb(name);
903
904     }
905
906
907     /**
908      * Return the defined EJB resource references for this application.
909      * If there are none, a zero-length array is returned.
910      */

911     public ContextEjb[] findEjbs() {
912
913         return namingResources.findEjbs();
914
915     }
916
917
918     /**
919      * Return the environment entry with the specified name, if any;
920      * otherwise, return <code>null</code>.
921      *
922      * @param name Name of the desired environment entry
923      */

924     public ContextEnvironment findEnvironment(String JavaDoc name) {
925
926         return namingResources.findEnvironment(name);
927
928     }
929
930
931     /**
932      * Return the set of defined environment entries for this web
933      * application. If none have been defined, a zero-length array
934      * is returned.
935      */

936     public ContextEnvironment[] findEnvironments() {
937
938         return namingResources.findEnvironments();
939
940     }
941
942
943     /**
944      * Return the set of defined resource parameters for this web
945      * application. If none have been defined, a zero-length array
946      * is returned.
947      */

948     public ResourceParams[] findResourceParams() {
949
950         return namingResources.findResourceParams();
951
952     }
953
954
955     /**
956      * Return the set of InstanceListener classes that will be added to
957      * newly created Wrappers automatically.
958      */

959     public String JavaDoc[] findInstanceListeners() {
960
961         return (instanceListeners);
962
963     }
964
965
966     /**
967      * Return the value for the specified context initialization
968      * parameter name, if any; otherwise return <code>null</code>.
969      *
970      * @param name Name of the parameter to return
971      */

972     public String JavaDoc findParameter(String JavaDoc name) {
973
974         synchronized (parameters) {
975             return ((String JavaDoc) parameters.get(name));
976         }
977
978     }
979
980
981     /**
982      * Return the names of all defined context initialization parameters
983      * for this Context. If no parameters are defined, a zero-length
984      * array is returned.
985      */

986     public String JavaDoc[] findParameters() {
987
988         synchronized (parameters) {
989             String JavaDoc results[] = new String JavaDoc[parameters.size()];
990             return ((String JavaDoc[]) parameters.keySet().toArray(results));
991         }
992
993     }
994
995
996     /**
997      * Return the resource reference with the specified name, if any;
998      * otherwise return <code>null</code>.
999      *
1000     * @param name Name of the desired resource reference
1001     */

1002    public ContextResource findResource(String JavaDoc name) {
1003
1004        return namingResources.findResource(name);
1005
1006    }
1007
1008
1009    /**
1010     * Return the resource environment reference type for the specified
1011     * name, if any; otherwise return <code>null</code>.
1012     *
1013     * @param name Name of the desired resource environment reference
1014     */

1015    public String JavaDoc findResourceEnvRef(String JavaDoc name) {
1016
1017        return namingResources.findResourceEnvRef(name);
1018
1019    }
1020
1021
1022    /**
1023     * Return the set of resource environment reference names for this
1024     * web application. If none have been specified, a zero-length
1025     * array is returned.
1026     */

1027    public String JavaDoc[] findResourceEnvRefs() {
1028
1029        return namingResources.findResourceEnvRefs();
1030
1031    }
1032
1033
1034    /**
1035     * Return the resource link with the specified name, if any;
1036     * otherwise return <code>null</code>.
1037     *
1038     * @param name Name of the desired resource link
1039     */

1040    public ContextResourceLink findResourceLink(String JavaDoc name) {
1041
1042        return namingResources.findResourceLink(name);
1043
1044    }
1045
1046
1047    /**
1048     * Return the defined resource links for this application. If
1049     * none have been defined, a zero-length array is returned.
1050     */

1051    public ContextResourceLink[] findResourceLinks() {
1052
1053        return namingResources.findResourceLinks();
1054
1055    }
1056
1057
1058    /**
1059     * Return the defined resource references for this application. If
1060     * none have been defined, a zero-length array is returned.
1061     */

1062    public ContextResource[] findResources() {
1063
1064        return namingResources.findResources();
1065
1066    }
1067
1068
1069    /**
1070     * Return the set of LifecycleListener classes that will be added to
1071     * newly created Wrappers automatically.
1072     */

1073    public String JavaDoc[] findWrapperLifecycles() {
1074
1075        return (wrapperLifecycles);
1076
1077    }
1078
1079
1080    /**
1081     * Return the set of ContainerListener classes that will be added to
1082     * newly created Wrappers automatically.
1083     */

1084    public String JavaDoc[] findWrapperListeners() {
1085
1086        return (wrapperListeners);
1087
1088    }
1089
1090
1091    /**
1092     * Return the naming resources associated with this web application.
1093     */

1094    public NamingResources getNamingResources() {
1095
1096        return (this.namingResources);
1097
1098    }
1099
1100
1101    /**
1102     * Remove the specified application listener class from the set of
1103     * listeners for this application.
1104     *
1105     * @param listener Java class name of the listener to be removed
1106     */

1107    public void removeApplicationListener(String