Programmatically Activate/Deactivate the configuration of OSGI bundle | Community
Skip to main content
New Participant
November 15, 2018
Solved

Programmatically Activate/Deactivate the configuration of OSGI bundle

  • November 15, 2018
  • 2 replies
  • 2825 views

Hi,

      How to programmatically activate/deactivate(start/stop) the configuration of the osgi bundle(Not bundle start/stop)?

Please provide the example or syntax for this issue.

Thanks & Regards,

Ashwini

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi,

You can get the bundle using BundleContext and start stop using Bundle APIs.

https://osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html

https://osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html  '

https://www.javatips.net/api/org.osgi.framework.frameworkutil

BundleContext bundleContext = FrameworkUtil.getBundle(MyClass.class).getBundleContext();

2 replies

aanchal-sikka
New Participant
April 24, 2024

One way to make the configurations ineffective is to have a checkbox. The related service can check the value of this property and proceed with the functions accordingly. To programmatically alter configs, please visit ConfigurationAdmin – Access OSGi configuration of other services

Aanchal Sikka
arunpatidar
arunpatidarAccepted solution
New Participant
November 15, 2018

Hi,

You can get the bundle using BundleContext and start stop using Bundle APIs.

https://osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html

https://osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html  '

https://www.javatips.net/api/org.osgi.framework.frameworkutil

BundleContext bundleContext = FrameworkUtil.getBundle(MyClass.class).getBundleContext();

Arun Patidar