|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BundleClassLoader
The BundleClassLoader interface is used by the Framework to load local classes and resources from a Bundle. Classes that implement this interface must extend java.lang.ClassLoader, either directly or by extending a subclass of java.lang.ClassLoader.
ClassLoaders that implement the BundleClassLoader interface
must use a ClassLoaderDelegate to delegate all class, resource
and native library lookups.
Clients may implement this interface.
BundleData.createClassLoader(ClassLoaderDelegate, BundleProtectionDomain, String[])| Method Summary | |
|---|---|
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. |
| Methods inherited from interface org.osgi.framework.BundleReference |
|---|
getBundle |
| Method Detail |
|---|
void 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.
IOException
Class<?> 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)}
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||