Package org.apache.felix.dm
Class DependencyManager
java.lang.Object
org.apache.felix.dm.compat.DependencyManagerCompat
org.apache.felix.dm.DependencyManager
The dependency manager manages all components and their dependencies. Using
this API you can declare all components and their dependencies. Under normal
circumstances, you get passed an instance of this class through the
DependencyActivatorBase subclass you use as your
BundleActivator, but it is also possible to create your
own instance.- Author:
- Felix Project Team
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDependencyManager(org.osgi.framework.BundleContext context) Creates a new dependency manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new component to the dependency manager.voidclear()Removes all components and their dependencies.Creates a new adapter component.Creates a new aspect component.Creates a new bundle adapter.Creates a new bundle dependency.Creates a new component.Creates a new configuration dependency.Creates a new Factory 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 timed required service dependency.org.osgi.framework.BundleContextReturns the bundle context associated with this dependency manager.Returns a list of components.static List<DependencyManager> Returns the list of currently created dependency managers.voidRemoves a service from the dependency manager.Methods inherited from class org.apache.felix.dm.compat.DependencyManagerCompat
createAdapterFactoryConfigurationService, createAdapterService, createAdapterService, createAdapterService, createAdapterService, createAdapterService, createAspectService, createAspectService, createAspectService, createAspectService, createAspectService, createBundleAdapterService, createBundleAdapterService, createFactoryConfigurationAdapterService, createFactoryConfigurationAdapterService, createFactoryConfigurationAdapterService, createFactoryConfigurationAdapterService, createResourceAdapterService, createResourceAdapterService, createResourceAdapterService, createResourceAdapterService
-
Field Details
-
PARALLEL
The DependencyManager Activator will wait for a threadpool before creating any DM components if the following OSGi system property is set to true.- See Also:
-
ASPECT
- See Also:
-
SERVICEREGISTRY_CACHE_INDICES
- See Also:
-
METHOD_CACHE_SIZE
- See Also:
-
-
Constructor Details
-
DependencyManager
public DependencyManager(org.osgi.framework.BundleContext context) Creates a new dependency manager. You need to supply theBundleContextto be used by the dependency manager to register services and communicate with the framework.- Parameters:
context- the bundle context
-
-
Method Details
-
getLogger
-
getDependencyManagers
Returns the list of currently created dependency managers.- Returns:
- the list of currently created dependency managers
-
getBundleContext
public org.osgi.framework.BundleContext getBundleContext()Returns the bundle context associated with this dependency manager.- Returns:
- the bundle context associated with this dependency manager.
-
add
Adds a new component to the dependency manager. After the service is added it will be started immediately.- Parameters:
c- the service to add
-
remove
Removes a service from the dependency manager. Before the service is removed it is stopped first.- Parameters:
c- the component to remove
-
createComponent
Creates a new component.- Returns:
- the new component
-
createServiceDependency
Creates a new service dependency.- Returns:
- the service dependency
-
createConfigurationDependency
Creates a new configuration dependency.- Returns:
- the configuration dependency
-
createBundleDependency
Creates a new bundle dependency.- Returns:
- a new BundleDependency instance.
-
createResourceDependency
Creates a new resource dependency.- Returns:
- the resource dependency
-
createTemporalServiceDependency
Creates a new timed required service dependency. A timed dependency blocks the invoker thread is the required dependency is currently unavailable, until it comes up again.- Returns:
- a new timed service dependency
-
createAdapterComponent
Creates a new adapter component. The adapter will be applied to any service that matches the specified interface and filter. For each matching service an adapter will be created based on the adapter implementation class. The adapter will be registered with the specified interface and existing properties from the original service plus any extra properties you supply here. It will also inherit all dependencies, and if you declare the original service as a member it will be injected.- Specified by:
createAdapterComponentin classDependencyManagerCompat- Returns:
- an adapter component
-
createFactoryComponent
Creates a new Factory Component. For each new factory configuration matching the factoryPid, a component will be created based on the component implementation class. The component will be registered with the specified interface, and with the specified service properties. Depending on thepropagateparameter, every public factory configuration properties (which don't start with ".") will be propagated along with the adapter service properties. It will also inherit all dependencies.- Specified by:
createFactoryComponentin classDependencyManagerCompat- Returns:
- a factory pid component
-
createBundleComponent
Creates a new bundle adapter. The adapter will be applied to any bundle that matches the specified bundle state mask and filter condition. For each matching bundle an adapter will be created based on the adapter implementation class. The adapter will be registered with the specified interface TODO and existing properties from the original resource plus any extra properties you supply here. It will also inherit all dependencies, and if you declare the original service as a member it will be injected.- Specified by:
createBundleComponentin classDependencyManagerCompat- Returns:
- a service that acts as a factory for generating bundle adapters
-
createResourceComponent
Creates a new resource adapter component. The adapter will be applied to any resource that matches the specified filter condition. For each matching resource an adapter will be created based on the adapter implementation class. The adapter will be registered with the specified interface and existing properties from the original resource plus any extra properties you supply here. It will also inherit all dependencies, and if you declare the original service as a member it will be injected.- Specified by:
createResourceComponentin classDependencyManagerCompat- Returns:
- a Resource Adapter Component
-
getComponents
Returns a list of components.- Returns:
- a list of components
-
createAspectComponent
Creates a new aspect component. The aspect will be applied to any service that matches the specified interface and filter. For each matching service an aspect will be created based on the aspect implementation class. The aspect will be registered with the same interface and properties as the original service, plus any extra properties you supply here. It will also inherit all dependencies, and if you declare the original service as a member it will be injected.- Specified by:
createAspectComponentin classDependencyManagerCompat- Returns:
- an aspect component
-
clear
public void clear()Removes all components and their dependencies. -
createPropertyMetaData
Creates a new configuration property metadata.- Returns:
- the configuration property metadata.
-