|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.ClassLoader java.security.SecureClassLoader java.net.URLClassLoader org.apache.wicket.application.ReloadingClassLoader
public class ReloadingClassLoader
Custom ClassLoader that reverses the classloader lookups, and that is able to notify a listener when a class file is changed.
Constructor Summary | |
---|---|
ReloadingClassLoader(java.lang.ClassLoader parent)
Create a new reloading ClassLoader from a list of URLs, and initialize the ModificationWatcher to detect class file modifications |
Method Summary | |
---|---|
static void |
addLocation(java.net.URL url)
Add the location of a directory containing class files |
void |
destroy()
Remove the ModificationWatcher from the current reloading class loader |
static void |
excludePattern(java.lang.String pattern)
Exclude a pattern |
static java.util.Set |
getLocations()
Returns the list of all configured locations of directories containing class files |
static java.util.List |
getPatterns()
Returns the list of all configured inclusion or exclusion patterns |
java.net.URL |
getResource(java.lang.String name)
Gets a resource from this ClassLoader. |
static void |
includePattern(java.lang.String pattern)
Include a pattern |
java.lang.Class |
loadClass(java.lang.String name,
boolean resolve)
Loads the class from this ClassLoader. |
void |
setListener(IChangeListener listener)
Sets the listener that will be notified when a class changes |
protected boolean |
tryClassHere(java.lang.String name)
|
Methods inherited from class java.net.URLClassLoader |
---|
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
---|
defineClass, defineClass |
Methods inherited from class java.lang.ClassLoader |
---|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReloadingClassLoader(java.lang.ClassLoader parent)
parent
- the parent classloader in case the class file cannot be loaded from the above
locationsMethod Detail |
---|
protected boolean tryClassHere(java.lang.String name)
public static void includePattern(java.lang.String pattern)
pattern
- the pattern to includepublic static void excludePattern(java.lang.String pattern)
pattern
- the pattern to excludepublic static java.util.List getPatterns()
public static void addLocation(java.net.URL url)
url
- the URL for the directorypublic static java.util.Set getLocations()
public final java.net.URL getResource(java.lang.String name)
ClassLoader. If the
resource does not exist in this one, we check the parent.
Please note that this is the exact opposite of the
ClassLoader
spec. We use it to work around
inconsistent class loaders from third party vendors.
- Overrides:
getResource
in class java.lang.ClassLoader
- Parameters:
name
- of resource
public final java.lang.Class loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
ClassLoader. If the
class does not exist in this one, we check the parent. Please
note that this is the exact opposite of the
ClassLoader
spec. We use it to load the class
from the same classloader as WicketFilter or WicketServlet.
When found, the class file is watched for modifications.
- Overrides:
loadClass
in class java.lang.ClassLoader
- Parameters:
name
- the name of the classresolve
- if true
then resolve the class
- Returns:
- the resulting
Class
object
- Throws:
java.lang.ClassNotFoundException
- if the class could not be found
public void setListener(IChangeListener listener)
listener
- the listener to notify upon class changepublic void destroy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |