OSGI: how to export system packages on felix durin

2019-07-25 13:40发布

问题:

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.

回答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?