Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » Update a Bundle
Update a Bundle [message #1696038] Thu, 21 May 2015 10:33 Go to next message
Marco Balzarin is currently offline Marco BalzarinFriend
Messages: 22
Registered: May 2015
Junior Member
Hi all,

Suppose that I wants to update a bundle while kura is running. The operations that i'm going to perform will be:

- download the update from internet (from a my custom repository)
- update the bundle with the new version
- restart the updated bundle.

Obviously, stopping a bundle while kura is running means that all the other related bundles will go in 'RESOLVED' state.

Do you know if there a method to avoid this? There is a way to get the dependency three of a bundle so that i can preventively stop all interested bundle and then, when the update process is completed, restart them?

Thanks all.
Re: Update a Bundle [message #1696094 is a reply to message #1696038] Thu, 21 May 2015 16:22 Go to previous messageGo to next message
Amit Kumar Mondal is currently offline Amit Kumar MondalFriend
Messages: 108
Registered: March 2015
Location: Munich, Germany
Senior Member

You can use Bundle Events and register SynchronousBundleListners to the interested Bundles.

Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
Re: Update a Bundle [message #1696323 is a reply to message #1696094] Mon, 25 May 2015 15:52 Go to previous messageGo to next message
Marco Balzarin is currently offline Marco BalzarinFriend
Messages: 22
Registered: May 2015
Junior Member
Amit Kumar Mondal wrote on Thu, 21 May 2015 16:22
You can use Bundle Events and register SynchronousBundleListners to the interested Bundles.


Ok perfect, it worked, thanks!

Just another question: if i want to directly manage .DP files (over .JAR files) how could i do this? I mean, methods as getBundles() or installBundles() (from BundleContext interface - osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html), works only with JAR files, right?

There is a way to work directly with DP files? Or the only way is to unarchive the DP files and then work with the extracted bundles?

Thanks again.
Re: Update a Bundle [message #1696329 is a reply to message #1696323] Mon, 25 May 2015 18:01 Go to previous messageGo to next message
Amit Kumar Mondal is currently offline Amit Kumar MondalFriend
Messages: 108
Registered: March 2015
Location: Munich, Germany
Senior Member

Hi Marco,

First of all, I would like to tell you that Deployment Package is not directly related to OSGi Context. If you have an experience in Eclipse Feature Based Development, it's pretty much same. Basically the benefits of Deployment Package is that you can package similar type of bundles in a deployment package and install it in the OSGi Container. To get a Deployment package installed in the OSGi Container, you need a client bundle which is responsible to unarchive your deployment package and extract its metadata and get the packaged bundles installed into your OSGi container. So. basically it's not a feature of OSGi at all but rather you can consider it as a way of managing your bundles in an effective way. So, you won't be able to find any management methods in BundleContext interface. If you want you can have a look at the source code of client bundle of mtoolkit which is responsible for deployment package metadata retrieval.


Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
Re: Update a Bundle [message #1696379 is a reply to message #1696329] Tue, 26 May 2015 08:45 Go to previous messageGo to next message
Marco Balzarin is currently offline Marco BalzarinFriend
Messages: 22
Registered: May 2015
Junior Member
Amit Kumar Mondal wrote on Mon, 25 May 2015 18:01
Hi Marco,

First of all, I would like to tell you that Deployment Package is not directly related to OSGi Context. If you have an experience in Eclipse Feature Based Development, it's pretty much same. Basically the benefits of Deployment Package is that you can package similar type of bundles in a deployment package and install it in the OSGi Container. To get a Deployment package installed in the OSGi Container, you need a client bundle which is responsible to unarchive your deployment package and extract its metadata and get the packaged bundles installed into your OSGi container. So. basically it's not a feature of OSGi at all but rather you can consider it as a way of managing your bundles in an effective way. So, you won't be able to find any management methods in BundleContext interface. If you want you can have a look at the source code of client bundle of mtoolkit which is responsible for deployment package metadata retrieval.


First of all thanks for your patience, i am at my very first approach with osgi and Kura.

So, as you suggested, i studied mToolkit source code (and also the Kura's source code itself) and i found two interesting interfaces exposed by osgi: DeploymentPackage (osgi.org/javadoc/r4v42/org/osgi/service/deploymentadmin/DeploymentPackage.html) and DeploymentAdmin (osgi.org/javadoc/r4v42/org/osgi/service/deploymentadmin/DeploymentAdmin.html) that seems to do exactly what i'm trying to develop.

Do you have some knowledge about this? I'm on the right way?
Re: Update a Bundle [message #1696418 is a reply to message #1696379] Tue, 26 May 2015 11:32 Go to previous messageGo to next message
Amit Kumar Mondal is currently offline Amit Kumar MondalFriend
Messages: 108
Registered: March 2015
Location: Munich, Germany
Senior Member

Hi Marco,

First of all, kudos for your effort. DeploymentAdmin is a specification in OSGi Service Compendium 4.0. It's completely similar to the Eclipse Feature Based Development and it packages the similar resources in a single package. The mToolkit has one implementation of DeploymentAdmin to read Deployment Package resources.

If you want to try your hands on DeploymentAdmin in your other OSGi container, you need to install 3 bundles.


  1. org.apache.felix.dependencymanager
  2. org.apache.felix.deployment.rp.autoconf
  3. org.apache.felix.deploymentadmin


Now you do need to create the Deployment Package (.dp) to package your OSGi bundles. (N.B: mToolkit does provide an easy way to create deployment package)
But it's not restricted to mToolkit. It's pretty easy to create a deployment package on your own.

A deployment package is basically a simple file with a dp filename extension to it. You have to package your bundles into this dp file and create a manifest header in it. The manifest header file is almost similar to your OSGi Bundle manifest file with slight modifications.

Manifest-Version: 1.0
DeploymentPackage-SymbolicName: de.tum.in.dp.bluetooth
DeploymentPackage-Version: 1.0.0
DeploymentPackage-Copyright: Amit Kumar Mondal
DeploymentPackage-ContactAddress: admin@amitinside.com
DeploymentPackage-Description: This deployment package is used to configure Bluetooth Serial Port Profile in Eclipse Kura
DeploymentPackage-Name: Bluetooth Serial Port Profile Configuration

Name: de.tum.in.bluecove.fragment-1.0-SNAPSHOT.jar
Bundle-SymbolicName: de.tum.in.de.tum.in.bluecove.fragment
Bundle-Version: 1.0.0.SNAPSHOT

Name: de.tum.in.bluecove-2.1.0.jar
Bundle-SymbolicName: de.tum.in.bluecove
Bundle-Version: 2.1.0

Name: de.tum.in.bluetooth-0.0.1-SNAPSHOT.jar
Bundle-SymbolicName: de.tum.in.bluetooth
Bundle-Version: 0.0.1.SNAPSHOT


This is very straight forward to comprehend.

Now you can go ahead installing your deployment package.


Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
Re: Update a Bundle [message #1696420 is a reply to message #1696418] Tue, 26 May 2015 11:44 Go to previous message
Amit Kumar Mondal is currently offline Amit Kumar MondalFriend
Messages: 108
Registered: March 2015
Location: Munich, Germany
Senior Member

For listening to an update event on any of the bundles, packaged inside the Deployment package, you can make use of the same SynchronousBundleListener to the Bundle Event. But before that you need to know the packaged bundles inside the Deployment Package. For that, you can use DeploymentPackage interface to list down the packaged BundleInfo and you will get the symbolic names of all the bundles inside the Deployment Package.

I think this would be pretty much straight forward to listen to change events of bundles which are packaged in a Deployment Package.


Amit Kumar Mondal
Email: admin@amitinside.com
Skype: arsenalnerk Blog: blog.amitinside.com
Previous Topic:Console - Error Registering Web Resources
Next Topic:Network Admin in Kura - how does it work?
Goto Forum:
  


Current Time: Sat Apr 20 01:07:17 GMT 2024

Powered by FUDForum. Page generated in 0.03699 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top