You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DS is quite powerful and ease the usage of services, in most cases it even makes the component independent from using OSGi specific API.
There is just one use-case that currently is not well covered, that is the decorator pattern or at OSGi also known as the extender pattern.
Definition
In the context of Services/DS and this request I want to make the following definition:
A service E decorates Service S (or is an extender of S) when for each instance of S in the Service factory there is an instance of E that provides another functionality on behalf of s, that is e.g. wrapping and / or delegating some calls to S and if registering an own service adhere to the principle of property propagation as described in the OSGi Configuration Admin Specification.
Current state
Currently implementing this pattern requires to either use raw OSGi API (e.g. ServiceTrackerCustomizer or ManagedServiceFactory) loosing all benefits of DI/DS or a lot of boilerplate code also it makes the fact less visible (e.g. one component is visible but it registered multiple services that are not declared)
Proposed solution
A DS component is allowed to specify one of its static with 1..1 cardinality services as an "extendee"
A DS component is not allowed to register a service of extendee itself
This will create one new instance of the component for each extendee service getting this particular instance as its service reference
If the component is registers one or more services these must be registered with the component properties unioned by the public ones of the extendee
The text was updated successfully, but these errors were encountered:
DS is quite powerful and ease the usage of services, in most cases it even makes the component independent from using OSGi specific API.
There is just one use-case that currently is not well covered, that is the decorator pattern or at OSGi also known as the extender pattern.
Definition
In the context of Services/DS and this request I want to make the following definition:
Current state
Currently implementing this pattern requires to either use raw OSGi API (e.g.
ServiceTrackerCustomizer
orManagedServiceFactory
) loosing all benefits of DI/DS or a lot of boilerplate code also it makes the fact less visible (e.g. one component is visible but it registered multiple services that are not declared)Proposed solution
static
with1..1
cardinality services as an "extendee"The text was updated successfully, but these errors were encountered: