Starts the given capsule and adds it to the current capsule scope.
Starts the given capsule and adds it to the current capsule scope.
capsule
Returns the bundle context as long as the bundle is active.
Returns the bundle context as long as the bundle is active.
Dependency
Dependency
Creates a new capsule scope on top of the active one and executes the given function in it.
Creates a new capsule scope on top of the active one and executes the given function in it. So the function sees the new capsule scope as the current one.
the function which might add capsules to the new scope
the new scope
Adds the given start logic.
Adds the given start logic. The logic is executed immediately.
start logic
Adds the given stop logic.
Adds the given stop logic. The given function will be executed when the current scope is stopped.
stop logic
Returns the first available service of the specified class which satisfies the filter if available.
Returns the first available service of the specified class which satisfies the filter if available. If the service
is not available, it returns None
. The service is not explicitly released.
service type
filter expression
service if available
Returns the highest-ranked service of the specified type if available.
Returns the highest-ranked service of the specified type if available. The service is not explicitly released. It's assumed that the service will be used until the bundle stops. Doesn't take type parameters into account!
service type
service if available
Dependency
Dependency
Dependency
Dependency
Like service with filter but returns the service reference.
Like service with filter but returns the service reference.
Like service but returns the reference so you can access meta information about that service.
Like service but returns the reference so you can access meta information about that service.
An implicit conversion adds a service
property to the reference, so you can simply use that to obtain the service.
Doesn't take type parameters into account!
Converts a service reference to a rich service reference so one can easily obtain the
corresponding service by calling service
, for example.
Converts a service reference to a rich service reference so one can easily obtain the
corresponding service by calling service
, for example.
Like services with filters but returns the references.
Like services with filters but returns the references.
Like services but returns service references.
Like services but returns service references.
Automatically converts any object to a ProvidableService.
Automatically converts any object to a ProvidableService.
ProvidableService for the list of service registration methods
Returns all services of the specified type which satisfy the given filter.
Returns all services of the specified type which satisfy the given filter.
service type
filter expression
services
Returns all services of the given type.
Lets you react to service events for services with the specified type which match the given filter.
Lets you react to service events for services with the specified type which match the given filter.
Service type
Service event handler
Underlying service tracker
Reacts to bundle events with the given event handler.
Reacts to bundle events with the given event handler.
bundle event handler
underlying bundle tracker
Lets you react to service events for services with the specified type.
Lets you react to service events for services with the specified type.
Service type
Service event handler
Underlying service tracker
Activates the given inner logic as long as the first service of the given type is present.
Activates the given inner logic as long as the first service of the given type is present. This implements the concept of required services. The inner logic is started as soon as a service s of the given type gets present and stopped when s is removed.
Idea for roadmap: Fallback to another service if s is removed and another service of the type is available (reevaluate capsule).
Defines a handler f
to be executed when the bundle becomes active.
Defines a handler f
to be executed when the bundle becomes active. f
is executed as soon as the bundle
activator's start
method is called. This should be called in the constructor of your activator.
In f
, you have the opportunity to add so called capsules, which have their own start
and stop
methods
(a kind of mini bundles). Their stop
methods will be invoked as soon as the bundle activator's stop
method
is called. So you have the big chance here to encapsulate start and stop logic at one place, making the bundle
activator less error-prone, better readable and easier to write.
Handler
Like the same-named method which expects the service PID but takes the service PID from the given object class definition and registers a corresponding meta type provider so a nice configuration GUI will be created.
Like the same-named method which expects the service PID but takes the service PID from the given object class definition and registers a corresponding meta type provider so a nice configuration GUI will be created.
object class definition
handler
the managed service registration
Executes the given handler with the initial configuration or an empty map if none exists.
Executes the given handler with the initial configuration or an empty map if none exists. Whenever the configuration is changed, the capsules registered in the handler are stopped and the handler is executed again with the new configuration.
service PID
optional metatype provider
handler
the managed service registration
Like the same-named method which expects the service PID but takes the service PID from the given object class definition and registers a corresponding meta type provider so a nice configuration GUI will be created.
Like the same-named method which expects the service PID but takes the service PID from the given object class definition and registers a corresponding meta type provider so a nice configuration GUI will be created.
object class definition
handler
the managed service factory registration
Executes the given handler whenever a new factory configuration is created.
Executes the given handler whenever a new factory configuration is created. Whenever a factory configuration is changed, the correct capsules registered in the corresponding handler are stopped and the handler is executed again with the new factory configuration. When the factory configuration is removed, the corresponding capsules are stopped.
service PID
descriptive name for the factory
optional metatype provider
handler
the managed service factory registration
Waits until a service of the specified type is available and executes the given event handler with it.
Waits until a service of the specified type is available and executes the given event handler with it.
When the service disappears, the capsules added in the handlers are stopped.
You can wait on a bunch of services if you nest whenServicePresent
methods.
Service type
Handler
Underlying service tracker
Executes the given handler with the first available service of the specified class which satisfies the filter if available.
Executes the given handler with the first available service of the specified class which satisfies the filter
if available. If it's not available, it still executes it but with None
.
When the handler returns, the service is released using org.osgi.framework.BundleContext#ungetService.
service type
function result type
filter expression
handler that uses the service
handler result
Executes the given handler with the highest-ranked service of the specified type.
Executes the given handler with the highest-ranked service of the specified type. If it's not available,
it still executes it but with None
. Doesn't take type parameters into account!
When the handler returns, the service is released using org.osgi.framework.BundleContext#ungetService.
service type
function result type
handler that uses the service
handler result
Basic methods
Methods for obtaining access to OSGi service references
Methods for obtaining access to OSGi services
Functionality for exposing arbitrary objects in the OSGi service registry.
Methods for waiting until services become available
Methods for reacting to bundle events
Methods for listening to configuration updates
Methods for listening to factory configuration additions, updates and removals
Methods for reacting to service events