I think it might make more sense to allow a bundle to be a "feature"
definition too.
JB, Peter Kriens and me discussed about this on friday over skype. A
bundle with just a Manifest
can express most of the things a feature can express.
Require-Bundle can express requirements on certain bundles with version
ranges. It can also express optional dependencies.
Require-Capability can express other requirements.
Capability can express that the bundle implements a feature with a given
name and version it can also define any other capabilities.
The Configurer extender from enroute which might be standardized can
express default configs.
As Guillaume expressed on IRC there are definitely cases such a bundle
can not express (like conditionals or start levels or overwriting
files). It could be sufficient for a lot of
business cases though.
As far as I understood from David as well as from Peter such
(application) bundles are used in bndtools a bit like we use features in
karaf.
One advantage of such bundles is that they can be easily produced by
bndtools (together with an index to resolve against) and even eclipse pde.
They also use the default resolver mechanics. So they can be resolved
against a bndtools index as well as as a p2 repository. If we find
solutions to some of the problems Guillaume
mentioned then we might have a way for e.g. CXF to express their
features in a way that works on all OSGi platforms.
So what we could do on the karaf side is either have a special feature
command to install such a bundle or have an option of the bundle:install
command
to install a bundle + its dependencies resolved by the resolver.
As a short term solution we could even just work with just karaf as is
by creating a feature.xml that refers to the index and a feature that
refers to the application bundle. It is a little overhead but would
allow us to work out the idea some more without requiring bigger changes
in karaf.
This idea is still in an early stage but I think it has a lot of
potential and it should make sense to experiment with it.
Christian
On 30.11.2015 10:40, Jean-Baptiste Onofré wrote:
David wants to create a "dummy bundle", describing a feature as
resources (without the XML).
Not yet sure it's a good idea (it's what we discussed on IRC).
Regards
JB
On 11/30/2015 10:36 AM, Guillaume Nodet wrote:
2015-11-30 8:41 GMT+01:00 David Leangen <[email protected]
<mailto:[email protected]>>:
>> There is an easy way to install bundles.
>> Just use the feature:requirement-add command.
Sounds practical. But then again, I really like the idea of
“features”. I like to see which “feature” is installed and
running. If my bundle is only added as a requirement, then I
lose that visibility. Also, having to restart Karaf each time
I want to add a new repository (as is currently the case) is
not a very nice option for me.
Jean-Baptiste is working on that.
I've also pushed support for referencing xml repositories from
features files to a github branch
https://github.com/gnodet/karaf/tree/KARAF-4130
Looks nice!
I noticed that currently, it is not possible to add a new Feature
via the FeatureService. Although there is an addFeature(Feature)
type method in the API, in practice it will not work if there is not
a corresponding XML repo.
It would be very nice to be able to create a feature on the fly,
such as by wrapping a bundle, then add it via the service. Actually,
for what I am trying to do it would be “necessary”. :-)
I'm not sure i understand this requirement. How can you
programmatically generate the feature definition ? What's your input
exactly ?
Should I file a JIRA issue for this?
In any case, feature:requirement-add is currently not working
for me, for 2 reasons…
1) The patch I submitted to allow resolution of resources with
relative URLs only works when
there is one single Repository added to the config file.
I am investigating an updated fix, but:
2) Something odd happens intermittently when I try to add a
requirement. Karaf adds “type=karaf.feature”
even when I express the type as “osgi.bundle”. Example:
karaf@root()> feature:requirement-add
‘osgi.identity=my.bundle;type=osgi.bundle'
Error executing command: Unable to resolve root: missing
requirement [root] osgi.identity;
osgi.identity=“osgi.identity=my.bundle;type=osgi.bundle";
type=karaf.feature;
filter:="(&(osgi.identity=osgi.identity=my.bundle;type=osgi.bundle)(type=karaf.feature))”
Try with feature:requirement-add
‘requirement:osgi.identity;osgi.identity=my.bundle;type=osgi.bundle'
Still trying. I must be doing something wrong… :-(
Cheers,
=David
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com