0

I am trying to develop an application that can be configured by its users. I need the configuration to be done by installing/updating/stopping/uninstalling bundles. All this should be of course done dynamically during the run-time of the application.

I found a nice framework which is Apache Felix FileInstall that provides a directory in which it seems to add a bundle when you add the bundle file in the directory (update, and remove bundles similarly).

But I can see that this method does not work in my case. I need to have the bundles in the directory but to stop or even uninstall them by my application. And I want to install them when it is appropriate. This is how I am expecting the configuration of my application to be done.

Is what I am trying to achieve supported by Apache FileInstall? Am I making any wrong assumptions about this framework? What are other possible ways that would help me if Apache FileInstall is not enough? Thanks.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Traveling Salesman
  • 2,209
  • 11
  • 46
  • 83

1 Answers1

2

You don't need FileInstall for this, just use the OSGi APIs. You specifically mentioned installing, updating, stopping and uninstalling; these are supported with the following API calls respectively:

  • BundleContext.installBundle
  • Bundle.update
  • Bundle.stop
  • Bundle.uninstall

Incidentally these are exactly the same methods that are called by FileInstall to implements its directory-based bundle management.

Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
  • Are you saying that I don't need to have my bundles initially added before I run the application? I mean, can I make my application install a new bundle or replace an existing bundle dynamically using these methods? – Traveling Salesman Jul 17 '13 at 23:09
  • Yes. Of course the bundle that manages the other bundles *does* need to initially installed and started. We typically refer to such a bundle as a "management agent". FileInstall is also a management agent. – Neil Bartlett Jul 17 '13 at 23:19
  • Thanks. I've been looking a lot for how to use these methods and where to place them in the code? Do you have any link that can guide me? – Traveling Salesman Jul 17 '13 at 23:23
  • 2
    Why not start with a more basic OSGi tutorial? Once you understand the basics you will be able to answer your own question. It seems at the moment that you're trying to do very advanced stuff without the proper foundation. – Neil Bartlett Jul 17 '13 at 23:26
  • This is nice to start with: http://blog.sarathonline.com/2008/12/osgi-starters-guide-for-install-update.html – Traveling Salesman Jul 18 '13 at 18:11