org.eclipse.osgi.baseadaptor
Class HookRegistry

java.lang.Object
  extended by org.eclipse.osgi.baseadaptor.HookRegistry

public final class HookRegistry
extends java.lang.Object

The hook registry is used to store all the hooks which are configured by the hook configurators.

Since:
3.2
See Also:
HookConfigurator

Field Summary
static java.lang.String HOOK_CONFIGURATORS
          The hook configurators property key ("hookconfigurators.properties") used in a hook configurators properties file to specify a comma separated list of fully qualified hook configurator classes.
static java.lang.String HOOK_CONFIGURATORS_FILE
          The hook configurators properties file ("hookconfigurators.properties") A framework extension may supply a hook configurators properties file to specify a list of hook configurators.
static java.lang.String PROP_HOOK_CONFIGURATORS
          A system property ("osgi.hook.configurators") used to specify the list of hook configurators.
static java.lang.String PROP_HOOK_CONFIGURATORS_EXCLUDE
          A system property ("osgi.hook.configurators.exclude") used to exclude any hook configurators.
static java.lang.String PROP_HOOK_CONFIGURATORS_INCLUDE
          A system property ("osgi.hook.configurators.include") used to add additional hook configurators.
 
Constructor Summary
HookRegistry(BaseAdaptor adaptor)
           
 
Method Summary
 void addAdaptorHook(AdaptorHook adaptorHook)
          Adds a adaptor hook to this hook registry.
 void addBundleFileFactoryHook(BundleFileFactoryHook factory)
          Adds a bundle file factory to this hook registry.
 void addBundleFileWrapperFactoryHook(BundleFileWrapperFactoryHook factory)
          Adds a bundle file wrapper factory for this hook registry
 void addClassLoadingHook(ClassLoadingHook classLoadingHook)
          Adds a class loading hook to this hook registry.
 void addClassLoadingStatsHook(ClassLoadingStatsHook classLoadingStatsHook)
          Adds a class loading stats hook to this hook registry.
 void addStorageHook(StorageHook storageHook)
          Adds a storage hook to this hook registry.
 void addWatcher(BundleWatcher watcher)
          Adds a bundle watcher to this hook registry.
 BaseAdaptor getAdaptor()
          Returns the base adaptor associated with this hook registry.
 AdaptorHook[] getAdaptorHooks()
          Returns the list of configured adaptor hooks.
 BundleFileFactoryHook[] getBundleFileFactoryHooks()
          Returns the list of configured bundle file factories.
 BundleFileWrapperFactoryHook[] getBundleFileWrapperFactoryHooks()
          Returns the configured bundle file wrapper factories
 ClassLoadingHook[] getClassLoadingHooks()
          Returns the list of configured class loading hooks.
 ClassLoadingStatsHook[] getClassLoadingStatsHooks()
          Returns the list of configured class loading stats hooks.
 StorageHook[] getStorageHooks()
          Returns the list of configured storage hooks.
 BundleWatcher[] getWatchers()
          Returns the list of configured bundle watchers.
 org.eclipse.osgi.framework.log.FrameworkLogEntry[] initialize()
          Initializes the hook configurators.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOOK_CONFIGURATORS_FILE

public static final java.lang.String HOOK_CONFIGURATORS_FILE
The hook configurators properties file ("hookconfigurators.properties")

A framework extension may supply a hook configurators properties file to specify a list of hook configurators.

See Also:
HOOK_CONFIGURATORS, Constant Field Values

HOOK_CONFIGURATORS

public static final java.lang.String HOOK_CONFIGURATORS
The hook configurators property key ("hookconfigurators.properties") used in a hook configurators properties file to specify a comma separated list of fully qualified hook configurator classes.

See Also:
Constant Field Values

PROP_HOOK_CONFIGURATORS_INCLUDE

public static final java.lang.String PROP_HOOK_CONFIGURATORS_INCLUDE
A system property ("osgi.hook.configurators.include") used to add additional hook configurators. This is helpful for configuring optional hook configurators.

See Also:
Constant Field Values

PROP_HOOK_CONFIGURATORS_EXCLUDE

public static final java.lang.String PROP_HOOK_CONFIGURATORS_EXCLUDE
A system property ("osgi.hook.configurators.exclude") used to exclude any hook configurators. This is helpful for disabling hook configurators that is specified in hook configurator properties files.

See Also:
Constant Field Values

PROP_HOOK_CONFIGURATORS

public static final java.lang.String PROP_HOOK_CONFIGURATORS
A system property ("osgi.hook.configurators") used to specify the list of hook configurators. If this property is set then the list of configurators specified will be the only configurators used.

See Also:
Constant Field Values
Constructor Detail

HookRegistry

public HookRegistry(BaseAdaptor adaptor)
Method Detail

initialize

public org.eclipse.osgi.framework.log.FrameworkLogEntry[] initialize()
Initializes the hook configurators. The following steps are used to initialize the hook configurators.

1. Get a list of hook configurators from all hook configurators properties files on the classpath, add this list to the overall list of hook configurators, remove duplicates.

2. Get a list of hook configurators from the ("osgi.hook.configurators.include") system property and add this list to the overall list of hook configurators, remove duplicates.

3. Get a list of hook configurators from the ("osgi.hook.configurators.exclude") system property and remove this list from the overall list of hook configurators.

4. Load each hook configurator class, create a new instance, then call the HookConfigurator.addHooks(HookRegistry) method

5. Set this HookRegistry object to read only to prevent any other hooks from being added.

Returns:
an array of error log entries that occurred while initializing the hooks

getAdaptorHooks

public AdaptorHook[] getAdaptorHooks()
Returns the list of configured adaptor hooks.

Returns:
the list of configured adaptor hooks.

getWatchers

public BundleWatcher[] getWatchers()
Returns the list of configured bundle watchers.

Returns:
the list of configured bundle watchers.

getClassLoadingHooks

public ClassLoadingHook[] getClassLoadingHooks()
Returns the list of configured class loading hooks.

Returns:
the list of configured class loading hooks.

getClassLoadingStatsHooks

public ClassLoadingStatsHook[] getClassLoadingStatsHooks()
Returns the list of configured class loading stats hooks.

Returns:
the list of configured class loading stats hooks.

getStorageHooks

public StorageHook[] getStorageHooks()
Returns the list of configured storage hooks.

Returns:
the list of configured storage hooks.

getBundleFileFactoryHooks

public BundleFileFactoryHook[] getBundleFileFactoryHooks()
Returns the list of configured bundle file factories.

Returns:
the list of configured bundle file factories.

getBundleFileWrapperFactoryHooks

public BundleFileWrapperFactoryHook[] getBundleFileWrapperFactoryHooks()
Returns the configured bundle file wrapper factories

Returns:
the configured bundle file wrapper factories

addAdaptorHook

public void addAdaptorHook(AdaptorHook adaptorHook)
Adds a adaptor hook to this hook registry.

Parameters:
adaptorHook - an adaptor hook object.

addWatcher

public void addWatcher(BundleWatcher watcher)
Adds a bundle watcher to this hook registry.

Parameters:
watcher - a bundle watcher object.

addClassLoadingHook

public void addClassLoadingHook(ClassLoadingHook classLoadingHook)
Adds a class loading hook to this hook registry.

Parameters:
classLoadingHook - a class loading hook object.

addClassLoadingStatsHook

public void addClassLoadingStatsHook(ClassLoadingStatsHook classLoadingStatsHook)
Adds a class loading stats hook to this hook registry.

Parameters:
classLoadingStatsHook - a class loading hook object.

addStorageHook

public void addStorageHook(StorageHook storageHook)
Adds a storage hook to this hook registry.

Parameters:
storageHook - a storage hook object.

addBundleFileFactoryHook

public void addBundleFileFactoryHook(BundleFileFactoryHook factory)
Adds a bundle file factory to this hook registry.

Parameters:
factory - a bundle file factory object.

addBundleFileWrapperFactoryHook

public void addBundleFileWrapperFactoryHook(BundleFileWrapperFactoryHook factory)
Adds a bundle file wrapper factory for this hook registry

Parameters:
factory - a bundle file wrapper factory object.

getAdaptor

public BaseAdaptor getAdaptor()
Returns the base adaptor associated with this hook registry.

Returns:
the base adaptor associated with this hook registry.