public final class RepositoryClassLoader extends SecureClassLoader implements org.apache.sling.commons.classloader.DynamicClassLoader
RepositoryClassLoader
class provides the
functionality to load classes and resources from the JCR Repository.
Additionally, this class supports the notion of getting 'dirty', which means,
that if a resource loaded through this class loader has been modified in the
repository, this class loader marks itself dirty, which flag can get
retrieved.Constructor and Description |
---|
RepositoryClassLoader(String classPath,
ClassLoaderWriterImpl writer,
ClassLoader parent)
Creates a
RepositoryClassLoader for a given
repository path. |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroys this class loader.
|
protected Class<?> |
findClass(String name)
Finds and loads the class with the specified name from the class path.
|
URL |
findResource(String name)
Finds the resource with the specified name on the search path.
|
Enumeration<URL> |
findResources(String name)
Returns an Enumeration of URLs representing all of the resources
on the search path having the specified name.
|
void |
handleEvent(String path)
Handle a modification event.
|
boolean |
isLive() |
String |
toString()
Returns a string representation of this class loader.
|
defineClass, defineClass, getPermissions
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public RepositoryClassLoader(String classPath, ClassLoaderWriterImpl writer, ClassLoader parent)
RepositoryClassLoader
for a given
repository path.classPath
- The path making up the class path of this class
loaderwriter
- The class loader write to get a jcr session.parent
- The parent ClassLoader
, which may be
null
.NullPointerException
- if either the session or the classPath
is null
.public void destroy()
NOTE: This method just clears all internal fields and especially the class path to render this class loader unusable.
This implementation does not throw any exceptions.
protected Class<?> findClass(String name) throws ClassNotFoundException
findClass
in class ClassLoader
name
- the name of the classClassNotFoundException
- If the named class could not be found or
if this class loader has already been destroyed.public URL findResource(String name)
findResource
in class ClassLoader
name
- the name of the resourceURL
for the resource, or null
if the resource could not be found or if the class loader has
already been destroyed.public Enumeration<URL> findResources(String name)
findResources
in class ClassLoader
name
- the resource nameEnumeration
of URL
s. This is an
empty enumeration if no resources are found by this class loader
or if this class loader has already been destroyed.public boolean isLive()
isLive
in interface org.apache.sling.commons.classloader.DynamicClassLoader
DynamicClassLoader.isLive()
public void handleEvent(String path)
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.