public interface BundleClassLoader extends BundleReference
ClassLoaders that implement the BundleClassLoader interface
must use a ClassLoaderDelegate to delegate all class, resource
and native library lookups.
Clients may implement this interface.
| Modifier and Type | Method and Description |
|---|---|
void |
attachFragment(BundleData bundledata,
ProtectionDomain domain,
String[] classpath)
Attaches the BundleData for a fragment to this BundleClassLoader.
|
void |
close()
Closes this class loader.
|
List<URL> |
findEntries(String path,
String filePattern,
int options)
Returns resource entries for the bundle associated with this class loader.
|
Class<?> |
findLocalClass(String classname)
Finds a local class in the BundleClassLoader without
consulting the delegate.
|
URL |
findLocalResource(String resource)
Finds a local resource in the BundleClassLoader without
consulting the delegate.
|
Enumeration<URL> |
findLocalResources(String resource)
Finds all local resources in the BundleClassLoader with the specified
path without consulting the delegate.
|
ClassLoaderDelegate |
getDelegate()
Returns the ClassLoaderDelegate used by this BundleClassLoader
|
ClassLoader |
getParent()
Returns the parent classloader used by this BundleClassLoader
|
URL |
getResource(String name)
This method will first search the parent class loader for the resource;
That failing, this method will invoke
ClassLoaderDelegate.findResource(String) to find the resource. |
Enumeration<URL> |
getResources(String name)
This method will first search the parent class loader for the resource;
That failing, this method will invoke
ClassLoaderDelegate.findResource(String) to find the resource. |
void |
initialize()
Initializes the ClassLoader.
|
Collection<String> |
listLocalResources(String path,
String filePattern,
int options)
Returns the names of local resources visible to this bundle class loader.
|
Collection<String> |
listResources(String path,
String filePattern,
int options)
Returns the names of resources visible to this bundle class loader.
|
Class<?> |
loadClass(String name)
This method will first search the parent class loader for the class;
That failing, this method will invoke
ClassLoaderDelegate.findClass(String) to find the resource. |
getBundlevoid initialize()
URL findLocalResource(String resource)
resource - the resource path to find.Enumeration<URL> findLocalResources(String resource)
resource - the resource path to find.Class<?> findLocalClass(String classname) throws ClassNotFoundException
classname - the classname to find.ClassNotFoundException - if the classname does not exist locally.URL getResource(String name)
ClassLoaderDelegate.findResource(String) to find the resource.name - the resource path to get.null if the resource is not found.Enumeration<URL> getResources(String name) throws IOException
ClassLoaderDelegate.findResource(String) to find the resource.name - the resource path to get.null if the resource is not found.IOExceptionClass<?> loadClass(String name) throws ClassNotFoundException
ClassLoaderDelegate.findClass(String) to find the resource.name - the class name to load.ClassNotFoundExceptionvoid close()
void attachFragment(BundleData bundledata, ProtectionDomain domain, String[] classpath)
bundledata - The BundleData of the fragment.domain - The ProtectionDomain of the resources of the fragment.
Any classes loaded from the fragment's BundleData must belong to this
ProtectionDomain.classpath - An array of Bundle-ClassPath entries to
use for loading classes and resources. This is specified by the
Bundle-ClassPath manifest entry of the fragment.ClassLoaderDelegate getDelegate()
ClassLoader getParent()
List<URL> findEntries(String path, String filePattern, int options)
BundleWiring.findEntries(String, String, int) method.path - The path name in which to look.filePattern - The file name pattern for selecting resource names in
the specified path.options - The options for listing resource names.BundleWiring#findEntries(String, String, int)}Collection<String> listResources(String path, String filePattern, int options)
BundleWiring.listResources(String, String, int) method.
This method should simply return the result of calling
ClassLoaderDelegate.listResources(String, String, int)path - The path name in which to look.filePattern - The file name pattern for selecting resource names in
the specified path.options - The options for listing resource names.BundleWiring#listResources(String, String, int)},
ClassLoaderDelegate#listResources(String, String, int)}Collection<String> listLocalResources(String path, String filePattern, int options)
path - The path name in which to look.filePattern - The file name pattern for selecting resource names in
the specified path.options - The options for listing resource names.ClassLoaderDelegate#listResources(String, String, int)}Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.