org.eclipse.osgi.framework.adaptor
Interface ClassLoaderDelegateHook


public interface ClassLoaderDelegateHook

A ClassLoaderDelegateHook hooks into the ClassLoaderDelegate.

Since:
3.4
See Also:
ClassLoaderDelegate, HookRegistry.getClassLoaderDelegateHooks(), HookRegistry.addClassLoaderDelegateHook(ClassLoaderDelegateHook)

Method Summary
 java.lang.Class postFindClass(java.lang.String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate.findClass(String) method after delegating to the resolved constraints and local bundle for a class load.
 java.lang.String postFindLibrary(java.lang.String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate after normal delegation.
 java.net.URL postFindResource(java.lang.String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate after delegating to the resolved constraints and local bundle for a resource load.
 java.util.Enumeration postFindResources(java.lang.String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate after delegating to the resolved constraints and local bundle for a resource load.
 java.lang.Class preFindClass(java.lang.String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate.findClass(String) method before delegating to the resolved constraints and local bundle for a class load.
 java.lang.String preFindLibrary(java.lang.String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate before normal delegation.
 java.net.URL preFindResource(java.lang.String name, BundleClassLoader classLoader, BundleData data)
          Called by a #findResource(String) before delegating to the resolved constraints and local bundle for a resource load.
 java.util.Enumeration preFindResources(java.lang.String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate before delegating to the resolved constraints and local bundle for a resource load.
 

Method Detail

preFindClass

java.lang.Class preFindClass(java.lang.String name,
                             BundleClassLoader classLoader,
                             BundleData data)
                             throws java.lang.ClassNotFoundException
Called by a ClassLoaderDelegate.findClass(String) method before delegating to the resolved constraints and local bundle for a class load. If this method returns null then normal delegation is done. If this method returns a non-null value then the rest of the delegation process is skipped and the returned value is used. If this method throws a ClassNotFoundException then the calling ClassLoaderDelegate.findClass(String) method re-throws the exception.

Parameters:
name - the name of the class to find
classLoader - the bundle class loader
data - the bundle data
Returns:
the class found by this hook or null if normal delegation should continue
Throws:
java.lang.ClassNotFoundException - to terminate the delegation and throw an exception

postFindClass

java.lang.Class postFindClass(java.lang.String name,
                              BundleClassLoader classLoader,
                              BundleData data)
                              throws java.lang.ClassNotFoundException
Called by a ClassLoaderDelegate.findClass(String) method after delegating to the resolved constraints and local bundle for a class load. This method will only be called if no class was found from the normal delegation.

Parameters:
name - the name of the class to find
classLoader - the bundle class loader
data - the bundle data
Returns:
the class found by this hook or null if normal delegation should continue
Throws:
java.lang.ClassNotFoundException - to terminate the delegation and throw an exception

preFindResource

java.net.URL preFindResource(java.lang.String name,
                             BundleClassLoader classLoader,
                             BundleData data)
                             throws java.io.FileNotFoundException
Called by a #findResource(String) before delegating to the resolved constraints and local bundle for a resource load. If this method returns null then normal delegation is done. If this method returns a non-null value then the rest of the delegation process is skipped and the returned value is used. If this method throws an FileNotFoundException then the delegation is terminated.

Parameters:
name - the name of the resource to find
classLoader - the bundle class loader
data - the bundle data
Returns:
the resource found by this hook or null if normal delegation should continue
Throws:
java.io.FileNotFoundException - to terminate the delegation

postFindResource

java.net.URL postFindResource(java.lang.String name,
                              BundleClassLoader classLoader,
                              BundleData data)
                              throws java.io.FileNotFoundException
Called by a ClassLoaderDelegate after delegating to the resolved constraints and local bundle for a resource load. This method will only be called if no resource was found from the normal delegation.

Parameters:
name - the name of the resource to find
classLoader - the bundle class loader
data - the bundle data
Returns:
the resource found by this hook or null if normal delegation should continue
Throws:
java.io.FileNotFoundException - to terminate the delegation

preFindResources

java.util.Enumeration preFindResources(java.lang.String name,
                                       BundleClassLoader classLoader,
                                       BundleData data)
                                       throws java.io.FileNotFoundException
Called by a ClassLoaderDelegate before delegating to the resolved constraints and local bundle for a resource load. If this method returns null then normal delegation is done. If this method returns a non-null value then the rest of the delegation process is skipped and the returned value is used. If this method throws an FileNotFoundException then the delegation is terminated

Parameters:
name - the name of the resource to find
classLoader - the bundle class loader
data - the bundle data
Returns:
the resources found by this hook or null if normal delegation should continue
Throws:
java.io.FileNotFoundException - to terminate the delegation

postFindResources

java.util.Enumeration postFindResources(java.lang.String name,
                                        BundleClassLoader classLoader,
                                        BundleData data)
                                        throws java.io.FileNotFoundException
Called by a ClassLoaderDelegate after delegating to the resolved constraints and local bundle for a resource load. This method will only be called if no resources were found from the normal delegation.

Parameters:
name - the name of the resource to find
classLoader - the bundle class loader
data - the bundle data
Returns:
the resources found by this hook or null if normal delegation should continue
Throws:
java.io.FileNotFoundException - to terminate the delegation

preFindLibrary

java.lang.String preFindLibrary(java.lang.String name,
                                BundleClassLoader classLoader,
                                BundleData data)
                                throws java.io.FileNotFoundException
Called by a ClassLoaderDelegate before normal delegation. If this method returns a non-null value then the rest of the delegation process is skipped and the returned value is used.

Parameters:
name - the name of the library to find
classLoader - the bundle class loader
data - the bundle data
Returns:
the library found by this hook or null if normal delegation should continue
Throws:
java.io.FileNotFoundException - to terminate the delegation

postFindLibrary

java.lang.String postFindLibrary(java.lang.String name,
                                 BundleClassLoader classLoader,
                                 BundleData data)
Called by a ClassLoaderDelegate after normal delegation. This method will only be called if no library was found from the normal delegation.

Parameters:
name - the name of the library to find
classLoader - the bundle class loader
data - the bundle data
Returns:
the library found by this hook or null if normal delegation should continue
Throws:
java.io.FileNotFoundException - to terminate the delegation