Conditional uninstall of OSGi feature

135 views Asked by At

I have a continuous integration for building OSGi features for jboss-fuse. After feature is built (and published to artifact repository), SSH to OSGi console is established and following commands executed:

features:uninstall xyz
features:install xyz

This works when xyz is installed, otherwise it ends with obvious failure:

Error executing command: Feature named 'xyz' is not installed

Is there any way how to conditionaly uninstall given feature? For example using shell:if commands? Or other way how to reinstall given feature automatically?

1

There are 1 answers

0
Jonathan Fortin On

I understand that you use a part of Karaf to install your feature in the jboss container.

  1. You could inject the kar service (org.apache.karaf.kar.KarService) into your test and use the install/uninstall features from there.

  2. If you are working remotly (which I think you are), you could use the JMX MBean org.apache.karaf:type=feature,name=root to remotely install/uninstall your feature.