BlueprintListener的使用
来源:互联网 发布:world of tanks mac 编辑:程序博客网 时间:2024/05/10 15:30
OSGI里面有很多种Listener,添加一个Listener一般是调用BundleContext里面的addListener,比如
BundleContext.addBundleListener();BundleContext.addFrameworkListener();BundleContext.addServiceListener();
但是,BlueprintListener有点不一样
下面有个简单的用法
package com.pp;import org.osgi.framework.BundleActivator;import org.osgi.framework.BundleContext;import org.osgi.framework.ServiceRegistration;import org.osgi.service.blueprint.container.BlueprintListener;public class BlueprintListenerExample implements BundleActivator{private ServiceRegistration<BlueprintListener> registration = null;public void start(BundleContext context) throws Exception{BlueprintListener blueprintListener = (event) -> {System.out.println("BlueprintListener " + event.getBundle().getSymbolicName() + ", type=" + event.getType());};registration = context.registerService(BlueprintListener.class, blueprintListener, null); }public void stop(BundleContext context) throws Exception{registration.unregister();}}
这样,就添加了一个BlueprintListener
10 0
- BlueprintListener的使用
- GUID使用的使用
- ${}的使用
- 的使用
- @[],@()的使用
- ->的使用
- +、-、*、/、%的使用
- &&的使用
- %:的使用
- Makefile中使用$$的使用
- Makefile中使用$$的使用
- Red5的使用--使用日志
- prefernce的使用具体使用
- 【工具使用】git 的使用
- 关于使用AsyncTaskLoader的使用
- 使用CABasicAnimation的基本使用
- 使用RocketMQ的客户端使用
- gulp的使用基本使用
- 移动端注意事项
- 倒序输出字符串
- LeetCode -- Multiply Strings
- <c:forEach>详解
- 安卓初学-创建Fragment(Creating a Fragment)
- BlueprintListener的使用
- 【Qt Warning】No1:Debug build
- Java中equals和==的区别
- linux下无法添加用户和组
- 华为oj之兄弟单词
- PhoneGap (Cordova 5.4.0) 生成android签名apk
- LeetCode -- Permutations II
- URL传递参数长度限制
- android studio 导入eclipse的项目