使用OSGi实现自动更新 [英] Using OSGi to implement auto-update
问题描述
我想做的是为我的代码创建一个启动器框架,给定一个URL和预定义的版本控制方案:
1)去检查是否存在更新
2)下载更新
3)安装更新
4)重新运行应用程序
What I'd like to do is create a "launcher" framework for my code that, given a URL and a predefined versioning scheme: 1) go check if an update exists 2) download the updates 3) "install" the update 4) "re-run" the application
我想a)做所有这些在现有JVM内部,b)与平台无关。高阶对吗?基于我对OSGi和Apache Felix的(有限)知识,我很确定这是可能的,但我真的迷失在细节中。
I want to a) do all of this inside of the existing JVM and b) be platform independent. Tall order right? Based on my (limited) knowledge of OSGi and Apache Felix I'm pretty sure this is possible, but I'm really getting lost in the details.
检查更新和下载它是微不足道的。导致旧捆绑卸载和新捆绑加载是我陷入困境的地方。我过去做过OSGi的工作,但它的动态远不如此。非常感谢一个良好的起点或向正确的方向努力。
Checking for an update and downloading it is trivial. Causing the "old" bundle to unload and the "new" bundle to load is where I'm getting stuck. I've done OSGi work in the past but it was a lot less dynamic than this. A good starting place or a hard shove in the right direction would be most appreciated.
如果我严重过度烘焙已经用免费图书馆解决的东西那么告诉我这个,但到目前为止我还没有找到任何东西。 : - )
If I'm seriously over-baking something that's already been solved with a free library then tell me this too, but I haven't found anything so far. :-)
推荐答案
您甚至不需要下载它,只需检查是否有更新,然后调用Bundle。需要更新的bundle上的update(InputStream),之后通常会调用PackageAdmin.refreshPackages()。
You don't even need to download it, just check if an update is available and then call Bundle.update(InputStream) on the bundle that needs to be updated, generally followed by a call to PackageAdmin.refreshPackages() afterward.
这篇关于使用OSGi实现自动更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!