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
 Class<?> postFindClass(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.
 String postFindLibrary(String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate after normal delegation.
 URL postFindResource(String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate after delegating to the resolved constraints and local bundle for a resource load.
 Enumeration<URL> postFindResources(String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate after delegating to the resolved constraints and local bundle for a resource load.
 Class<?> preFindClass(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.
 String preFindLibrary(String name, BundleClassLoader classLoader, BundleData data)
          Called by a ClassLoaderDelegate before normal delegation.
 URL preFindResource(String name, BundleClassLoader classLoader, BundleData data)
          Called by a #findResource(String) before delegating to the resolved constraints and local bundle for a resource load.
 Enumeration<URL> preFindResources(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

Class<?> preFindClass(String name,
                      BundleClassLoader classLoader,
                      BundleData data)
                      throws 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:
ClassNotFoundException - to terminate the delegation and throw an exception

postFindClass

Class<?> postFindClass(String name,
                       BundleClassLoader classLoader,
                       BundleData data)
                       throws 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:
ClassNotFoundException - to terminate the delegation and throw an exception

preFindResource

URL preFindResource(String name,
                    BundleClassLoader classLoader,
                    BundleData data)
                    throws 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:
FileNotFoundException - to terminate the delegation

postFindResource

URL postFindResource(String name,
                     BundleClassLoader classLoader,
                     BundleData data)
                     throws 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:
FileNotFoundException - to terminate the delegation

preFindResources

Enumeration<URL> preFindResources(String name,
                                  BundleClassLoader classLoader,
                                  BundleData data)
                                  throws 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:
FileNotFoundException - to terminate the delegation

postFindResources

Enumeration<URL> postFindResources(String name,
                                   BundleClassLoader classLoader,
                                   BundleData data)
                                   throws 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:
FileNotFoundException - to terminate the delegation

preFindLibrary

String preFindLibrary(String name,
                      BundleClassLoader classLoader,
                      BundleData data)
                      throws 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:
FileNotFoundException - to terminate the delegation

postFindLibrary

String postFindLibrary(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


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.