OSGI Configuration Kit

I am new to diving in the OSGi world. I am trying to develop an application with the following modules (packs):

  • model
  • api services
  • Default Services
  • Web

Assume that the default service package contains internal data access services. Therefore, some configuration to access the database. It’s not good for me to place the database configuration in the default service package. In addition, the website does not need to know how the service is connected to the internal network by default.

My question is: does OSGi have a configuration kit concept? My idea was to deploy the default configuration package. Is there a similar solution for this?

+4
source share
4 answers

Have you looked at the ConfigurationAdmin service? Your packages must use ConfigurationAdmin to get their configuration. If you use Declarative Services in your packages, DS automates the use of ConfigurationAdmin for you.

+4
source

Depending on how you plan to customize, fragments may suit your needs. They allow you to add additional information to existing package class paths. We use this to provide different configurations for different runtimes (dev, test, ...). You simply install the appropriate set of fragments for the correct configuration.

+3
source

In fact, I developed a small package that can detect configuration data in other packages with an extender pattern. In my case, this is a Jason file. Got some special tricks for handling passwords and binaries, such as ssl certificates.

+1
source

Source: https://habr.com/ru/post/1441990/


All Articles