001: /*
002: * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/DefaultContext.java,v 1.2 2001/11/09 19:34:21 remm Exp $
003: * $Revision: 1.2 $
004: * $Date: 2001/11/09 19:34:21 $
005: *
006: * ====================================================================
007: *
008: * The Apache Software License, Version 1.1
009: *
010: * Copyright (c) 1999 The Apache Software Foundation. All rights
011: * reserved.
012: *
013: * Redistribution and use in source and binary forms, with or without
014: * modification, are permitted provided that the following conditions
015: * are met:
016: *
017: * 1. Redistributions of source code must retain the above copyright
018: * notice, this list of conditions and the following disclaimer.
019: *
020: * 2. Redistributions in binary form must reproduce the above copyright
021: * notice, this list of conditions and the following disclaimer in
022: * the documentation and/or other materials provided with the
023: * distribution.
024: *
025: * 3. The end-user documentation included with the redistribution, if
026: * any, must include the following acknowlegement:
027: * "This product includes software developed by the
028: * Apache Software Foundation (http://www.apache.org/)."
029: * Alternately, this acknowlegement may appear in the software itself,
030: * if and wherever such third-party acknowlegements normally appear.
031: *
032: * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
033: * Foundation" must not be used to endorse or promote products derived
034: * from this software without prior written permission. For written
035: * permission, please contact apache@apache.org.
036: *
037: * 5. Products derived from this software may not be called "Apache"
038: * nor may "Apache" appear in their names without prior written
039: * permission of the Apache Group.
040: *
041: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
042: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
043: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
044: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
045: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
046: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
047: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
048: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
049: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
050: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
051: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
052: * SUCH DAMAGE.
053: * ====================================================================
054: *
055: * This software consists of voluntary contributions made by many
056: * individuals on behalf of the Apache Software Foundation. For more
057: * information on the Apache Software Foundation, please see
058: * <http://www.apache.org/>.
059: *
060: * [Additional notices, if required by prior licensing conditions]
061: *
062: */
063:
064: package org.apache.catalina;
065:
066: import javax.naming.directory.DirContext;
067: import org.apache.catalina.deploy.ApplicationParameter;
068: import org.apache.catalina.deploy.ContextEjb;
069: import org.apache.catalina.deploy.ContextEnvironment;
070: import org.apache.catalina.deploy.ContextResource;
071: import org.apache.catalina.deploy.ContextResourceLink;
072: import org.apache.catalina.deploy.ResourceParams;
073:
074: /**
075: * Used to store the default configuration a Host will use
076: * when creating a Context. A Context configured in server.xml
077: * can override these defaults by setting the Context attribute
078: * <CODE>override="true"</CODE>.
079: *
080: * @author Glenn Nielsen
081: * @author Remy Maucherat
082: * @version $Revision: 1.2 $ $Date: 2001/11/09 19:34:21 $
083: */
084:
085: public interface DefaultContext {
086:
087: // ------------------------------------------------------------- Properties
088:
089: /**
090: * Returns true if the internal naming support is used.
091: */
092: public boolean isUseNaming();
093:
094: /**
095: * Enables or disables naming.
096: */
097: public void setUseNaming(boolean useNaming);
098:
099: /**
100: * Return the "use cookies for session ids" flag.
101: */
102: public boolean getCookies();
103:
104: /**
105: * Set the "use cookies for session ids" flag.
106: *
107: * @param cookies The new flag
108: */
109: public void setCookies(boolean cookies);
110:
111: /**
112: * Return the "allow crossing servlet contexts" flag.
113: */
114: public boolean getCrossContext();
115:
116: /**
117: * Set the "allow crossing servlet contexts" flag.
118: *
119: * @param crossContext The new cross contexts flag
120: */
121: public void setCrossContext(boolean crossContext);
122:
123: /**
124: * Return descriptive information about this Container implementation and
125: * the corresponding version number, in the format
126: * <code><description>/<version></code>.
127: */
128: public String getInfo();
129:
130: /**
131: * Return the reloadable flag for this web application.
132: */
133: public boolean getReloadable();
134:
135: /**
136: * Set the reloadable flag for this web application.
137: *
138: * @param reloadable The new reloadable flag
139: */
140: public void setReloadable(boolean reloadable);
141:
142: /**
143: * Return the Java class name of the Wrapper implementation used
144: * for servlets registered in this Context.
145: */
146: public String getWrapperClass();
147:
148: /**
149: * Set the Java class name of the Wrapper implementation used
150: * for servlets registered in this Context.
151: *
152: * @param wrapperClass The new wrapper class
153: */
154: public void setWrapperClass(String wrapperClass);
155:
156: /**
157: * Set the resources DirContext object with which this Container is
158: * associated.
159: *
160: * @param resources The newly associated DirContext
161: */
162: public void setResources(DirContext resources);
163:
164: /**
165: * Get the resources DirContext object with which this Container is
166: * associated.
167: *
168: * @param resources The new associated DirContext
169: */
170: public DirContext getResources();
171:
172: /**
173: * Return the Loader with which this Container is associated. If there is
174: * no associated Loader return <code>null</code>.
175: */
176: public Loader getLoader();
177:
178: /**
179: * Set the Loader with which this Context is associated.
180: *
181: * @param loader The newly associated loader
182: */
183: public void setLoader(Loader loader);
184:
185: /**
186: * Return the Manager with which this Container is associated. If there is
187: * no associated Manager return <code>null</code>.
188: */
189: public Manager getManager();
190:
191: /**
192: * Set the Manager with which this Container is associated.
193: *
194: * @param manager The newly associated Manager
195: */
196: public void setManager(Manager manager);
197:
198: // ------------------------------------------------------ Public Properties
199:
200: /**
201: * Return the name of this DefaultContext
202: */
203: public String getName();
204:
205: /**
206: * Set the name of the default context.
207: *
208: * @param name The new name
209: */
210: public void setName(String name);
211:
212: /**
213: * Return the Container for which this Container is a child, if there is
214: * one. If there is no defined parent, return <code>null</code>.
215: */
216: public Container getParent();
217:
218: /**
219: * Set the parent Container to which this Container is being added as a
220: * child. This Container may refuse to become attached to the specified
221: * Container by throwing an exception.
222: *
223: * @param container Container to which this Container is being added
224: * as a child
225: *
226: * @exception IllegalArgumentException if this Container refuses to become
227: * attached to the specified Container
228: */
229: public void setParent(Container container);
230:
231: // -------------------------------------------------------- Context Methods
232:
233: /**
234: * Add a new Listener class name to the set of Listeners
235: * configured for this application.
236: *
237: * @param listener Java class name of a listener class
238: */
239: public void addApplicationListener(String listener);
240:
241: /**
242: * Add a new application parameter for this application.
243: *
244: * @param parameter The new application parameter
245: */
246: public void addApplicationParameter(ApplicationParameter parameter);
247:
248: /**
249: * Add an EJB resource reference for this web application.
250: *
251: * @param ejb New EJB resource reference
252: */
253: public void addEjb(ContextEjb ejb);
254:
255: /**
256: * Add an environment entry for this web application.
257: *
258: * @param environment New environment entry
259: */
260: public void addEnvironment(ContextEnvironment environment);
261:
262: /**
263: * Add resource parameters for this web application.
264: *
265: * @param resourceParameters New resource parameters
266: */
267: public void addResourceParams(ResourceParams resourceParameters);
268:
269: /**
270: * Add the classname of an InstanceListener to be added to each
271: * Wrapper appended to this Context.
272: *
273: * @param listener Java class name of an InstanceListener class
274: */
275: public void addInstanceListener(String listener);
276:
277: /**
278: * Add a new context initialization parameter, replacing any existing
279: * value for the specified name.
280: *
281: * @param name Name of the new parameter
282: * @param value Value of the new parameter
283: *
284: * @exception IllegalArgumentException if the name or value is missing,
285: * or if this context initialization parameter has already been
286: * registered
287: */
288: public void addParameter(String name, String value);
289:
290: /**
291: * Add a resource reference for this web application.
292: *
293: * @param resource New resource reference
294: */
295: public void addResource(ContextResource resource);
296:
297: /**
298: * Add a resource environment reference for this web application.
299: *
300: * @param name The resource environment reference name
301: * @param type The resource environment reference type
302: */
303: public void addResourceEnvRef(String name, String type);
304:
305: /**
306: * Add a resource link for this web application.
307: *
308: * @param resource New resource link
309: */
310: public void addResourceLink(ContextResourceLink resourceLink);
311:
312: /**
313: * Add the classname of a LifecycleListener to be added to each
314: * Wrapper appended to this Context.
315: *
316: * @param listener Java class name of a LifecycleListener class
317: */
318: public void addWrapperLifecycle(String listener);
319:
320: /**
321: * Add the classname of a ContainerListener to be added to each
322: * Wrapper appended to this Context.
323: *
324: * @param listener Java class name of a ContainerListener class
325: */
326: public void addWrapperListener(String listener);
327:
328: /**
329: * Return the set of application listener class names configured
330: * for this application.
331: */
332: public String[] findApplicationListeners();
333:
334: /**
335: * Return the set of application parameters for this application.
336: */
337: public ApplicationParameter[] findApplicationParameters();
338:
339: /**
340: * Return the EJB resource reference with the specified name, if any;
341: * otherwise, return <code>null</code>.
342: *
343: * @param name Name of the desired EJB resource reference
344: */
345: public ContextEjb findEjb(String name);
346:
347: /**
348: * Return the defined EJB resource references for this application.
349: * If there are none, a zero-length array is returned.
350: */
351: public ContextEjb[] findEjbs();
352:
353: /**
354: * Return the environment entry with the specified name, if any;
355: * otherwise, return <code>null</code>.
356: *
357: * @param name Name of the desired environment entry
358: */
359: public ContextEnvironment findEnvironment(String name);
360:
361: /**
362: * Return the set of defined environment entries for this web
363: * application. If none have been defined, a zero-length array
364: * is returned.
365: */
366: public ContextEnvironment[] findEnvironments();
367:
368: /**
369: * Return the set of defined resource parameters for this web
370: * application. If none have been defined, a zero-length array
371: * is returned.
372: */
373: public ResourceParams[] findResourceParams();
374:
375: /**
376: * Return the set of InstanceListener classes that will be added to
377: * newly created Wrappers automatically.
378: */
379: public String[] findInstanceListeners();
380:
381: /**
382: * Return the value for the specified context initialization
383: * parameter name, if any; otherwise return <code>null</code>.
384: *
385: * @param name Name of the parameter to return
386: */
387: public String findParameter(String name);
388:
389: /**
390: * Return the names of all defined context initialization parameters
391: * for this Context. If no parameters are defined, a zero-length
392: * array is returned.
393: */
394: public String[] findParameters();
395:
396: /**
397: * Return the resource reference with the specified name, if any;
398: * otherwise return <code>null</code>.
399: *
400: * @param name Name of the desired resource reference
401: */
402: public ContextResource findResource(String name);
403:
404: /**
405: * Return the resource environment reference type for the specified
406: * name, if any; otherwise return <code>null</code>.
407: *
408: * @param name Name of the desired resource environment reference
409: */
410: public String findResourceEnvRef(String name);
411:
412: /**
413: * Return the set of resource environment reference names for this
414: * web application. If none have been specified, a zero-length
415: * array is returned.
416: */
417: public String[] findResourceEnvRefs();
418:
419: /**
420: * Return the resource link with the specified name, if any;
421: * otherwise return <code>null</code>.
422: *
423: * @param name Name of the desired resource link
424: */
425: public ContextResourceLink findResourceLink(String name);
426:
427: /**
428: * Return the defined resource links for this application. If
429: * none have been defined, a zero-length array is returned.
430: */
431: public ContextResourceLink[] findResourceLinks();
432:
433: /**
434: * Return the defined resource references for this application. If
435: * none have been defined, a zero-length array is returned.
436: */
437: public ContextResource[] findResources();
438:
439: /**
440: * Return the set of LifecycleListener classes that will be added to
441: * newly created Wrappers automatically.
442: */
443: public String[] findWrapperLifecycles();
444:
445: /**
446: * Return the set of ContainerListener classes that will be added to
447: * newly created Wrappers automatically.
448: */
449: public String[] findWrapperListeners();
450:
451: /**
452: * Remove the specified application listener class from the set of
453: * listeners for this application.
454: *
455: * @param listener Java class name of the listener to be removed
456: */
457: public void removeApplicationListener(String listener);
458:
459: /**
460: * Remove the application parameter with the specified name from
461: * the set for this application.
462: *
463: * @param name Name of the application parameter to remove
464: */
465: public void removeApplicationParameter(String name);
466:
467: /**
468: * Remove any EJB resource reference with the specified name.
469: *
470: * @param name Name of the EJB resource reference to remove
471: */
472: public void removeEjb(String name);
473:
474: /**
475: * Remove any environment entry with the specified name.
476: *
477: * @param name Name of the environment entry to remove
478: */
479: public void removeEnvironment(String name);
480:
481: /**
482: * Remove a class name from the set of InstanceListener classes that
483: * will be added to newly created Wrappers.
484: *
485: * @param listener Class name of an InstanceListener class to be removed
486: */
487: public void removeInstanceListener(String listener);
488:
489: /**
490: * Remove the context initialization parameter with the specified
491: * name, if it exists; otherwise, no action is taken.
492: *
493: * @param name Name of the parameter to remove
494: */
495: public void removeParameter(String name);
496:
497: /**
498: * Remove any resource reference with the specified name.
499: *
500: * @param name Name of the resource reference to remove
501: */
502: public void removeResource(String name);
503:
504: /**
505: * Remove any resource environment reference with the specified name.
506: *
507: * @param name Name of the resource environment reference to remove
508: */
509: public void removeResourceEnvRef(String name);
510:
511: /**
512: * Remove any resource link with the specified name.
513: *
514: * @param name Name of the resource link to remove
515: */
516: public void removeResourceLink(String name);
517:
518: /**
519: * Remove a class name from the set of LifecycleListener classes that
520: * will be added to newly created Wrappers.
521: *
522: * @param listener Class name of a LifecycleListener class to be removed
523: */
524: public void removeWrapperLifecycle(String listener);
525:
526: /**
527: * Remove a class name from the set of ContainerListener classes that
528: * will be added to newly created Wrappers.
529: *
530: * @param listener Class name of a ContainerListener class to be removed
531: */
532: public void removeWrapperListener(String listener);
533:
534: // --------------------------------------------------------- Public Methods
535:
536: /**
537: * Import the configuration from the DefaultContext into
538: * current Context.
539: *
540: * @param context current web application context
541: */
542: public void importDefaultContext(Context context);
543:
544: }
|