Hello Serge,

An alternative to bundle scanning is to have an auxiliary service to
provide information of what services are expected to be available. I see
two approaches.
* One auxiliary service per addon service with the responsibility of
informing the platform of.the expected presence of the addon service. The
platform would consume these auxiliary services to get some metadata that
it could use to validate the presence of the addon service.

* Have an auxiliary service per product variant where the mandatory
requirements would be defined and have the platform depend on this
auxiliary service.
For example the platform would depend on a ProductSpec service. For Product
A you could have an implementation of ProductSpec that would have AddonX
and AddonY as mandatory. For Product B the implementation of ProductSpec
would require AddonX and AddonZ. Depending on the product you would provide
the appropriate ProductSpec, either via a separate bundle or via
configuration admin. With this the platform would only activate if a
ProductSpec requirements are fulfilled.

You can also check OSGi Requirements and Capabilities to see if the
framework provides anything that suits your needs.

Regards,
João Assunção

Email: [email protected]
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com




On Thu, Nov 4, 2021 at 9:13 AM Serge Démoulin <[email protected]>
wrote:

> Hi
>
> We are developing a platform based on bundles
> Our products are based on this platform.
> product = platform bundles + product specific bundles
>
> A product can change the behaviour of the platform by implementing
> singleton OSGi services
>
>
> We would like make these service optional but it's not easy
> Therefore if the platform doesn't find such a service there too
> possibilities
> - the product doesn't implement this service. The platform behaviour stay
> unchanged, alright
> - the product intends to implement the service in a bundle but the bundle
> that implement this service is broken. In this case the product has not the
> right behaviour
>
> The complex solution that we implement is
> Such service is seen as mandatory by the platform and the platform has a
> default implementation of the service in a bundle .
> The build of the product removes this bundle and bring its own bundle
>
> This build is error-prone and expensive to realize.
>
> Do have an idea how we should have optional service but detect if the
> product intends to implement the service (without integration tests in the
> product that test the correct behaviour) ?
>
> An idea for instance
> If the service are declare with @Component
> Scan every MANIFEST.MF to find pretty exactly which services are intended
> to be implemented
>
> Best regards
>
> Serge
>

Reply via email to