有多种方法可以将依赖包分发到OSGi容器。这里是其中的一些:
1 Felix OBR软件包存储库
首先,您需要使用bindex之类的工具为可用的捆绑软件创建XML索引文件。如果使用的是maven-bundle-plugin,它将自动在〜/ .m2 /
repository / repository.xml中维护OBR索引。
使用OBR命令行界面加载索引:
> obr:addUrl file:/Users/derek/.m2/repository/repository.xml
然后要求OBR部署目标捆绑包,并从OBR索引确定依赖性。
> obr:deploy com.paremus.posh.sshdTarget resource(s):------------------- Paremus Posh Ssh Daemon (1.0.23.SNAPSHOT)Required resource(s):--------------------- Paremus Command API (1.0.23.SNAPSHOT)Optional resource(s):--------------------- Paremus Config Admin Commands (1.0.23.SNAPSHOT) Paremus OSGi & LDAP Types (1.0.23.SNAPSHOT)
2 Apache Karaf
Karaf支持“功能”,基本上是提供该功能所需的捆绑软件清单:
karaf@root> features:info obrDescription of obr 2.0.0 feature----------------------------------------------------------------Feature has no configurationFeature has no dependencies.Feature contains followed bundles: mvn:org.apache.felix/org.apache.felix.bundlerepository/1.6.4 mvn:org.apache.karaf.shell/org.apache.karaf.shell.obr/2.0.0 mvn:org.apache.karaf.features/org.apache.karaf.features.obr/2.0.0karaf@root> features:install obr
3 Eclipse处女座
处女座使用 计划 来定义组成应用程序的工件,它能够自动提供来自本地和远程存储库的应用程序的依赖项,包括捆绑软件,计划,计划档案(PAR)和配置。
4 Paremus Nimble
Nimble使用OBR(或它自己的扩展)存储库索引来自动部署激活目标捆绑包所需的所有相关捆绑包(并在目标捆绑包停止时将其卸载)。它还可以检测其他依赖项,例如WAB捆绑包需要Web扩展程序,并根据可配置的策略自动安装。
还可以将Nimble配置为启动Glassfish,以便将其功能捆绑到Glassfish容器中。
下面的示例还显示,在激活sshd时会自动安装日志记录支持:
$ posh________________________________________Welcome to Paremus Nimble!Type 'help' for help.[denzil.0]% nim:add --dry-run com.paremus.posh.sshd@active-- sorted parts to install --4325 osgi.resolved.bundle/ch.qos.logback.core:0.9.22-- start dependency loop --5729 osgi.resolved.bundle/com.paremus.util.logman:1.0.23.SNAPSHOT5727 osgi.active.bundle/com.paremus.util.logman:1.0.23.SNAPSHOT3797 osgi.resolved.bundle/ch.qos.logback.classic:0.9.25.SNAPSHOT3792 osgi.resolved.bundle/slf4j.api:1.6-- end dependency loop --436 osgi.resolved.bundle/org.apache.mina.core:2.0.0.RC16533 osgi.resolved.bundle/sshd-core:0.3398 osgi.resolved.bundle/com.paremus.posh.sshd:1.0.23.SNAPSHOT396 osgi.active.bundle/com.paremus.posh.sshd:1.0.23.SNAPSHOT
(免责声明:我是Paremus的开发人员)
5 Apache Felix Gogo
gogo是新的RFC147标准命令行外壳。它已在Felix,Karaf,Nimble中使用,不久将在Glassfish中使用。
Gogo允许您以脚本形式运行可以交互键入的所有命令。因此,您可以生成捆绑软件列表以进行安装并将其转换为脚本,甚至可以从工作配置中捕获已安装的捆绑软件,以便可以从头开始重新创建它。



