Install and activate a list of Equinox OSGI bundles at once at runtime - osgi-bundle

I am installing 3 bundles one by one into Equinox platform at run time by calling bundleContext.install("file") all three bundle states are INSTALL . if am calling start() on one bundle giving an error service not available that is in other bundle, that bundle not at started still in install state. so i want start those three at same time.

Related

Going to project folder before "bundle install"

I'm trying to install jekyll based on instructions here (via rbenv): https://gist.github.com/r-brown/a0b50d56cfb3596e0d17
Before the "bundle install" step, it states:
go to the project folder
However, I'm new and simply truly confused as to what this refers to? I don't actually have a project folder right now, because I am merely in the process of installing jekyll?
Or is that referring to a specific location based on the earlier installation steps?
I attempted to skip this step and directly input bundle install, but that yielded this error
"Could not locate Gemfile".
Referring to this post: Could not locate Gemfile was unfortunately not useful as no one explicitly stated what "project folder" entails...
Why do you want to use jekyll? Usually you would use it as part of a project - which probably entails writing the line:
gem 'jekyll'
...inside the Gemfile of your project. And then, to install the library (along with all other dependencies, you can run bundle install.
This is why the next line of the guide talks about running the command: bundle exec jekyll serve ... -- because the author is assuming that you have a project set up.
However, if you just want to install the gem globally (i.e. not within the context of a project), then you don't need to do anything with bundle. Just run:
gem install jekyll

Can't force Apache Karaf to load a new version of the bundle (version w/o "-SNAPSHOT")

I've tried to update bundle in Karaf without changing its version. Version doesn't contain "-SNAPSHOT".
Is there a way to do it?
I've installed bundle to Apache Karaf through the mvn link
The code inside this bundle was changed without changing its (bundle's) version (according to some inner reasons).
Then I removed this bundle from Karaf, and from Nexus.
Next step was deploying new bundle to Nexus.
When I finally tried to install the "new" bundle, I saw there were no changes in it.
It looks like there is some cache inside Karaf where he stores bundles, that was already installed.
Adding flags like -c or -cc doesn't help.

A variation on internally distributing a rails app

I have written a ruby service that I want to package and distribute internally to a specific environment (a standardized linux host). After digging around a bit for the best ways to create a distribution, I've come across a lot of blogs and answers here that recommend bundler and gem packaging as well as a lot of binary distribution options (e.g. traveling-ruby), but these all seem like a bit too much for a relatively simple service that will get deployed to a known environment. I want to create a distribution that doesn't require dependencies to be resolved at deploy time (e.g. bundle install --deployment is not the approach I want).
So with this in mind, is there an available framework that is commonly in use by ruby apps that would create a redistributable package with all dependencies included in it? I am currently doing this in 2 steps and wondering if there's a "better" ruby-way of doing it - something along the lines of gem build ... that creates dependency-inclusive archive?
# Assuming `bundle install` was run on developer workstation and there's a `Gemfile.lock`
$ bundle install --deployment
$ tar zcf ../my-app.tar.gz ./
my-app.tar.gz can now be distributed and if I have an executable to run it with, I can do so with bundle exec bin/run from within the directory after it's extracted. This a good approach?
I've seen a gem called crate that might be able to work....

Apache karaf how to easily install bundle from Maven repo

I am trying out Karaf and installed some bundle X. This bundle X complains about a missing requirement: Unresolved requirements ... osgi.wiring.package; (osgi.wiring.package=org.apache.commons.httpclient)]
Hence, I tried to provide the org.apache.commons.httpclient through bundle:install mvn:commons-httpclient/commons-httpclient/3.1 which worked.
But, after trying to start the X again, I still get the same error message.
thanks!
That jar is not a bundle, hence can't be deployed to karaf, it's just ignored.
Try
karaf#root>bundle:install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/3.1_7
Make it sure that your bundle has in their META-INF/MANIFEST.MF the osgi import declarations syntax. I assume that you use bndtools to generate the bundle.
Agree with #Antonio, for third party libraries which are not OSGi bundles you can also try to install them with wrap:
bundle:install -s wrap:mvn:commons-httpclient/commons-httpclient/3.1
This will create a basic OSGi MANIFEST for the library...
You can find more info here: http://karaf.apache.org/manual/latest/developers-guide/creating-bundles.html

Installing a fragment requires a refresh on the host, how can this be avoided?

I have two bundles: bundle A and bundle B which is configured as a fragment of bundle A using:
Fragment-Host:
Whenever I install bundle B it fails to start (INSTALLED) and therefore to attach itseld to bundle A.
At this point when I check bundle A's status I see that it still doesn't recognize bundle B as its fragment.
If I do refresh bundle A it solves the problem - bundle B switches to RESOLVED and is able to attach itself to bundle A, bundle A recognizes bundle B as its fragment and everything is working as expected.
My question is how this refresh can be avoided, i.e. as soon as bundle B is installed it should attach itself to its host which is already ACTIVE.
Thank you.
You cannot do that without a refresh, and it's in the OSGI specs too - to properly attach a fragment bundle, a transition from INSTALLED to RESOLVED of the host bundle is necessary. See section 3.14 of the 4.3 OSGi Core Specification.

Resources