0

我想知道我是否可以通过任何网络机制(RMI、HTTP、URLClassLoader 等)配置像Karaf(或任何其他流行容器)这样的 OSGi 容器,以从托管在另一台机器上的远程存储库下载包(.BND) .)?

理想情况下,我可以随时将我的捆绑包的新版本部署到这个远程仓库,并以某种方式触发 OSGi 容器“下载”(安装/部署)远程捆绑包并将它们热部署到旧版本的同捆。

这可能吗?如果是这样,怎么做?提前致谢!

4

3 回答 3

1

OSGi has an API for managing OSGi frameworks on the BundleContext that every bundle activator receives. This API allows you to install/update a bundle via URL or InputStream.

Since this is a standardized API there have been lots of people making bundles that provide a policy around this deployment process. The archetypical one is Apache FileInstall, it watches a directory and automatically installs every bundle found in this directory and uninstall the bundle when it is gone. This works well with for example dropbox. It also supports configuring via the the Configuration Admin service. On the other hand of the spectrum you find Apache Ace which provides a remote management system.

To find the best solution, try to enlist the requirements you have. One or two systems or 1 million? Local or remote over slow lines?

One thing is for sure, you will find some project or provider being able to provide you with an OSGi bundle that implements your desired management policy.

于 2013-09-16T13:55:22.653 回答
0

I recommend taking a look at the provisioning of Karaf at documentation for provisioning. Your able to deploy bundles either with maven urls, http or file references. Or you might deploy your set of bundles either as a feature definition (which loads all required and used bundles from a maven repo) or by deploying a kar file.

于 2013-09-16T20:45:08.253 回答
0

我们使用 Apache Felix 并维护一个 OBR 存储库。设置完成后,您可以从 OSGi shell 部署新版本。这确实需要您手动登录并输入命令,例如deploy com.example.foo.

或者,您可以直接从 url 安装,例如install http://example.com/bundles/bundle.jar.

您的最后一个要求(自动部署)更棘手。您也许可以在您的 OSGi 容器上启用远程 shell,并在构建过程中通过 telnet 推送命令。

于 2013-09-16T11:20:17.473 回答