public class CompositeConfigurator extends Object implements SynchronousBundleListener, HookConfigurator, AdaptorHook, ClassLoadingHook, CompositeBundleFactory, CompositeResolveHelperRegistry
COMPOSITE_SERVICE_FILTER_EXPORT, COMPOSITE_SERVICE_FILTER_IMPORT| Constructor and Description |
|---|
CompositeConfigurator() |
public void addHooks(HookRegistry hookRegistry)
HookConfiguratoraddHooks in interface HookConfiguratorhookRegistry - the hook registry used to add hookspublic void addProperties(Properties properties)
AdaptorHookFrameworkAdaptor.getProperties().
This method allows an adaptor hook to add property values to the adaptor
properties object.addProperties in interface AdaptorHookproperties - the adaptor properties object.public FrameworkLog createFrameworkLog()
AdaptorHookFrameworkAdaptor.getFrameworkLog().
The adaptor will call this method for each configured adaptor hook until one
adaptor hook returns a non-null value. If no adaptor hook returns a non-null value
then the adaptor will return null.createFrameworkLog in interface AdaptorHookpublic void frameworkStart(BundleContext context) throws BundleException
AdaptorHookFrameworkAdaptor.frameworkStart(BundleContext).
This method allows an adaptor hook to execute code when the framework is starting
(e.g. to register services).frameworkStart in interface AdaptorHookcontext - the system bundle contextBundleExceptionpublic void frameworkStop(BundleContext context)
AdaptorHookFrameworkAdaptor.frameworkStop(BundleContext).
This method allows an adaptor hook to execute code when the framework is stopped
(e.g. to unregister services).frameworkStop in interface AdaptorHookcontext - the system bundle contextpublic void frameworkStopping(BundleContext context)
AdaptorHookFrameworkAdaptor.frameworkStopping(BundleContext).
This method allows an adaptor hook to execute code when the framework is about to start
the shutdown process.frameworkStopping in interface AdaptorHookcontext - the system bundle contextpublic void handleRuntimeError(Throwable error)
AdaptorHookFrameworkAdaptor.handleRuntimeError(Throwable).
The adaptor will call this method for each configured adaptor hook.handleRuntimeError in interface AdaptorHookerror - the unexpected error that occured.public void initialize(BaseAdaptor initAdaptor)
AdaptorHookFrameworkAdaptor.initialize(EventPublisher).
This method allows an adaptor hook to save the adaptor object for later.initialize in interface AdaptorHookinitAdaptor - the adaptor object associated with this AdaptorHook.public URLConnection mapLocationToURLConnection(String location)
AdaptorHookFrameworkAdaptor.mapLocationToURLConnection(String).
The adaptor will call this method for each configured adaptor hook until one
adaptor hook returns a non-null value. If no adaptor hook returns a non-null value
then the adaptor will perform the default behavior.mapLocationToURLConnection in interface AdaptorHooklocation - a bundle location string to be converted to a URLConnectionpublic CompositeBundle installCompositeBundle(Map frameworkConfig, String location, Map compositeManifest) throws BundleException
CompositeBundleFactoryCompositeBundle. The composite bundle has a new
child Framework associated with it and a surrogate bundle
which is installed in the child framework. Composite bundles share
packages and services between the parent framework they are installed in and
the child framework.
The following steps are required to create a composite bundle:
CompositeBundle, then that
composite bundle is returned; otherwise a BundleException
is thrown indicating that an incompatible bundle is already installed at the
specified location.BundleException
is thrown.compositeManifest map is used to provide the headers for the
composite bundle and its surrogate bundle.
If composite manifest map does not contain the following header(s) then a BundleException is thrown:
Bundle-SymbolicName the
symbolic name used for the composite bundle and its surrogate bundle.
The composite manifest map may optionally contain the following header(s):
Bundle-Version the bundle version
used for the composite bundle and its surrogate bundle.Import-Package the packages which
are imported from the parent framework by the composite bundle and are
exported to the child framework by the surrogate bundle.Export-Package the packages which
are imported from the child framework by the surrogate bundle and are
exported to the parent framework by the composite bundle.CompositeServiceFilter-Import the service filters which are acquired
from the parent framework by the composite bundle and are registered in
the child framework by the surrogate bundle.CompositeServiceFilter-Export the service filters which are acquired
from the child framework by the surrogate bundle and are registered in
the parent framework by the composite bundle.Bundle-ManifestVersion the
bundle manifest version. If this header is not specified then the default
is to use version 2. A BundleException is thrown if this header is
specified and the version is less than 2.Require-Bundle a bundle from the parent
which is required by the child. Support for this header is experimental: a
BundleException should be thrown if the header is present and
the framework doesn't support it.
The composite manifest map must not contain the following headers. If a
composite manifest map does contain one of the following headers then a
BundleException is thrown:
Bundle-ActivationPolicy
Bundle-Activator
Bundle-ClassPath
Bundle-Localization
Bundle-NativeCode
Fragment-Host
DynamicImport-Package
org.osgi.framework.storage,
if specified, is ignored.Framework.init()).
BundleEvent.INSTALLED is fired for the
composite bundle.
CompositeBundle object for the new composite
bundle is returned.
installCompositeBundle in interface CompositeBundleFactoryframeworkConfig - A map containing configuration parameters used to
initialize and launch the child framework.location - The bundle location used for the composite and surrogate bundles.compositeManifest - A map containing the manifest used to create the composite
and surrogate bundlesBundleException - If the composite manifest is invalid or there is
some other problem with installing the composite bundle.Framework,
CompositeBundlepublic CompositeResolveHelper getCompositeResolveHelper(BundleDescription bundle)
getCompositeResolveHelper in interface CompositeResolveHelperRegistrypublic boolean addClassPathEntry(ArrayList cpEntries, String cp, ClasspathManager hostmanager, BaseData sourcedata, ProtectionDomain sourcedomain)
ClassLoadingHookaddClassPathEntry in interface ClassLoadingHookcpEntries - the list of ClasspathEntry objects currently available for the requested classpathcp - the name of the requested classpathhostmanager - the classpath manager the requested ClasspathEntry is forsourcedata - the source bundle data of the requested ClasspathEntrysourcedomain - the source domain of the requested ClasspathEntrypublic BaseClassLoader createClassLoader(ClassLoader parent, ClassLoaderDelegate delegate, BundleProtectionDomain domain, BaseData data, String[] bundleclasspath)
ClassLoadingHookBundleData.createClassLoader(ClassLoaderDelegate, BundleProtectionDomain, String[]).
The BaseData will call this method for each configured class loading hook until one data
hook returns a non-null value. If no class loading hook returns a non-null value then a
default implemenation of BundleClassLoader will be created.createClassLoader in interface ClassLoadingHookparent - the parent classloader for the BundleClassLoaderdelegate - the delegate for the bundle classloaderdomain - the domian for the bundle classloaderdata - the BundleData for the BundleClassLoaderbundleclasspath - the classpath for the bundle classloaderpublic String findLibrary(BaseData data, String libName)
ClassLoadingHookBundleData.findLibrary(String).
A base data will call this method for each configured class loading hook until one
class loading hook returns a non-null value. If no class loading hook returns
a non-null value then the base data will return null.findLibrary in interface ClassLoadingHookdata - the base data to find a native library for.libName - the name of the native library.public ClassLoader getBundleClassLoaderParent()
ClassLoadingHookFrameworkAdaptor.getBundleClassLoaderParent().
The adaptor will call this method for each configured class loading hook until one
class loading hook returns a non-null value. If no class loading hook returns
a non-null value then the adaptor will perform the default behavior.getBundleClassLoaderParent in interface ClassLoadingHookpublic void initializedClassLoader(BaseClassLoader baseClassLoader, BaseData data)
ClassLoadingHookClasspathManager.initialize().
The classpath manager will call this method for each configured class loading hook after it
has been initialized.initializedClassLoader in interface ClassLoadingHookbaseClassLoader - the newly created bundle classloaderdata - the BundleData associated with the bundle classloaderpublic byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager)
ClassLoadingHookprocessClass in interface ClassLoadingHookname - the name of the class being definedclassbytes - the bytes of the class being definedclasspathEntry - the ClasspathEntry where the class bytes have been read from.entry - the BundleEntry source of the class bytesmanager - the class path manager used to define the requested classpublic void bundleChanged(BundleEvent event)
BundleListenerbundleChanged in interface BundleListenerevent - The BundleEvent.Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.