[OSGI] Felix基本环境搭建及操作
2015-01-12 13:53
260 查看
Felix是Apache旗下的一款实现OSG规范I的框架。访问地址:http://felix.apache.org/
搭建基本的OSGI框架只需要下载Felix Framework。
下载完成后解压至任意目录(如:D:\felix-framework-4.4.1),在felix-framework-4.4.1目录下打开CMD命令窗口,执行启动Felix框架命令
完成启动后输入 lb 命令查看当前启动Felix的bundle
停止Felix框架是输入 stop 0
安装Felix的bundle(helloworld.jar)是需要bundle的绝对路径,执行命令install file:/file_path
执行lb查看安装结果
启动bundle命令start bundleID
查看bundle状态 lb
停止bundle命令为stop bundleID
更新helloworld的源码,输出语句变为Hello World, OSGI !
更新操作分为两种方法
将修改后的bundle替换原有bundle时,执行update bundleID
将现有bundle跟新至另一个位置的存放的bundle,执行 update bundleID file:/fiel_path
卸载bundle 命令 uninstall bundleID
搭建基本的OSGI框架只需要下载Felix Framework。
下载完成后解压至任意目录(如:D:\felix-framework-4.4.1),在felix-framework-4.4.1目录下打开CMD命令窗口,执行启动Felix框架命令
java -jar bin/felix.jar
完成启动后输入 lb 命令查看当前启动Felix的bundle
g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.4.1) 1|Active | 1|Apache Felix Bundle Repository (2.0.2) 2|Active | 1|Apache Felix Gogo Command (0.14.0) 3|Active | 1|Apache Felix Gogo Runtime (0.12.1) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) g!
停止Felix框架是输入 stop 0
安装Felix的bundle(helloworld.jar)是需要bundle的绝对路径,执行命令install file:/file_path
<pre name="code" class="plain">g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.4.1) 1|Active | 1|Apache Felix Bundle Repository (2.0.2) 2|Active | 1|Apache Felix Gogo Command (0.14.0) 3|Active | 1|Apache Felix Gogo Runtime (0.12.1) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) g! install file:/d:/felix-framework-4.4.1/myplugins/helloworld_1.0.0.201501121409.jar
Bundle ID: 5
g!
执行lb查看安装结果
g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.4.1) 1|Active | 1|Apache Felix Bundle Repository (2.0.2) 2|Active | 1|Apache Felix Gogo Command (0.14.0) 3|Active | 1|Apache Felix Gogo Runtime (0.12.1) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) 5|Installed | 1|Helloworld (1.0.0.201501121409) g!可以看出新安装的helloworld.jar的状态为Installed
启动bundle命令start bundleID
g! start 5 Hello world! g!
查看bundle状态 lb
g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.4.1) 1|Active | 1|Apache Felix Bundle Repository (2.0.2) 2|Active | 1|Apache Felix Gogo Command (0.14.0) 3|Active | 1|Apache Felix Gogo Runtime (0.12.1) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) 5|Active | 1|Helloworld (1.0.0.201501121409) g!helloworld bundle状态为Active表示插件已激活
停止bundle命令为stop bundleID
g! stop 5 g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.4.1) 1|Active | 1|Apache Felix Bundle Repository (2.0.2) 2|Active | 1|Apache Felix Gogo Command (0.14.0) 3|Active | 1|Apache Felix Gogo Runtime (0.12.1) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) 5|Resolved | 1|Helloworld (1.0.0.201501121409) g!helloworld bundle状态变为Resolved
更新helloworld的源码,输出语句变为Hello World, OSGI !
更新操作分为两种方法
将修改后的bundle替换原有bundle时,执行update bundleID
g! update 5 g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.4.1) 1|Active | 1|Apache Felix Bundle Repository (2.0.2) 2|Active | 1|Apache Felix Gogo Command (0.14.0) 3|Active | 1|Apache Felix Gogo Runtime (0.12.1) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) 5|Installed | 1|Helloworld (1.0.0.201501121422) g! start 5 Hello World, OSGI ! g!
将现有bundle跟新至另一个位置的存放的bundle,执行 update bundleID file:/fiel_path
g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.4.1) 1|Active | 1|Apache Felix Bundle Repository (2.0.2) 2|Active | 1|Apache Felix Gogo Command (0.14.0) 3|Active | 1|Apache Felix Gogo Runtime (0.12.1) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) 5|Active | 1|Helloworld (1.0.0.201501121409) g! update 5 file:/d:/felix-framework-4.4.1/myplugins/helloworld_1.0.0.201501121409_new.jar
Hello World, OSGI !
g!
卸载bundle 命令 uninstall bundleID
g! uninstall 5
g! lb START LEVEL 1 ID|State |Level|Name 0|Active | 0|System Bundle (4.4.1) 1|Active | 1|Apache Felix Bundle Repository (2.0.2) 2|Active | 1|Apache Felix Gogo Command (0.14.0) 3|Active | 1|Apache Felix Gogo Runtime (0.12.1) 4|Active | 1|Apache Felix Gogo Shell (0.10.0) g!
相关文章推荐
- Apache Felix 的OSGi开发环境搭建
- Apache Felix 的OSGi开发环境搭建
- Apache Felix 的OSGi开发环境搭建
- 基于PI+QT实现OpenCV图像处理操作(基本环境搭建)
- 简单搭建adb 环境,及基本操作命令
- OSGI学习一(使用Apache Felix搭建OSGI开发环境)
- 在Eclipse中开发OSGi(1)搭建Felix环境
- [置顶] OSGI企业应用开发(二)Eclipse中搭建Felix运行环境
- jpa入门之环境搭建和CRUD基本操作
- Apache Felix 的OSGi开发环境搭建
- Spring MVC环境搭建与基本操作
- ubuntu基本操作和web环境搭建
- linux 基本操作以及搭建Java开发环境
- 【大数据系列】windows环境下搭建hadoop开发环境使用api进行基本操作
- 用docker搭建测试环境--docker的基本操作
- 本地搭建gitlab环境,配置邮件通知和基本操作
- jpa入门之环境搭建和CRUD基本操作
- jpa入门之环境搭建和CRUD基本操作
- mysql环境搭建 及 基本操作
- mybatis实战之路,疯狂的数据库操作框架、动态sql的mybats之快速搭建基本环境