KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > DefaultContext


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;
30
31 import java.beans.PropertyChangeListener JavaDoc;
32 import javax.naming.directory.DirContext JavaDoc;
33 import org.apache.catalina.deploy.ApplicationParameter;
34 import org.apache.catalina.deploy.ContextEjb;
35 import org.apache.catalina.deploy.ContextEnvironment;
36 import org.apache.catalina.deploy.ContextResource;
37 import org.apache.catalina.deploy.ContextResourceLink;
38 import org.apache.catalina.deploy.NamingResources;
39 import org.apache.catalina.deploy.ResourceParams;
40
41
42 /**
43  * Used to store the default configuration a Host will use
44  * when creating a Context. A Context configured in server.xml
45  * can override these defaults by setting the Context attribute
46  * <CODE>override="true"</CODE>.
47  *
48  * @author Glenn Nielsen
49  * @author Remy Maucherat
50  * @version $Revision: 1.2 $ $Date: 2005/12/08 01:27:15 $
51  */

52
53 public interface DefaultContext {
54
55
56     // ------------------------------------------------------------- Properties
57

58
59     /**
60      * Return the "use cookies for session ids" flag.
61      */

62     public boolean getCookies();
63
64
65     /**
66      * Set the "use cookies for session ids" flag.
67      *
68      * @param cookies The new flag
69      */

70     public void setCookies(boolean cookies);
71
72
73     /**
74      * Return the "allow crossing servlet contexts" flag.
75      */

76     public boolean getCrossContext();
77
78
79     /**
80      * Set the "allow crossing servlet contexts" flag.
81      *
82      * @param crossContext The new cross contexts flag
83      */

84     public void setCrossContext(boolean crossContext);
85
86
87     /**
88      * Return descriptive information about this Container implementation and
89      * the corresponding version number, in the format
90      * <code>&lt;description&gt;/&lt;version&gt;</code>.
91      */

92     public String JavaDoc getInfo();
93
94
95     /**
96      * Return the reloadable flag for this web application.
97      */

98     public boolean getReloadable();
99
100
101     /**
102      * Set the reloadable flag for this web application.
103      *
104      * @param reloadable The new reloadable flag
105      */

106     public void setReloadable(boolean reloadable);
107
108
109     /**
110      * Return the Java class name of the Wrapper implementation used
111      * for servlets registered in this Context.
112      */

113     public String JavaDoc getWrapperClass();
114
115
116     /**
117      * Set the Java class name of the Wrapper implementation used
118      * for servlets registered in this Context.
119      *
120      * @param wrapperClass The new wrapper class
121      */

122     public void setWrapperClass(String JavaDoc wrapperClass);
123
124
125     /**
126      * Set the resources DirContext object with which this Container is
127      * associated.
128      *
129      * @param resources The newly associated DirContext
130      */

131     public void setResources(DirContext JavaDoc resources);
132
133
134     /**
135      * Get the resources DirContext object with which this Container is
136      * associated.
137      *
138      * @param resources The new associated DirContext
139      */

140     public DirContext JavaDoc getResources();
141
142
143     /**
144      * Return the Loader with which this Container is associated. If there is
145      * no associated Loader return <code>null</code>.
146      */

147     public Loader getLoader();
148
149
150     /**
151      * Set the Loader with which this Context is associated.
152      *
153      * @param loader The newly associated loader
154      */

155     public void setLoader(Loader loader);
156
157
158     /**
159      * Return the Manager with which this Container is associated. If there is
160      * no associated Manager return <code>null</code>.
161      */

162     public Manager getManager();
163
164
165     /**
166      * Set the Manager with which this Container is associated.
167      *
168      * @param manager The newly associated Manager
169      */

170     public void setManager(Manager manager);
171
172
173     /**
174      * Return the naming resources associated with this web application.
175      */

176     public NamingResources getNamingResources();
177     
178     
179     // ------------------------------------------------------ Public Properties
180

181
182     /**
183      * Return the name of this DefaultContext
184      */

185     public String JavaDoc getName();
186
187
188     /**
189      * Set the name of the default context.
190      *
191      * @param name The new name
192      */

193     public void setName(String JavaDoc name);
194
195
196     /**
197      * Return the Container for which this Container is a child, if there is
198      * one. If there is no defined parent, return <code>null</code>.
199      */

200     public Container getParent();
201
202
203     /**
204      * Set the parent Container to which this Container is being added as a
205      * child. This Container may refuse to become attached to the specified
206      * Container by throwing an exception.
207      *
208      * @param container Container to which this Container is being added
209      * as a child
210      *
211      * @exception IllegalArgumentException if this Container refuses to become
212      * attached to the specified Container
213      */

214     public void setParent(Container container);
215
216
217     // -------------------------------------------------------- Context Methods
218

219
220     /**
221      * Add a new Listener class name to the set of Listeners
222      * configured for this application.
223      *
224      * @param listener Java class name of a listener class
225      */

226     public void addApplicationListener(String JavaDoc listener);
227
228
229     /**
230      * Add a new application parameter for this application.
231      *
232      * @param parameter The new application parameter
233      */

234     public void addApplicationParameter(ApplicationParameter parameter);
235
236
237     /**
238      * Add an EJB resource reference for this web application.
239      *
240      * @param ejb New EJB resource reference
241      */

242     public void addEjb(ContextEjb ejb);
243
244
245     /**
246      * Add an environment entry for this web application.
247      *
248      * @param environment New environment entry
249      */

250     public void addEnvironment(ContextEnvironment environment);
251
252
253     /**
254      * Add resource parameters for this web application.
255      *
256      * @param resourceParameters New resource parameters
257      */

258     public void addResourceParams(ResourceParams resourceParameters);
259
260
261     /**
262      * Add the classname of an InstanceListener to be added to each
263      * Wrapper appended to this Context.
264      *
265      * @param listener Java class name of an InstanceListener class
266      */

267     public void addInstanceListener(String JavaDoc listener);
268
269
270     /**
271      * Add a new context initialization parameter, replacing any existing
272      * value for the specified name.
273      *
274      * @param name Name of the new parameter
275      * @param value Value of the new parameter
276      *
277      * @exception IllegalArgumentException if the name or value is missing,
278      * or if this context initialization parameter has already been
279      * registered
280      */

281     public void addParameter(String JavaDoc name, String JavaDoc value);
282
283
284     /**
285      * Add a property change listener to this component.
286      *
287      * @param listener The listener to add
288      */

289     public void addPropertyChangeListener(PropertyChangeListener JavaDoc listener);
290
291
292     /**
293      * Add a resource reference for this web application.
294      *
295      * @param resource New resource reference
296      */

297     public void addResource(ContextResource resource);
298
299
300     /**
301      * Add a resource environment reference for this web application.
302      *
303      * @param name The resource environment reference name
304      * @param type The resource environment reference type
305      */

306     public void addResourceEnvRef(String JavaDoc name, String JavaDoc type);
307
308
309     /**
310      * Add a resource link for this web application.
311      *
312      * @param resource New resource link
313      */

314     public void addResourceLink(ContextResourceLink resourceLink);
315
316
317     /**
318      * Add the classname of a LifecycleListener to be added to each
319      * Wrapper appended to this Context.
320      *
321      * @param listener Java class name of a LifecycleListener class
322      */

323     public void addWrapperLifecycle(String JavaDoc listener);
324
325
326     /**
327      * Add the classname of a ContainerListener to be added to each
328      * Wrapper appended to this Context.
329      *
330      * @param listener Java class name of a ContainerListener class
331      */

332     public void addWrapperListener(String JavaDoc listener);
333
334
335     /**
336      * Return the set of application listener class names configured
337      * for this application.
338      */

339     public String JavaDoc[] findApplicationListeners();
340
341
342     /**
343      * Return the set of application parameters for this application.
344      */

345     public ApplicationParameter[] findApplicationParameters();
346
347
348     /**
349      * Return the EJB resource reference with the specified name, if any;
350      * otherwise, return <code>null</code>.
351      *
352      * @param name Name of the desired EJB resource reference
353      */

354     public ContextEjb findEjb(String JavaDoc name);
355
356
357     /**
358      * Return the defined EJB resource references for this application.
359      * If there are none, a zero-length array is returned.
360      */

361     public ContextEjb[] findEjbs();
362
363
364     /**
365      * Return the environment entry with the specified name, if any;
366      * otherwise, return <code>null</code>.
367      *
368      * @param name Name of the desired environment entry
369      */

370     public ContextEnvironment findEnvironment(String JavaDoc name);
371
372
373     /**
374      * Return the set of defined environment entries for this web
375      * application. If none have been defined, a zero-length array
376      * is returned.
377      */

378     public ContextEnvironment[] findEnvironments();
379
380
381     /**
382      * Return the set of defined resource parameters for this web
383      * application. If none have been defined, a zero-length array
384      * is returned.
385      */

386     public ResourceParams[] findResourceParams();
387
388
389     /**
390      * Return the set of InstanceListener classes that will be added to
391      * newly created Wrappers automatically.
392      */

393     public String JavaDoc[] findInstanceListeners();
394
395
396     /**
397      * Return the value for the specified context initialization
398      * parameter name, if any; otherwise return <code>null</code>.
399      *
400      * @param name Name of the parameter to return
401      */

402     public String JavaDoc findParameter(String JavaDoc name);
403
404
405     /**
406      * Return the names of all defined context initialization parameters
407      * for this Context. If no parameters are defined, a zero-length
408      * array is returned.
409      */

410     public String JavaDoc[] findParameters();
411
412
413     /**
414      * Return the resource reference with the specified name, if any;
415      * otherwise return <code>null</code>.
416      *
417      * @param name Name of the desired resource reference
418      */

419     public ContextResource findResource(String JavaDoc name);
420
421
422     /**
423      * Return the resource environment reference type for the specified
424      * name, if any; otherwise return <code>null</code>.
425      *
426      * @param name Name of the desired resource environment reference
427      */

428     public String JavaDoc findResourceEnvRef(String JavaDoc name);
429
430
431     /**
432      * Return the set of resource environment reference names for this
433      * web application. If none have been specified, a zero-length
434      * array is returned.
435      */

436     public String JavaDoc[] findResourceEnvRefs();
437
438
439     /**
440      * Return the resource link with the specified name, if any;
441      * otherwise return <code>null</code>.
442      *
443      * @param name Name of the desired resource link
444      */

445     public ContextResourceLink findResourceLink(String JavaDoc name);
446
447
448     /**
449      * Return the defined resource links for this application. If
450      * none have been defined, a zero-length array is returned.
451      */

452     public ContextResourceLink[] findResourceLinks();
453
454
455     /**
456      * Return the defined resource references for this application. If
457      * none have been defined, a zero-length array is returned.
458      */

459     public ContextResource[] findResources();
460
461
462     /**
463      * Return the set of LifecycleListener classes that will be added to
464      * newly created Wrappers automatically.
465      */

466     public String JavaDoc[] findWrapperLifecycles();
467
468
469     /**
470      * Return the set of ContainerListener classes that will be added to
471      * newly created Wrappers automatically.
472      */

473     public String JavaDoc[] findWrapperListeners();
474
475
476     /**
477      * Remove the specified application listener class from the set of
478      * listeners for this application.
479      *
480      * @param listener Java class name of the listener to be removed
481      */

482     public void removeApplicationListener(String JavaDoc listener);
483
484
485     /**
486      * Remove the application parameter with the specified name from
487      * the set for this application.
488      *
489      * @param name Name of the application parameter to remove
490      */

491     public void removeApplicationParameter(String JavaDoc name);
492
493
494     /**
495      * Remove any EJB resource reference with the specified name.
496      *
497      * @param name Name of the EJB resource reference to remove
498      */

499     public void removeEjb(String JavaDoc name);
500
501
502     /**
503      * Remove any environment entry with the specified name.
504      *
505      * @param name Name of the environment entry to remove
506      */

507     public void removeEnvironment(String JavaDoc name);
508
509
510     /**
511      * Remove a class name from the set of InstanceListener classes that
512      * will be added to newly created Wrappers.
513      *
514      * @param listener Class name of an InstanceListener class to be removed
515      */

516     public void removeInstanceListener(String JavaDoc listener);
517
518
519     /**
520      * Remove the context initialization parameter with the specified
521      * name, if it exists; otherwise, no action is taken.
522      *
523      * @param name Name of the parameter to remove
524      */

525     public void removeParameter(String JavaDoc name);
526
527     
528     /**
529      * Remove a property change listener from this component.
530      *
531      * @param listener The listener to remove
532      */

533     public void removePropertyChangeListener(PropertyChangeListener JavaDoc listener);
534
535
536     /**
537      * Remove any resource reference with the specified name.
538      *
539      * @param name Name of the resource reference to remove
540      */

541     public void removeResource(String JavaDoc name);
542
543
544     /**
545      * Remove any resource environment reference with the specified name.
546      *
547      * @param name Name of the resource environment reference to remove
548      */

549     public void removeResourceEnvRef(String JavaDoc name);
550
551
552     /**
553      * Remove any resource link with the specified name.
554      *
555      * @param name Name of the resource link to remove
556      */

557     public void removeResourceLink(String JavaDoc name);
558
559
560     /**
561      * Remove a class name from the set of LifecycleListener classes that
562      * will be added to newly created Wrappers.
563      *
564      * @param listener Class name of a LifecycleListener class to be removed
565      */

566     public void removeWrapperLifecycle(String JavaDoc listener);
567
568
569     /**
570      * Remove a class name from the set of ContainerListener classes that
571      * will be added to newly created Wrappers.
572      *
573      * @param listener Class name of a ContainerListener class to be removed
574      */

575     public void removeWrapperListener(String JavaDoc listener);
576
577
578     // --------------------------------------------------------- Public Methods
579

580
581     /**
582      * Import the configuration from the DefaultContext into
583      * current Context.
584      *
585      * @param context current web application context
586      */

587     public void importDefaultContext(Context context);
588
589
590 }
591
Popular Tags