public class WebappLoader extends Object implements Lifecycle, Loader, PropertyChangeListener
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.
Modifier and Type | Field and Description |
---|---|
protected LifecycleSupport |
lifecycle
The lifecycle event support for this component.
|
protected static StringManager |
sm
The string manager for this package.
|
protected PropertyChangeSupport |
support
The property change support for this component.
|
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
WebappLoader()
Construct a new WebappLoader with no defined parent class loader
(so that the actual parent will be the system class loader).
|
WebappLoader(ClassLoader parent)
Construct a new WebappLoader with the specified class loader
to be defined as the parent of the ClassLoader we ultimately create.
|
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
|
void |
addOverridablePackage(String packageName)
Adds the given package name to the list of packages that may always be
overriden, regardless of whether they belong to a protected namespace
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this component.
|
void |
addRepository(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.
|
protected ClassLoader |
createClassLoader()
Create associated classLoader.
|
void |
destroy() |
List<LifecycleListener> |
findLifecycleListeners()
Gets the (possibly empty) list of lifecycle listeners associated
with this WebappLoader.
|
String[] |
findRepositories()
Return the set of repositories defined for this class loader.
|
ClassLoader |
getClassLoader()
Return the Java class loader to be used by this Container.
|
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.
|
ObjectName |
getController() |
int |
getDebug()
Return the debugging detail level for this component.
|
boolean |
getDelegate()
Return the "follow standard delegation model" flag used to configure
our ClassLoader.
|
String |
getInfo()
Return descriptive information about this Loader implementation and
the corresponding version number, in the format
<description>/<version> . |
String |
getLoaderClass()
Return the ClassLoader class name.
|
boolean |
getReloadable()
Return the reloadable flag for this Loader.
|
String[] |
getRepositories() |
void |
init() |
boolean |
modified()
Has the internal repository associated with this Loader been modified,
such that the loaded classes should be reloaded?
|
void |
propertyChange(PropertyChangeEvent event)
Process property change events from our associated Context.
|
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
|
void |
removePropertyChangeListener(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(ObjectName controller) |
void |
setDebug(int debug)
Set the debugging detail level for this component.
|
void |
setDelegate(boolean delegate)
Set the "follow standard delegation model" flag used to configure
our ClassLoader.
|
void |
setIgnoreHiddenJarFiles(boolean ignoreHiddenJarFiles) |
void |
setLoaderClass(String loaderClass)
Set the ClassLoader class name.
|
void |
setReloadable(boolean reloadable)
Set the reloadable flag for this Loader.
|
void |
setUseMyFaces(boolean useMyFaces) |
void |
start()
Start this component, initializing our associated class loader.
|
void |
stop()
Stop this component, finalizing our associated class loader.
|
void |
stopNestedClassLoader()
Stops the nested classloader
|
String |
toString()
Return a String representation of this component.
|
protected LifecycleSupport lifecycle
protected static final StringManager sm
protected PropertyChangeSupport support
public WebappLoader()
public WebappLoader(ClassLoader parent)
parent
- The parent class loaderpublic ClassLoader getClassLoader()
getClassLoader
in interface Loader
public Container getContainer()
getContainer
in interface Loader
public void setContainer(Container container)
setContainer
in interface Loader
container
- The associated Containerpublic int getDebug()
public void setDebug(int debug)
debug
- The new debugging detail levelpublic boolean getDelegate()
getDelegate
in interface Loader
public void setDelegate(boolean delegate)
setDelegate
in interface Loader
delegate
- The new flagpublic String getInfo()
<description>/<version>
.public String getLoaderClass()
public void setLoaderClass(String loaderClass)
loaderClass
- The new ClassLoader class namepublic boolean getReloadable()
getReloadable
in interface Loader
public void setReloadable(boolean reloadable)
setReloadable
in interface Loader
reloadable
- The new reloadable flagpublic void setUseMyFaces(boolean useMyFaces)
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface Loader
listener
- The listener to addpublic void addRepository(String repository)
addRepository
in interface Loader
repository
- Repository to be addedpublic String[] findRepositories()
findRepositories
in interface Loader
public String[] getRepositories()
public String getClasspath()
public boolean modified()
public void closeJARs(boolean force)
public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface Loader
listener
- The listener to removepublic String toString()
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic List<LifecycleListener> findLifecycleListeners()
findLifecycleListeners
in interface Lifecycle
public void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener
in interface Lifecycle
listener
- The listener to removepublic void init()
public void destroy()
public void start() throws LifecycleException
start
in interface Lifecycle
LifecycleException
- if a lifecycle error occurspublic void stop() throws LifecycleException
stop
in interface Lifecycle
LifecycleException
- if a lifecycle error occurspublic void stopNestedClassLoader() throws LifecycleException
LifecycleException
public void propertyChange(PropertyChangeEvent event)
propertyChange
in interface PropertyChangeListener
event
- The property change event that has occurredprotected ClassLoader createClassLoader() throws Exception
Exception
public ObjectName getController()
public void setController(ObjectName controller)
public void addOverridablePackage(String packageName)
addOverridablePackage
in interface Loader
public void setIgnoreHiddenJarFiles(boolean ignoreHiddenJarFiles)
setIgnoreHiddenJarFiles
in interface Loader
Copyright © 2018. All rights reserved.