View Full Version : Enable/Disable Bundles
Jul 21st, 2009, 03:17 AM
Is there any mechanism to enable and disable the bundles using java code which uses OSGi Framework API.
Do we have any option to get the current version of bundle from Manifest.Mf using OSGI Framework API
Jul 21st, 2009, 04:28 AM
You could use org.osgi.framework.BundleContext to start/stop/etc any bundle and to retrieve the Bundle object with the bundle's metadata. If you use Spring DM you could implement BundleContextAware otherwise you have to write your own BundleActivator storing the BundleContext for later use.
Jul 22nd, 2009, 02:10 AM
Stop should stop the complete functionality of the bundle, my requirements is like this, I want disable the bundle for some context and enable for some context.
I tried in alternative way using Spring Security based on the url for bundle context, even I want to know will it be possible with OSGi frame work API.
Jul 22nd, 2009, 02:54 AM
If you need to support multiple "contexts" in a single OSGi framework, then stopping the bundle would not be sufficient. Otherwise it should be sufficient. You could even write a bundle to manage your other bundles based on context.
Jul 22nd, 2009, 03:03 AM
@Glyn, in your post you mentioned You could even write a bundle to manage your other bundles based on context. . That means can we have any functionality like disabling the Bundle (still it should be active on Server).
Scenario where I want this is, Suppose we have two modules (bundles), we want to give access to only one for some users and two modules to other users and there is only one server
Jul 22nd, 2009, 03:14 AM
It sounds like you should programmatically decide whether to invoke a service provided by the "disabled" (but active) bundle. Your code should keep track of this "disabled" state as this is not something OSGi or dm Server provides, especially since it seems to be a state which varies depending on the user.
Jul 22nd, 2009, 03:19 AM
@Glyn, Thank your for early replies. Then I will try tracking them from code itself
Aug 17th, 2009, 02:07 AM
When I am calling Stop method for my bundle it is stopping the bundle service and Unbounds this bundle from its Host bundle (my bundle was a Slice), when I am starting the bundle(slice) it is showing the state as START (32), but it is not showing the message like Slice bound to path , does this STSRT and STOP has the support for Slices also......
Aug 18th, 2009, 02:10 AM
That sounds like a bug to me. dm Server and Slices should react to the start and stop events that are produced when you call start() and stop() and should unbind and rebind the Slices accordingly, and produce the appropriate messages. Can you please open a JIRA (https://issuetracker.springsource.com/secure/CreateIssue!default.jspa) for this?
Aug 18th, 2009, 02:24 AM
Aug 28th, 2009, 06:27 AM
Issue was solved with Spring SOurce Slice 1.0.B26 night build
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.