Felix是Apache旗下的一款实现OSG规范I的框架。访问地址:http://felix.apache.org/

搭建基本的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 1ID|State      |Level|Name0|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 1ID|State      |Level|Name0|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 1ID|State      |Level|Name0|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 1ID|State      |Level|Name0|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 1ID|State      |Level|Name0|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 1ID|State      |Level|Name0|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 1ID|State      |Level|Name0|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 1ID|State      |Level|Name0|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!

[OSGI] Felix基本环境搭建及操作相关推荐

  1. cs231n assignment1 环境搭建+实践操作

    网易云课程视频及作业链接 http://study.163.com/course/courseMain.htm?courseId=1003223001 1. 环境搭建 根据我第一篇的文章成功进入了环境 ...

  2. Python opencv图像处理基础总结(一) 环境搭建 基础操作

    学过的知识,会过时.会遗忘,但在努力过程中学会的处事态度和做事习惯,都会留在骨子里,变成我们的一部分. Open Source Computer Vision Library,OpenCV于 1999 ...

  3. 大数据学习1 - hadoop环境搭建及操作

    目录 目录 目录 一.什么是大数据? 二.什么是hadoop? 1.Hadoop核心组件 2.HDFS架构 3.MapReduce 3.Yarn架构 ​编辑 三.Hadoop的集群模式 1.完全分布模 ...

  4. java osgi equinox_OSGI Equinox 环境搭建

    2.1.3  HelloWorld(1) 在这一节中,我们将完成一个HelloWorld的例子.之前大家应该看到过Java语言.C语言或C++等语言中的HelloWorld,那些HelloWorld程 ...

  5. 软件测试之linux环境搭建与操作Xshell、Xftp

    操作系统 linux 开源的,免费的:图形化窗口可以不选择安装(节约资源) 发行版:centos.redhat.kali.Ubuntu.debian.麒麟 windows 微软的操作系统:商业的,收费 ...

  6. Vue开发环境搭建详细操作(NodeCnpmVue)

    目录 一.安装node.js 二.安装cnpm 三.安装Vue 四.常用命令 五.其他扩展信息 一.安装node.js 1.官网下载地址:Download | Node.js 2.设置nodejs p ...

  7. oa项目环境搭建的操作步骤详解

    dto:多表关联查询用单独建一个类,把查询数据放dto即可 vo:是view的缩写.单独定义一个类 转载于:https://www.cnblogs.com/Koma-vv/p/10562037.htm ...

  8. WordPress环境搭建

    服务器环境: 采用XAMPP(Apache+MySQL+PHP+PERL) 下载地址:https://www.apachefriends.org/download.html(根据需要的系统下载最新的) ...

  9. Mac版 Xcode+Tagent+airtest环境搭建

    Mac版 Xcode+Tagent+airtest环境搭建-详细操作步骤 在IOS平台进行Airtest测试,需要进行如下部署. 1. iOS-Tagent 在手机上创建一个WebDriver服务器, ...

  10. OSGI企业应用开发(二)Eclipse中搭建Felix运行环境

    上篇文章介绍了什么是OSGI以及使用OSGI构建应用的优点,接着介绍了两款常用的OSGI实现,分别为Apache Felix和Equinox,接下来开始介绍如何在Eclipse中使用Apache Fe ...

最新文章

  1. 在raspberry的jessie版系统上安装opencv3.0
  2. asp.net 2.0 简单实现url重写
  3. Gradle修改本地仓库的位置
  4. ubuntu14.04管理员密码忘记的解决方法
  5. python selenium鼠标点击_Python+Selenium学习--鼠标事件
  6. SAP Cloud for Customer里如何根据产品ID拿到其UUID
  7. 前端学习(3133):react-hello-react之高阶函数
  8. acer软件保护卡清除工具clear_使用Windows 10内置工具释放硬盘空间的最佳方法
  9. 纯css3云彩动画效果
  10. Redis深入浅出----演讲
  11. 【Gamma】Scrum Meeting 6
  12. 计算机端口详解(总结)
  13. 闲谈Python语言入门
  14. navicat 中文注册码
  15. word目录缩进设置
  16. Android本地数据存储:Shared Preferences安全风险浅析
  17. twosum 两数之和 C++实现 java实现
  18. 堡垒机和跳板机的三大区别分析-行云管家
  19. node.js集成sendgrid邮件发送及其它功能
  20. 原材料入库控制的三个问题

热门文章

  1. Opencv入门(播放AVI视频)
  2. 安徽软件技术职业适应性测试,2019年职业适应性(职业技能)测试纲要
  3. 线段树(segment tree),看这一篇就够了
  4. CoppeliaSim(原Vrep)中实现多关节机械臂的正运动学仿真【CoppeliaSim与matlab共享内存通信实现】
  5. Scala基础入门(五)Scala 内置9种数据类型
  6. iOS 打开天猫/淘宝/京东客户端并且进入商品详情页/店铺主页的方法
  7. 再现隐私之争_反谷歌FLoC联盟: selenium谷歌浏览器报错: Error with Permissions-Policy header
  8. 浅谈辅助功能 AccessibilityService
  9. Proximal Algorithms 6 Evaluating Proximal Operators
  10. 千里马android framework实战开发-binder驱动之oneway导致的transaction failed