1

When I need to export some system packages I do:

final Map configMap = new HashMap();
configMap.put(Constants.FRAMEWORK_STORAGE_CLEAN, "onFirstInit");
configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA,"my packageshere");
felix = new Felix(configMap);

But how can I export some packages during runtime? For example, on working osgi framework I want to install some bundle which requires some system packages which I didn't export when I start felix.

Pavel_K
  • 10,748
  • 13
  • 73
  • 186

1 Answers1

1

There is no way to do this dynamically. And I am not sure I understand the purpose since the packages are known ahead of time when you start the framework. Why not export all?

Peter Kriens
  • 15,196
  • 1
  • 37
  • 55
  • Suppose you have application which can download extension to itself. The extension has N bundles. Some bundles need some extra system packages. Will you restart every time you application? Another example - you use web container on osgi and deploy your web application. If new web app requires some system packages - will you stop all other web app? – Pavel_K Aug 04 '16 at 12:05
  • No, I would just export ALL packages since this is by definition a finite set. (Unless you do some class loading hacks on the framework side of your code?) – Peter Kriens Aug 04 '16 at 14:51
  • I understand what you say, maybe this is the only solution. However, it is strange because if bundles are so dynamic then and the environment for them must have dynamic properties. – Pavel_K Aug 04 '16 at 14:53
  • @JimJim2000 The environment has the capability to support dynamic properties; it cannot be dynamic "all the way down". By analogy: you can build a dynamic structure like a ferris wheel or a swing bridge, but it still has a solid, immovable foundation. – Neil Bartlett Aug 04 '16 at 15:15
  • The system has dynamic properties, you can install a new bundle that can provide new packages to the environment _inside_ the framework. This is a (very complex) function of the framework. If you could provide this kind of functionality outside the framework, why would you then need an OSGi framework? – Peter Kriens Aug 05 '16 at 09:32