Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.loader
Class WebappLoader

    java.lang.Object
      org.apache.catalina.loader.WebappLoader

All Implemented Interfaces:
  java.util.EventListener, Lifecycle, Loader, javax.management.MBeanRegistration, java.beans.PropertyChangeListener

public class WebappLoader
extends java.lang.Object
implements Lifecycle, Loader, java.beans.PropertyChangeListener, javax.management.MBeanRegistration

Classloader implementation which is specialized for handling web applications in the most efficient way, while being Catalina aware (all accesses to resources are made through the DirContext interface). This class loader supports detection of modified Java classes, which can be used to implement auto-reload support.

This class loader is configured by adding the pathnames of directories, JAR files, and ZIP files with the `addRepository()` method, prior to calling `start()`. When a new class is required, these repositories will be consulted first to locate the class. If it is not present, the system class loader will be used instead.

Version:
  $Revision: 1.27 $ $Date: 2004/03/02 12:31:57 $
Author:
  Craig R. McClanahan, Remy Maucherat

Field Summary
`protected DefaultContext` | `defaultContext` The DefaultContext with which this Loader is associated.
`protected LifecycleSupport` | `lifecycle` The lifecycle event support for this component.
`protected static StringManager` | `sm` The string manager for this package.
`protected java.beans.PropertyChangeSupport` | `support` The property change support for this component.

Fields inherited from interface org.apache.catalina.Lifecycle
`AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT`

Constructor Summary
`WebappLoader()` Construct a new WebappLoader with no defined parent class loader (so that the actual parent will be the system class loader).
`WebappLoader(java.lang.ClassLoader parent)` Construct a new WebappLoader with the specified class loader to be defined as the parent of the ClassLoader we ultimately create.

Method Summary
`void` | `addLifecycleListener(LifecycleListener listener)` Add a lifecycle event listener to this component.
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Add a property change listener to this component.
`void` | `addRepository(java.lang.String repository)` Add a new repository to the set of repositories for this class loader.
`void` | `closeJARs(boolean force)` Used to periodically signal to the classloader to release JAR resources.
`void` | `destroy()`
`LifecycleListener[]` | `findLifecycleListeners()` Get the lifecycle listeners associated with this lifecycle.
`java.lang.String[]` | `findRepositories()` Return the set of repositories defined for this class loader.
`java.lang.ClassLoader` | `getClassLoader()` Return the Java class loader to be used by this Container.
`java.lang.String` | `getClasspath()` Classpath, as set in org.apache.catalina.jsp_classpath context property
`Container` | `getContainer()` Return the Container with which this Logger has been associated.
`javax.management.ObjectName` | `getController()`
`int` | `getDebug()` Return the debugging detail level for this component.
`DefaultContext` | `getDefaultContext()` Return the DefaultContext with which this Loader is associated.
`boolean` | `getDelegate()` Return the "follow standard delegation model" flag used to configure our ClassLoader.
`java.lang.String` | `getInfo()` Return descriptive information about this Loader implementation and the corresponding version number, in the format `<description>/<version>`.
`java.lang.String` | `getLoaderClass()` Return the ClassLoader class name.
`java.lang.String[]` | `getLoaderRepositories()`
`java.lang.String` | `getLoaderRepositoriesString()`
`boolean` | `getReloadable()` Return the reloadable flag for this Loader.
`java.lang.String[]` | `getRepositories()`
`java.lang.String` | `getRepositoriesString()` Extra repositories for this loader
`void` | `init()`
`boolean` | `modified()` Has the internal repository associated with this Loader been modified, such that the loaded classes should be reloaded?
`void` | `postDeregister()`
`void` | `postRegister(java.lang.Boolean registrationDone)`
`void` | `preDeregister()`
`javax.management.ObjectName` | `preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)`
`void` | `propertyChange(java.beans.PropertyChangeEvent event)` Process property change events from our associated Context.
`void` | `removeLifecycleListener(LifecycleListener listener)` Remove a lifecycle event listener from this component.
`void` | `removePropertyChangeListener(java.beans.PropertyChangeListener listener)` Remove a property change listener from this component.
`void` | `setContainer(Container container)` Set the Container with which this Logger has been associated.
`void` | `setController(javax.management.ObjectName controller)`
`void` | `setDebug(int debug)` Set the debugging detail level for this component.
`void` | `setDefaultContext(DefaultContext defaultContext)` Set the DefaultContext with which this Loader is associated.
`void` | `setDelegate(boolean delegate)` Set the "follow standard delegation model" flag used to configure our ClassLoader.
`void` | `setLoaderClass(java.lang.String loaderClass)` Set the ClassLoader class name.
`void` | `setReloadable(boolean reloadable)` Set the reloadable flag for this Loader.
`void` | `start()` Start this component, initializing our associated class loader.
`void` | `stop()` Stop this component, finalizing our associated class loader.
`java.lang.String` | `toString()` Return a String representation of this component.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### defaultContext

    protected DefaultContext defaultContext

  The DefaultContext with which this Loader is associated.

### lifecycle

    protected LifecycleSupport lifecycle

  The lifecycle event support for this component.

### sm

    protected static final StringManager sm

  The string manager for this package.

### support

    protected java.beans.PropertyChangeSupport support

  The property change support for this component.

Constructor Detail

### WebappLoader

    public WebappLoader()

  Construct a new WebappLoader with no defined parent class loader (so that the actual parent will be the system class loader).

### WebappLoader

    public WebappLoader(java.lang.ClassLoader parent)

  Construct a new WebappLoader with the specified class loader to be defined as the parent of the ClassLoader we ultimately create.

Parameters:
  `parent` - The parent class loader

Method Detail

### getClassLoader

    public java.lang.ClassLoader getClassLoader()

  Return the Java class loader to be used by this Container.

  Specified by:
    `getClassLoader` in interface `Loader`

### getContainer

    public Container getContainer()

  Return the Container with which this Logger has been associated.

  Specified by:
    `getContainer` in interface `Loader`

### setContainer

    public void setContainer(Container container)

  Set the Container with which this Logger has been associated.

  Specified by:
    `setContainer` in interface `Loader`
  Parameters:
    `container` - The associated Container

### getDefaultContext

    public DefaultContext getDefaultContext()

  Return the DefaultContext with which this Loader is associated. XXX What is that ???

  Specified by:
    `getDefaultContext` in interface `Loader`

### setDefaultContext

    public void setDefaultContext(DefaultContext defaultContext)

  Set the DefaultContext with which this Loader is associated.

  Specified by:
    `setDefaultContext` in interface `Loader`
  Parameters:
    `defaultContext` - The newly associated DefaultContext

### getDebug

    public int getDebug()

  Return the debugging detail level for this component.

### setDebug

    public void setDebug(int debug)

  Set the debugging detail level for this component.

  Parameters:
    `debug` - The new debugging detail level

### getDelegate

    public boolean getDelegate()

  Return the "follow standard delegation model" flag used to configure our ClassLoader.

  Specified by:
    `getDelegate` in interface `Loader`

### setDelegate

    public void setDelegate(boolean delegate)

  Set the "follow standard delegation model" flag used to configure our ClassLoader.

  Specified by:
    `setDelegate` in interface `Loader`
  Parameters:
    `delegate` - The new flag

### getInfo

    public java.lang.String getInfo()

  Return descriptive information about this Loader implementation and the corresponding version number, in the format `<description>/<version>`.

  Specified by:
    `getInfo` in interface `Loader`

### getLoaderClass

    public java.lang.String getLoaderClass()

  Return the ClassLoader class name.

### setLoaderClass

    public void setLoaderClass(java.lang.String loaderClass)

  Set the ClassLoader class name.

  Parameters:
    `loaderClass` - The new ClassLoader class name

### getReloadable

    public boolean getReloadable()

  Return the reloadable flag for this Loader.

  Specified by:
    `getReloadable` in interface `Loader`

### setReloadable

    public void setReloadable(boolean reloadable)

  Set the reloadable flag for this Loader.

  Specified by:
    `setReloadable` in interface `Loader`
  Parameters:
    `reloadable` - The new reloadable flag

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Add a property change listener to this component.

  Specified by:
    `addPropertyChangeListener` in interface `Loader`
  Parameters:
    `listener` - The listener to add

### addRepository

    public void addRepository(java.lang.String repository)

  Add a new repository to the set of repositories for this class loader.

  Specified by:
    `addRepository` in interface `Loader`
  Parameters:
    `repository` - Repository to be added

### findRepositories

    public java.lang.String[] findRepositories()

  Return the set of repositories defined for this class loader. If none are defined, a zero-length array is returned. For security reason, returns a clone of the Array (since String are immutable).

  Specified by:
    `findRepositories` in interface `Loader`

### getRepositories

    public java.lang.String[] getRepositories()

### getRepositoriesString

    public java.lang.String getRepositoriesString()

  Extra repositories for this loader

### getLoaderRepositories

    public java.lang.String[] getLoaderRepositories()

### getLoaderRepositoriesString

    public java.lang.String getLoaderRepositoriesString()

### getClasspath

    public java.lang.String getClasspath()

  Classpath, as set in org.apache.catalina.jsp_classpath context property

  Returns:
    The classpath

### modified

    public boolean modified()

  Has the internal repository associated with this Loader been modified, such that the loaded classes should be reloaded?

  Specified by:
    `modified` in interface `Loader`

### closeJARs

    public void closeJARs(boolean force)

  Used to periodically signal to the classloader to release JAR resources.

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

  Remove a property change listener from this component.

  Specified by:
    `removePropertyChangeListener` in interface `Loader`
  Parameters:
    `listener` - The listener to remove

### toString

    public java.lang.String toString()

  Return a String representation of this component.

### addLifecycleListener

    public void addLifecycleListener(LifecycleListener listener)

  Add a lifecycle event listener to this component.

  Specified by:
    `addLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to add

### findLifecycleListeners

    public LifecycleListener[] findLifecycleListeners()

  Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

  Specified by:
    `findLifecycleListeners` in interface `Lifecycle`

### removeLifecycleListener

    public void removeLifecycleListener(LifecycleListener listener)

  Remove a lifecycle event listener from this component.

  Specified by:
    `removeLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to remove

### init

    public void init()

### destroy

    public void destroy()

### start

    public void start()
               throws LifecycleException

  Start this component, initializing our associated class loader.

  Specified by:
    `start` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if a lifecycle error occurs

### stop

    public void stop()
              throws LifecycleException

  Stop this component, finalizing our associated class loader.

  Specified by:
    `stop` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if a lifecycle error occurs

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent event)

  Process property change events from our associated Context.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`
  Parameters:
    `event` - The property change event that has occurred

### preRegister

    public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                                   javax.management.ObjectName name)
                                            throws java.lang.Exception

  Specified by:
    `preRegister` in interface `javax.management.MBeanRegistration`
  Throws:
    `java.lang.Exception`

### postRegister

    public void postRegister(java.lang.Boolean registrationDone)

  Specified by:
    `postRegister` in interface `javax.management.MBeanRegistration`

### preDeregister

    public void preDeregister()
                       throws java.lang.Exception

  Specified by:
    `preDeregister` in interface `javax.management.MBeanRegistration`
  Throws:
    `java.lang.Exception`

### postDeregister

    public void postDeregister()

  Specified by:
    `postDeregister` in interface `javax.management.MBeanRegistration`

### getController

    public javax.management.ObjectName getController()

### setController

    public void setController(javax.management.ObjectName controller)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.