org.apache.catalina.core
Class ContextJarRepository

java.lang.Object
  extended by org.apache.catalina.core.ContextJarRepository
All Implemented Interfaces:
Contained, JarRepository, Lifecycle

public class ContextJarRepository
extends java.lang.Object
implements JarRepository, Contained, Lifecycle

Context specific implementation for a JAR repository, which will manage JARs from /WEB-INF/lib in an efficient way.

Author:
Remy Maucherat

Field Summary
protected  java.lang.String classesPath
          Classes path, which is essentially an exploded Jar.
protected  Container container
          The Container with which this Pipeline is associated.
protected  java.util.Map<java.lang.String,java.io.File> explodedJars
          Map for the File instances.
protected  java.io.File[] explodedJarsArray
          Array of the exploded Jars, as convenience.
protected  java.lang.String info
          Descriptive information about this implementation.
protected  java.util.Map<java.lang.String,java.util.jar.JarFile> jarFiles
          Map for the JarFile instances.
protected  java.util.jar.JarFile[] jarFilesArray
          Array of the JarFiles, as convenience.
protected  java.lang.String libPath
          Library path.
protected  LifecycleSupport lifecycle
          The lifecycle event support for this component.
protected static StringManager sm
          The string manager for this package.
protected  boolean started
          Has this component been started yet?
protected  boolean tempExplodedJars
          Delete temp exploded Jars.
protected  boolean tempJars
          Delete temp Jars.
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
ContextJarRepository()
          Construct a new ContextJarRepository instance with no associated Container.
ContextJarRepository(Container container)
          Construct a new ContextJarRepository instance that is associated with the specified Container.
 
Method Summary
 void addLifecycleListener(LifecycleListener listener)
          Add a lifecycle event listener to this component.
 void backgroundProcess()
          Execute a periodic task, such as reloading, etc.
protected  void copyDirContext(javax.naming.directory.DirContext srcDir, java.io.File destDir)
          Copy directory.
 java.io.File[] findExplodedJars()
          Find all exploded Jars managed by the JARRepository.
 java.util.jar.JarFile findJar(java.lang.String path)
          Find the JarFile corresponding to the path.
 java.util.jar.JarFile[] findJars()
          Find all JarFile managed by the JARRepository.
 LifecycleListener[] findLifecycleListeners()
          Get the lifecycle listeners associated with this lifecycle.
 Container getContainer()
          Return the Container with which this Pipeline is associated.
 java.util.Map<java.lang.String,java.io.File> getExplodedJars()
          Get the exploded Jar map.
 java.lang.String getInfo()
          Return descriptive information about this implementation class.
 java.util.Map<java.lang.String,java.util.jar.JarFile> getJars()
          Get the JarFile map.
 void removeLifecycleListener(LifecycleListener listener)
          Remove a lifecycle event listener from this component.
 void setContainer(Container container)
          Set the Container with which this Pipeline is associated.
 void start()
          Prepare for active use of the public methods of this Component.
 void stop()
          Gracefully shut down active use of the public methods of this Component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

container

protected Container container
The Container with which this Pipeline is associated.


info

protected java.lang.String info
Descriptive information about this implementation.


lifecycle

protected LifecycleSupport lifecycle
The lifecycle event support for this component.


sm

protected static StringManager sm
The string manager for this package.


started

protected boolean started
Has this component been started yet?


classesPath

protected java.lang.String classesPath
Classes path, which is essentially an exploded Jar.


libPath

protected java.lang.String libPath
Library path.


jarFiles

protected java.util.Map<java.lang.String,java.util.jar.JarFile> jarFiles
Map for the JarFile instances.


jarFilesArray

protected java.util.jar.JarFile[] jarFilesArray
Array of the JarFiles, as convenience.


explodedJars

protected java.util.Map<java.lang.String,java.io.File> explodedJars
Map for the File instances.


explodedJarsArray

protected java.io.File[] explodedJarsArray
Array of the exploded Jars, as convenience.


tempJars

protected boolean tempJars
Delete temp Jars.


tempExplodedJars

protected boolean tempExplodedJars
Delete temp exploded Jars.

Constructor Detail

ContextJarRepository

public ContextJarRepository()
Construct a new ContextJarRepository instance with no associated Container.


ContextJarRepository

public ContextJarRepository(Container container)
Construct a new ContextJarRepository instance that is associated with the specified Container.

Parameters:
container - The container we should be associated with
Method Detail

getInfo

public java.lang.String getInfo()
Return descriptive information about this implementation class.

Specified by:
getInfo in interface JarRepository

getContainer

public Container getContainer()
Return the Container with which this Pipeline is associated.

Specified by:
getContainer in interface Contained
Specified by:
getContainer in interface JarRepository

setContainer

public void setContainer(Container container)
Set the Container with which this Pipeline is associated.

Specified by:
setContainer in interface Contained
Specified by:
setContainer in interface JarRepository
Parameters:
container - The new associated container

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

start

public void start()
           throws LifecycleException
Prepare for active use of the public methods of this Component.

Specified by:
start in interface Lifecycle
Throws:
LifecycleException - if this component detects a fatal error that prevents it from being started

stop

public void stop()
          throws LifecycleException
Gracefully shut down active use of the public methods of this Component.

Specified by:
stop in interface Lifecycle
Throws:
LifecycleException - if this component detects a fatal error that needs to be reported

backgroundProcess

public void backgroundProcess()
Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.

Specified by:
backgroundProcess in interface JarRepository

getJars

public java.util.Map<java.lang.String,java.util.jar.JarFile> getJars()
Get the JarFile map.

Specified by:
getJars in interface JarRepository
Returns:
the JarFile map, associating logical name with JarFile

findJar

public java.util.jar.JarFile findJar(java.lang.String path)
Find the JarFile corresponding to the path.

Specified by:
findJar in interface JarRepository
Returns:
the JarFile, or null if not found

findJars

public java.util.jar.JarFile[] findJars()
Find all JarFile managed by the JARRepository.

Specified by:
findJars in interface JarRepository
Returns:
All JarFile

getExplodedJars

public java.util.Map<java.lang.String,java.io.File> getExplodedJars()
Get the exploded Jar map.

Specified by:
getExplodedJars in interface JarRepository
Returns:
the Jar map, associating logical name with File

findExplodedJars

public java.io.File[] findExplodedJars()
Find all exploded Jars managed by the JARRepository.

Specified by:
findExplodedJars in interface JarRepository
Returns:
All exploded File

copyDirContext

protected void copyDirContext(javax.naming.directory.DirContext srcDir,
                              java.io.File destDir)
                       throws java.io.IOException,
                              javax.naming.NamingException
Copy directory.

Throws:
java.io.IOException
javax.naming.NamingException


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