IDEA felix osgi项目搭建(1)
idea创建felix项目
felix官网
环境准备
- jdk安装
- felix 项目下载
- 解压启动:
java -jar bin/felix.jar
felix启动,安装bundle目录所有的bundles。默认的,bundle目录含有shell相关的用户界面来与框架交互。安装到框架的bundle会复制一份到缓存目录(felix-cache)。
使用不同的缓存目录使用命令:
java -jar bin/felix.jar <cache-path>
(进入bin目录,未启动成功? java -jar felix.jar)
4. shell命令
在goto shell 输入help查看命令说明,命令名
<scope>:<name>
安装bundles 使用felix:install 查看bundle使用felix:lb
输入stop 0 关闭系统bundle。 再次启动关联的cache安装的bundles会自动重新加载。
idea搭建开发环境
创建文件manifest.mf
新建Activator.java (官网copy)
package com.ppx.demo;import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;public class Activator implements BundleActivator, ServiceListener
{/*** Implements BundleActivator.start(). Prints* a message and adds itself to the bundle context as a service* listener.* @param context the framework context for the bundle.**/@Overridepublic void start(BundleContext context){System.out.println("Starting to listen for service events.");context.addServiceListener(this);}/*** Implements BundleActivator.stop(). Prints* a message and removes itself from the bundle context as a* service listener.* @param context the framework context for the bundle.**/@Overridepublic void stop(BundleContext context){context.removeServiceListener(this);System.out.println("Stopped listening for service events.");// Note: It is not required that we remove the listener here,// since the framework will do it automatically anyway.}/*** Implements ServiceListener.serviceChanged().* Prints the details of any service event from the framework.* @param event the fired service event.**/@Overridepublic void serviceChanged(ServiceEvent event){String[] objectClass = (String[])event.getServiceReference().getProperty("objectClass");if (event.getType() == ServiceEvent.REGISTERED){System.out.println("Ex1: Service of type " + objectClass[0] + " registered.");}else if (event.getType() == ServiceEvent.UNREGISTERING){System.out.println("Ex1: Service of type " + objectClass[0] + " unregistered.");}else if (event.getType() == ServiceEvent.MODIFIED){System.out.println("Ex1: Service of type " + objectClass[0] + " modified.");}}
}
项目启动配置:
打开运行配置,选择osgi bundle 选择合适的osgi框架,并将当前module添加进来
如果使用ide的配置文件,点击项目配置
然后运行,当当当,控制台输入lb,写的demo就出现了。
IDEA felix osgi项目搭建(1)相关推荐
- osgi php,idea搭建osgi项目开发学习
本文介绍了用Idea搭建OSGI项目开发的过程,演示使用的JDK8,Equinor OSGI Framework. OSGI简介 OSGI的全称是Open Service Gateway Initia ...
- Eclipse插件(RCP)项目搭建
文章Eclipse插件(RCP)开发环境搭建 和 Eclipse插件(RCP)开发环境搭建(二)介绍了RCP项目开发环境搭建.本文将使用前面打的环境进行第一个RCP项目搭建及运行 目标 搭建一个RCP ...
- idea社区版开发OSGi项目
目录 使用Idea OSGI插件开发 使用Maven OSGI插件开发 使用Idea OSGI插件开发 下载Equinox SDK https://download.eclipse.org/equin ...
- 超简单的react和typescript和引入scss项目搭建流程
1.首先我们先创建一个react项目,react官网也有react项目搭建的命令 npx create-react-app my-app cd my-app 2.安装我们项目需要的样式依赖,这个项目我 ...
- angular6 mysql_Angular6项目搭建
安装工具: Nodejs, npm 最新版, https://nodejs.org/en/ Angular CLI, npm install -g @angular/cli Visual ...
- webstorm打包rn项目_React 之 项目搭建
阅读本文约需要6分钟 大家好,我是你们的导师,经常看我朋友圈的同学应该知道,我每天会在微信上给大家免费提供以下服务! 1.长期为你提供最优质的学习资源! 2.给你解决技术问题! 3.每天在朋友圈里分享 ...
- 个人博客开发-01-nodeJs项目搭建
// window系统下 1.nodeJs 安装 nodeJs 安装 看 这里 , 先下载再下一步下一步就OK了,我的是在C盘里安装的. 安装完以后 按 win + R ,在弹出的小框框里输入 CM ...
- Spring MVC + Mybatis项目搭建
1.参考<Java Spring MVC项目搭建(一)--Spring MVC框架集成>配置spring mvc需要的jar包及eclipse配置(主要是针对servlet-api.jar ...
- SSM项目搭建一(终)
2019独角兽企业重金招聘Python工程师标准>>> 项目搭建使用的不仅仅只是前面所说的那些,还有一下比如gson或jackson.个人类库.定时器等等,这里就不一一赘述了.下面看 ...
- spring原理案例-基本项目搭建 01 spring framework 下载 官网下载spring jar包
下载spring http://spring.io/ 最重要是在特征下面的这段话,需要注意: All avaible features and modules are described in the ...
最新文章
- 利用partition分组查询 查询每个分组第一条数据
- 有关接口 笔记 懒人版
- 程序员发展应该尽早明白13个道理
- [渝粤教育] 广东-国家-开放大学 21秋期末考试招投标与合同管理10217k2 (2)
- Let's Encrypt(开源SSL证书管理工具)
- 交叉验证(Cross Validation)简介
- python cad模块_Pycad: Python Extension for AutoCad
- redis常见面试题和答案
- wim linux u盘启动,在U盘启动中安装CDLinux
- Word 文档乱码-请选择使文档可读的编码 重启电脑-不是解决方法的解决方法(可能已经晚了)
- Mac小白应该使用App Tamer减慢或停止哪些应用程序?
- 计算机系统基础实验——数据的机器级表示
- Excel·VBA自定义正则表达式函数、使用
- 使用偏好设置、属性列表、归档解档保存数据、恢复数据
- 社会主义市场体系与宏观调控
- [20150901]提示USE_CONCAT.txt
- JavaSE-Adventure(VII) Java OOP 面向对象程序设计
- android 播放3gp音频,说说 Android 中如何操作音频与视频文件
- Halo——zcash新的零知识证明机制,无需Trusted Setup
- 开启我的博客之旅吧!
热门文章
- Android NDK-EGL 初级
- Mac查看端口号占用
- 比较常用的平面设计软件都有哪些?
- sqlite3 java 内存,嵌入式数据库SQLite与Java
- 第一次尝试使用Python创建季节性ARIMA模型
- 2021届的Java后端应届生面试总结
- linux chsh命令参数及用法详解(linux设置系统shell命令) 详细出处参考:http://www.jb51.net/LINUXjishu/57945.html
- java获取pid_JAVA 取得程序执行的PID(Process ID)
- 集群搭建——SGE与PBS
- Steam一直显示断开服务器,为什么吃鸡老于steam服务器断开连接 | 手游网游页游攻略大全...