Package org.apache.felix.dm
Class DependencyActivatorBase
java.lang.Object
org.apache.felix.dm.compat.DependencyActivatorBaseCompat
org.apache.felix.dm.DependencyActivatorBase
- All Implemented Interfaces:
org.osgi.framework.BundleActivator
public abstract class DependencyActivatorBase
extends DependencyActivatorBaseCompat
implements org.osgi.framework.BundleActivator
Base bundle activator class. Subclass this activator if you want to use dependency
management in your bundle. There are two methods you should implement:
init() and destroy(). Both methods take two arguments,
the bundle context and the dependency manager. The dependency manager can be used
to define all the dependencies.- Author:
- Felix Project Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new adapter service.Creates a new aspect component.Creates a new bundle adapter component.Creates a new bundle dependency.Creates a new component.Creates a new configuration dependency.Creates a new factory configuration component.Creates a new configuration property metadata.Creates a new resource adapter component.Creates a new resource dependency.Creates a new service dependency.createTemporalServiceDependency(long timeout) Creates a new temporal service dependency.voiddestroy(org.osgi.framework.BundleContext context, DependencyManager manager) Destroy the dependency manager.org.osgi.framework.BundleContextReturns the bundle context that is associated with this bundle.Returns the dependency manager that is associated with this bundle.Returns the logger that is associated with this bundle.abstract voidinit(org.osgi.framework.BundleContext context, DependencyManager manager) Initialize the dependency manager.voidstart(org.osgi.framework.BundleContext context) Start method of the bundle activator.voidstop(org.osgi.framework.BundleContext context) Stop method of the bundle activator.Methods inherited from class org.apache.felix.dm.compat.DependencyActivatorBaseCompat
createAdapterService, createAdapterService, createAdapterService, createAdapterService, createAdapterService, createAdapterService, createAspectService, createAspectService, createAspectService, createAspectService, createAspectService, createBundleAdapterService, createBundleAdapterService, createFactoryConfigurationAdapterService, createFactoryConfigurationAdapterService, createFactoryConfigurationAdapterService, createFactoryConfigurationAdapterService, createFactoryConfigurationAdapterService, createResourceAdapter, createResourceAdapter, createResourceAdapter, createResourceAdapter, setDependencyManager
-
Constructor Details
-
DependencyActivatorBase
public DependencyActivatorBase()
-
-
Method Details
-
init
public abstract void init(org.osgi.framework.BundleContext context, DependencyManager manager) throws Exception Initialize the dependency manager. Here you can add all components and their dependencies. If something goes wrong and you do not want your bundle to be started, you can throw an exception. This exception will be passed on to thestart()method of the bundle activator, causing the bundle not to start.- Parameters:
context- the bundle contextmanager- the dependency manager- Throws:
Exception- if the initialization fails
-
destroy
public void destroy(org.osgi.framework.BundleContext context, DependencyManager manager) throws Exception Destroy the dependency manager. Here you can remove all components and their dependencies. Actually, the base class will clean up your dependencies anyway, so most of the time you don't need to do anything here.If something goes wrong and you do not want your bundle to be stopped, you can throw an exception. This exception will be passed on to the
stop()method of the bundle activator, causing the bundle not to stop.- Parameters:
context- the bundle contextmanager- the dependency manager- Throws:
Exception- if the destruction fails
-
start
Start method of the bundle activator. Initializes the dependency manager and callsinit().- Specified by:
startin interfaceorg.osgi.framework.BundleActivator- Parameters:
context- the bundle context- Throws:
Exception
-
stop
Stop method of the bundle activator. Calls thedestroy()method and cleans up all left over dependencies.- Specified by:
stopin interfaceorg.osgi.framework.BundleActivator- Parameters:
context- the bundle context- Throws:
Exception
-
getBundleContext
public org.osgi.framework.BundleContext getBundleContext()Returns the bundle context that is associated with this bundle.- Returns:
- the bundle context
-
getDependencyManager
Returns the dependency manager that is associated with this bundle.- Returns:
- the dependency manager
-
getLogger
Returns the logger that is associated with this bundle. A logger instance is a proxy that will log to a real OSGi logservice if available and standard out if not.- Returns:
- the logger
-
createComponent
Creates a new component.- Returns:
- the new component
-
createBundleComponent
Creates a new bundle adapter component.- Returns:
- the bundle adapter component
-
createAspectComponent
Creates a new aspect component.- Returns:
- the aspect component
- See Also:
-
createAdapterComponent
Creates a new adapter service.- Returns:
- the adapter service
- See Also:
-
createFactoryComponent
Creates a new factory configuration component.- Returns:
- the factory configuration component
- See Also:
-
createServiceDependency
Creates a new service dependency.- Returns:
- the service dependency
-
createTemporalServiceDependency
Creates a new temporal service dependency.- Parameters:
timeout- the max number of milliseconds to wait for a service availability.- Returns:
- the service dependency
-
createConfigurationDependency
Creates a new configuration dependency.- Returns:
- the configuration dependency
-
createPropertyMetaData
Creates a new configuration property metadata.- Returns:
- the configuration property metadata
-
createBundleDependency
Creates a new bundle dependency.- Returns:
- the bundle dependency
-
createResourceDependency
Creates a new resource dependency.- Returns:
- the resource dependency
-
createResourceComponent
Creates a new resource adapter component.- Returns:
- the resource adapter component
-