org.apache.sling.commons.classloader
Interface DynamicClassLoaderProvider


public interface DynamicClassLoaderProvider

A dynamic class loader provider allows to provide class loaders that will be used by the dynamic class loading mechanism. For instance a JCR class loader provider could provide some class loader loading classes from a content repository etc.


Method Summary
 ClassLoader getClassLoader(ClassLoader parent)
          Return the class loader used for dynamic class loading.
 void release(ClassLoader classLoader)
          Release the provided class loader.
 

Method Detail

getClassLoader

ClassLoader getClassLoader(ClassLoader parent)
Return the class loader used for dynamic class loading. The returned class loader should use the provided parent class loader as one of its parent class loaders. This ensures that the returned class loader has access to all dynamically loaded classes that are not part of this class loader. When the class loader is not needed anymore, it is released by calling the release(ClassLoader) method.

Parameters:
parent - The parent class loader for this dynamic class loader.
Returns:
The class loader.
See Also:
release(ClassLoader)

release

void release(ClassLoader classLoader)
Release the provided class loader. When the class loader is not needed anymore, e.g. when the dynamic class loader is shutdown, it is released with this method. The implementation can use this hook to free any allocated resources etc.

Parameters:
classLoader - The class loader.
Since:
2.0
See Also:
getClassLoader(ClassLoader)


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.