org.eclipse.osgi.framework.adaptor
Interface ClassLoaderDelegate

All Known Implementing Classes:
BundleLoader, SystemBundleLoader

public interface ClassLoaderDelegate

A ClassLoaderDelegate is used by the BundleClassLoader in a similar fashion that a parent ClassLoader is used. A ClassLoaderDelegate must be queried for any resource or class before it is loaded by the BundleClassLoader. The Framework implements the ClassLoaderDelegate and supplies it to the BundleClassLoader. FrameworkAdaptor implementations are not responsible for suppling an implementation for ClassLoaderDelegate.

This interface is not intended to be implemented by clients.

Since:
3.1

Method Summary
 java.lang.Class findClass(java.lang.String classname)
          Finds a class for a bundle that may be outside of the actual bundle (i.e. a class from an imported package or required bundle).
 java.lang.String findLibrary(java.lang.String libraryname)
          Returns the absolute path name of a native library.
 java.net.URL findResource(java.lang.String resource)
          Finds a resource for a bundle that may be outside of the actual bundle (i.e. a resource from an imported package or required bundle).
 java.util.Enumeration findResources(java.lang.String resource)
          Finds an enumeration of resources for a bundle that may be outside of the actual bundle (i.e. a resource from an imported package or required bundle).
 

Method Detail

findClass

java.lang.Class findClass(java.lang.String classname)
                          throws java.lang.ClassNotFoundException
Finds a class for a bundle that may be outside of the actual bundle (i.e. a class from an imported package or required bundle).

If the class does not belong to an imported package or is not found in a required bundle then the ClassloaderDelegate will call BundleClassLoader.findLocalClass().

If no class is found then a ClassNotFoundException is thrown.

Parameters:
classname - the class to find.
Returns:
the Class.
Throws:
java.lang.ClassNotFoundException - if the class is not found.

findResource

java.net.URL findResource(java.lang.String resource)
Finds a resource for a bundle that may be outside of the actual bundle (i.e. a resource from an imported package or required bundle).

If the resource does not belong to an imported package or is not found in a required bundle then the ClassloaderDelegate will call BundleClassLoader.findLocalResource().

If no resource is found then return null.

Parameters:
resource - the resource to load.
Returns:
the resource or null if resource is not found.

findResources

java.util.Enumeration findResources(java.lang.String resource)
                                    throws java.io.IOException
Finds an enumeration of resources for a bundle that may be outside of the actual bundle (i.e. a resource from an imported package or required bundle).

If the resource does not belong to an imported package or is not found in a required bundle then the ClassloaderDelegate will call BundleClassLoader.findLocalResource().

If no resource is found then return null.

Parameters:
resource - the resource to find.
Returns:
the enumeration of resources found or null if the resource does not exist.
Throws:
java.io.IOException

findLibrary

java.lang.String findLibrary(java.lang.String libraryname)
Returns the absolute path name of a native library. The following is a list of steps that a ClassLoaderDelegate must take when trying to find a library: If no library is found return null.

Parameters:
libraryname - the library to find the path to.
Returns:
the path to the library or null if not found.