所以我已经安装了这些 bundle ,并且可以通过 gui 从 http://localhost/path/to/bundles。这里是用户界面,可以在其中搜索 bundle 并手动将其关闭。我希望能够在代码中做到这一点。
我目前正在查看 org.apache.felix.webconsole-3.1.8.jar 的示例。所以我想我的问题是:
如何连接到网络控制台以便检索 bundle 列表
如何查找特定的 bundle ?通过符号名称?
最佳答案
假设您的代码在同一个 OSGi 容器中运行,则没有理由为此使用 Web 控制台。您可以使用 Spring-DM 或 Blueprint 之类的东西来获取对 BundleContext 的引用然后使用 getBundle 方法获取要停止的 bundle 的引用。
从那里,您可以调用 Bundle.stop() .
关于java - 如何使用代码停止 Apache Felix Webconsole 中的 bundle ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7193967/