|
||||||||||
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(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(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(String pattern)
Exclude a pattern |
static Set<URL> |
getLocations()
Returns the list of all configured locations of directories containing class files |
static List<String> |
getPatterns()
Returns the list of all configured inclusion or exclusion patterns |
URL |
getResource(String name)
Gets a resource from this ClassLoader. |
static void |
includePattern(String pattern)
Include a pattern |
Class<?> |
loadClass(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(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.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReloadingClassLoader(ClassLoader parent)
parent
- the parent classloader in case the class file cannot be loaded from the above
locationsMethod Detail |
---|
protected boolean tryClassHere(String name)
name
-
public static void includePattern(String pattern)
pattern
- the pattern to includepublic static void excludePattern(String pattern)
pattern
- the pattern to excludepublic static List<String> getPatterns()
public static void addLocation(URL url)
url
- the URL for the directorypublic static Set<URL> getLocations()
public final URL getResource(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 ClassLoader
- Parameters:
name
- of resource
public final Class<?> loadClass(String name, boolean resolve) throws 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 ClassLoader
- Parameters:
name
- the name of the classresolve
- if true
then resolve the class
- Returns:
- the resulting
Class
object
- Throws:
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 |