You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2001/10/17 01:13:48 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina DefaultContext.java

remm        01/10/16 16:13:48

  Added:       catalina/src/share/org/apache/catalina DefaultContext.java
  Log:
  - Add new DefaultContext interface.
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/DefaultContext.java
  
  Index: DefaultContext.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/DefaultContext.java,v 1.1 2001/10/16 23:13:48 remm Exp $
   * $Revision: 1.1 $
   * $Date: 2001/10/16 23:13:48 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  
  package org.apache.catalina;
  
  import javax.naming.directory.DirContext;
  import org.apache.catalina.deploy.ApplicationParameter;
  import org.apache.catalina.deploy.ContextEjb;
  import org.apache.catalina.deploy.ContextEnvironment;
  import org.apache.catalina.deploy.ContextResource;
  import org.apache.catalina.deploy.ResourceParams;
  
  
  /**
   * Used to store the default configuration a Host will use
   * when creating a Context.  A Context configured in server.xml
   * can override these defaults by setting the Context attribute
   * <CODE>override="true"</CODE>.
   *
   * @author Glenn Nielsen
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2001/10/16 23:13:48 $
   */
  
  public interface DefaultContext {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Returns true if the internal naming support is used.
       */
      public boolean isUseNaming();
  
  
      /**
       * Enables or disables naming.
       */
      public void setUseNaming(boolean useNaming);
  
  
      /**
       * Return the "use cookies for session ids" flag.
       */
      public boolean getCookies();
  
  
      /**
       * Set the "use cookies for session ids" flag.
       *
       * @param cookies The new flag
       */
      public void setCookies(boolean cookies);
  
  
      /**
       * Return the "allow crossing servlet contexts" flag.
       */
      public boolean getCrossContext();
  
  
      /**
       * Set the "allow crossing servlet contexts" flag.
       *
       * @param crossContext The new cross contexts flag
       */
      public void setCrossContext(boolean crossContext);
  
  
      /**
       * Return descriptive information about this Container implementation and
       * the corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo();
  
  
      /**
       * Return the reloadable flag for this web application.
       */
      public boolean getReloadable();
  
  
      /**
       * Set the reloadable flag for this web application.
       *
       * @param reloadable The new reloadable flag
       */
      public void setReloadable(boolean reloadable);
  
  
      /**
       * Return the Java class name of the Wrapper implementation used
       * for servlets registered in this Context.
       */
      public String getWrapperClass();
  
  
      /**
       * Set the Java class name of the Wrapper implementation used
       * for servlets registered in this Context.
       *
       * @param wrapperClass The new wrapper class
       */
      public void setWrapperClass(String wrapperClass);
  
  
      /**
       * Set the resources DirContext object with which this Container is
       * associated.
       *
       * @param resources The newly associated DirContext
       */
      public void setResources(DirContext resources);
  
  
      /**
       * Get the resources DirContext object with which this Container is
       * associated.
       *
       * @param resources The new associated DirContext
       */
      public DirContext getResources();
  
  
      /**
       * Return the Loader with which this Container is associated.  If there is
       * no associated Loader return <code>null</code>.
       */
      public Loader getLoader();
  
  
      /**
       * Set the Loader with which this Context is associated.
       *
       * @param loader The newly associated loader
       */
      public void setLoader(Loader loader);
  
  
      /**
       * Return the Manager with which this Container is associated.  If there is
       * no associated Manager return <code>null</code>.
       */
      public Manager getManager();
  
  
      /**
       * Set the Manager with which this Container is associated.
       *
       * @param manager The newly associated Manager
       */
      public void setManager(Manager manager);
  
  
      // ------------------------------------------------------ Public Properties
  
  
      /**
       * Return the name of this DefaultContext
       */
      public String getName();
  
  
      /**
       * Set the name of the default context.
       * 
       * @param name The new name
       */
      public void setName(String name);
  
  
      /**
       * Return the Container for which this Container is a child, if there is
       * one.  If there is no defined parent, return <code>null</code>.
       */
      public Container getParent();
  
  
      /**
       * Set the parent Container to which this Container is being added as a
       * child.  This Container may refuse to become attached to the specified
       * Container by throwing an exception.
       *
       * @param container Container to which this Container is being added
       *  as a child
       *
       * @exception IllegalArgumentException if this Container refuses to become
       *  attached to the specified Container
       */
      public void setParent(Container container);
  
  
      // -------------------------------------------------------- Context Methods
  
  
      /**
       * Add a new Listener class name to the set of Listeners
       * configured for this application.
       *
       * @param listener Java class name of a listener class
       */
      public void addApplicationListener(String listener);
  
  
      /**
       * Add a new application parameter for this application.
       *
       * @param parameter The new application parameter
       */
      public void addApplicationParameter(ApplicationParameter parameter);
  
  
      /**
       * Add an EJB resource reference for this web application.
       *
       * @param ejb New EJB resource reference
       */
      public void addEjb(ContextEjb ejb);
  
  
      /**
       * Add an environment entry for this web application.
       *
       * @param environment New environment entry
       */
      public void addEnvironment(ContextEnvironment environment);
  
  
      /**
       * Add resource parameters for this web application.
       *
       * @param resourceParameters New resource parameters
       */
      public void addResourceParams(ResourceParams resourceParameters);
  
  
      /**
       * Add the classname of an InstanceListener to be added to each
       * Wrapper appended to this Context.
       *
       * @param listener Java class name of an InstanceListener class
       */
      public void addInstanceListener(String listener);
  
  
      /**
       * Add a new context initialization parameter, replacing any existing
       * value for the specified name.
       *
       * @param name Name of the new parameter
       * @param value Value of the new  parameter
       *
       * @exception IllegalArgumentException if the name or value is missing,
       *  or if this context initialization parameter has already been
       *  registered
       */
      public void addParameter(String name, String value);
  
  
      /**
       * Add a resource reference for this web application.
       *
       * @param resource New resource reference
       */
      public void addResource(ContextResource resource);
  
  
      /**
       * Add a resource environment reference for this web application.
       *
       * @param name The resource environment reference name
       * @param type The resource environment reference type
       */
      public void addResourceEnvRef(String name, String type);
  
  
      /**
       * Add the classname of a LifecycleListener to be added to each
       * Wrapper appended to this Context.
       *
       * @param listener Java class name of a LifecycleListener class
       */
      public void addWrapperLifecycle(String listener);
  
  
      /**
       * Add the classname of a ContainerListener to be added to each
       * Wrapper appended to this Context.
       *
       * @param listener Java class name of a ContainerListener class
       */
      public void addWrapperListener(String listener);
  
  
      /**
       * Return the set of application listener class names configured
       * for this application.
       */
      public String[] findApplicationListeners();
  
  
      /**
       * Return the set of application parameters for this application.
       */
      public ApplicationParameter[] findApplicationParameters();
  
  
      /**
       * Return the EJB resource reference with the specified name, if any;
       * otherwise, return <code>null</code>.
       *
       * @param name Name of the desired EJB resource reference
       */
      public ContextEjb findEjb(String name);
  
  
      /**
       * Return the defined EJB resource references for this application.
       * If there are none, a zero-length array is returned.
       */
      public ContextEjb[] findEjbs();
  
  
      /**
       * Return the environment entry with the specified name, if any;
       * otherwise, return <code>null</code>.
       *
       * @param name Name of the desired environment entry
       */
      public ContextEnvironment findEnvironment(String name);
  
  
      /**
       * Return the set of defined environment entries for this web
       * application.  If none have been defined, a zero-length array
       * is returned.
       */
      public ContextEnvironment[] findEnvironments();
  
  
      /**
       * Return the set of defined resource parameters for this web
       * application.  If none have been defined, a zero-length array
       * is returned.
       */
      public ResourceParams[] findResourceParams();
  
  
      /**
       * Return the set of InstanceListener classes that will be added to
       * newly created Wrappers automatically.
       */
      public String[] findInstanceListeners();
  
  
      /**
       * Return the value for the specified context initialization
       * parameter name, if any; otherwise return <code>null</code>.
       *
       * @param name Name of the parameter to return
       */
      public String findParameter(String name);
  
  
      /**
       * Return the names of all defined context initialization parameters
       * for this Context.  If no parameters are defined, a zero-length
       * array is returned.
       */
      public String[] findParameters();
  
  
      /**
       * Return the resource reference with the specified name, if any;
       * otherwise return <code>null</code>.
       *
       * @param name Name of the desired resource reference
       */
      public ContextResource findResource(String name);
  
  
      /**
       * Return the resource environment reference type for the specified
       * name, if any; otherwise return <code>null</code>.
       *
       * @param name Name of the desired resource environment reference
       */
      public String findResourceEnvRef(String name);
  
  
      /**
       * Return the set of resource environment reference names for this
       * web application.  If none have been specified, a zero-length
       * array is returned.
       */
      public String[] findResourceEnvRefs();
  
  
      /**
       * Return the defined resource references for this application.  If
       * none have been defined, a zero-length array is returned.
       */
      public ContextResource[] findResources();
  
  
      /**
       * Return the set of LifecycleListener classes that will be added to
       * newly created Wrappers automatically.
       */
      public String[] findWrapperLifecycles();
  
  
      /**
       * Return the set of ContainerListener classes that will be added to
       * newly created Wrappers automatically.
       */
      public String[] findWrapperListeners();
  
  
      /**
       * Remove the specified application listener class from the set of
       * listeners for this application.
       *
       * @param listener Java class name of the listener to be removed
       */
      public void removeApplicationListener(String listener);
  
  
      /**
       * Remove the application parameter with the specified name from
       * the set for this application.
       *
       * @param name Name of the application parameter to remove
       */
      public void removeApplicationParameter(String name);
  
  
      /**
       * Remove any EJB resource reference with the specified name.
       *
       * @param name Name of the EJB resource reference to remove
       */
      public void removeEjb(String name);
  
  
      /**
       * Remove any environment entry with the specified name.
       *
       * @param name Name of the environment entry to remove
       */
      public void removeEnvironment(String name);
  
  
      /**
       * Remove a class name from the set of InstanceListener classes that
       * will be added to newly created Wrappers.
       *
       * @param listener Class name of an InstanceListener class to be removed
       */
      public void removeInstanceListener(String listener);
  
  
      /**
       * Remove the context initialization parameter with the specified
       * name, if it exists; otherwise, no action is taken.
       *
       * @param name Name of the parameter to remove
       */
      public void removeParameter(String name);
  
  
      /**
       * Remove any resource reference with the specified name.
       *
       * @param name Name of the resource reference to remove
       */
      public void removeResource(String name);
  
  
      /**
       * Remove any resource environment reference with the specified name.
       *
       * @param name Name of the resource environment reference to remove
       */
      public void removeResourceEnvRef(String name);
  
  
      /**
       * Remove a class name from the set of LifecycleListener classes that
       * will be added to newly created Wrappers.
       *
       * @param listener Class name of a LifecycleListener class to be removed
       */
      public void removeWrapperLifecycle(String listener);
  
  
      /**
       * Remove a class name from the set of ContainerListener classes that
       * will be added to newly created Wrappers.
       *
       * @param listener Class name of a ContainerListener class to be removed
       */
      public void removeWrapperListener(String listener);
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Import the configuration from the DefaultContext into
       * current Context.
       *
       * @param context current web application context
       */
      public void importDefaultContext(Context context);
  
  
  }