Configure Equinox to modify the management of the “local bundle cache”

只谈情不闲聊 提交于 2019-12-07 12:20:34

问题


Relating to a previous question, how let OSGi to reuse your configuration via Config Admin, I am still trying to solve this problem in the Equinox Framework.

Pavol Juhos wrote:

Equinox Config Admin (org.eclipse.equinox.cm) stores the configuration data in the persistent storage area provided by the Framework. And that happens to be the "local bundle cache" directory by default for Equinox.

So i read up on this topic and found that there are several runtime options for Equinox (among other things osgi.configuration.area).

What I want is to change the configuration, in order that the local bundle cache won't be droped or cleaned, so the next time I'll run the Framework, the last entered configuration (for any bundle) will be used.


回答1:


There is also the osgi.clean property. If you set this to true, the OSGi container must delete the existing bundle cache (and all related data) on startup and reload the bundles into the runtime cache. If you set this to false then your bundle cache should survive a restart.

This is documented in the Eclipse SDK Equinox Runtime Options.




回答2:


CM was not design to persist data after you stop the container. If you want to do that you must use the Preferences Service.

So your application, at initialization, must get data from you persistent store managed by PS and 'pass it' to the CM do it works.




回答3:


The OSGi standard property for specifying whether the bundle cache should be purged on framework startup is org.osgi.framework.storage.clean

org.osgi.framework.storage.clean - Determines whether the bundle cache is flushed. The value can either be "none" or "onFirstInit", where "none" does not flush the bundle cache and "onFirstInit" flushes the bundle cache when the framework instance is first initialized. The default value is "none".

This is a relatively new one (in fact, it is still a draft, find it in the R4.2 Draft under section 4.2.2), but it should work in recent Equinox versions, I guess.



来源:https://stackoverflow.com/questions/1260276/configure-equinox-to-modify-the-management-of-the-local-bundle-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!