|
|
|
Re: Update a Bundle [message #1696329 is a reply to message #1696323] |
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.
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 |
Marco Balzarin Messages: 22 Registered: May 2015 |
Junior Member |
|
|
Amit Kumar Mondal wrote on Mon, 25 May 2015 18:01Hi 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 |
|
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.
- org.apache.felix.dependencymanager
- org.apache.felix.deployment.rp.autoconf
- 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 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03699 seconds