Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSGI configuration bundle [closed]

I'm new on diving in the OSGi world. I'm trying to develop an application with the following modules(bundles):

  • model
  • services-api
  • default-services
  • web

Suppose the default-service bundle contains internal data access services.Therefore, it needs some configuration for the database access. It doesn't feel right to me to place the DB configuration within the default-services bundle. Also, the web bundle should not know how the default-service is internally wired.

My question is: Does OSGi have a concept of configuration bundle? My idea was to deploy a bundle responsible for the default-service configuration. Is there a similar solution for that?

like image 220
Bruno Barin Avatar asked Oct 25 '12 08:10

Bruno Barin


3 Answers

Have you looked at ConfigurationAdmin service? Your bundles should use ConfigurationAdmin to receive their configuration. If you use Declarative Services in your bundles, DS will automate the use of ConfigurationAdmin for you.

like image 69
BJ Hargrave Avatar answered Sep 18 '22 13:09

BJ Hargrave


Depending on how you expect to do configuration, fragments may suit your needs. They allow you to add extra information to the existing bundles classpath. We use this to provide different configurations for different runtime environments (dev, test, ...). You simply deploy the appropriate fragment bundle to have the correct configuration.

like image 42
Robin Avatar answered Sep 21 '22 13:09

Robin


I actually developed a little bundle that can detect configuration data in other bundles with the extender pattern. In my case this is a Jason file. Got some special tricks to handle passwords and binary files like ssl certificates.

like image 21
Peter Kriens Avatar answered Sep 19 '22 13:09

Peter Kriens