osgi

Dynamic target for declarative service in OSGI

こ雲淡風輕ζ 提交于 2019-12-02 04:38:31
Given a consumer which uses a service, how can this consumer select a specific provider dynamically using declarative service ? Example Service.java public interface Service { public void do(); } Provider1.java public class Provider1 implements Service { @Override public void do(){ //a way } } Provider2.java public class Provider2 implements Service { @Override public void do(){ //another way } } Consumer.java public class Consumer { private Service myService; protected void bindService(Service s){ // Actually it's Provider1 myService = s; } protected void unbindService(Service s){ myService =

How do you call an OSGi application from a non-OSGi application, and vice versa

烈酒焚心 提交于 2019-12-02 04:28:51
问题 I am considering writing a new set of applications using OSGi, but they will need to interact heavily with existing non-OSGi applications. To clarify, the new applications will need to call into existing non-OSGi code bases maintained by other teams (usually propriety services of varying protocols), and new non-OSGi applications will need to call the new OSGi services. I am not seeing much documentation for how to do this. Can someone please point me to the correct steps 回答1: It sounds like

How do you call an OSGi application from a non-OSGi application, and vice versa

回眸只為那壹抹淺笑 提交于 2019-12-02 02:04:25
I am considering writing a new set of applications using OSGi, but they will need to interact heavily with existing non-OSGi applications. To clarify, the new applications will need to call into existing non-OSGi code bases maintained by other teams (usually propriety services of varying protocols), and new non-OSGi applications will need to call the new OSGi services. I am not seeing much documentation for how to do this. Can someone please point me to the correct steps It sounds like you want to embed OSGi into a larger application. A good starting point for this is a blog post I wrote some

How to use Apache POI in OSGi

∥☆過路亽.° 提交于 2019-12-02 01:29:06
问题 I want to use Apache POI in OSGi to write an Excel workbook with the streaming, OOXML API (SXSSF). The streaming API is available since POI 3.9. As the latest Apache POI 3.11 jars are not bundles: What's the best way to get POI working in OSGi? I tried two approaches: embed the jars directly in the only bundle which will be using them use POI jars prewrapped as bundles I am despairing in getting all dependencies together. First about embedding the POI jar in my bundle: my bndtools file

OSGi Fragment bundle with Hibernate having Runtime pojos

為{幸葍}努か 提交于 2019-12-02 00:26:59
问题 My requirement is to map various database (particularly SQL Server, MySQl and Postgres) using hibernate ; from db record create a xml file. For hibernate i am creating hbm files and pojos at run-time using JAssist. My code works great, for further modularization i implement fragment bundles for each database.so that my host bundle will handle runtime class creation and adding them in classloader, hbm file creation logic, and BL. fragment calls it by passing parameters. when i create a

How to use Apache POI in OSGi

空扰寡人 提交于 2019-12-01 23:41:57
I want to use Apache POI in OSGi to write an Excel workbook with the streaming, OOXML API (SXSSF). The streaming API is available since POI 3.9. As the latest Apache POI 3.11 jars are not bundles: What's the best way to get POI working in OSGi? I tried two approaches: embed the jars directly in the only bundle which will be using them use POI jars prewrapped as bundles I am despairing in getting all dependencies together. First about embedding the POI jar in my bundle: my bndtools file contains -buildpath: \ ... libs/dom4j-1.6.1.jar;version=file,\ libs/poi-3.11.jar;version=file,\ libs/poi

OSGi bundles won't start - Unable to resolve sun.reflect.generics.reflectiveObjects

此生再无相见时 提交于 2019-12-01 22:47:42
After seemingly irrelevant changes in the code of my AEM project, my bundle fails to resolve. Upon inspecting the logs, I can see the following errors appearing. 22.04.2015 11:00:18.650 *ERROR* [qtp1266495948-35] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unresolved constraint in bundle my-bundle ... [caused by: Unable to resolve 401.121: missing requirement [401.121] osgi.wiring.package; (osgi.wiring.package=sun.reflect.generics.reflectiveObjects)]] The project compiles just fine locally and the problem only occurs after the bundle's

OSGi Fragment bundle with Hibernate having Runtime pojos

二次信任 提交于 2019-12-01 22:15:50
My requirement is to map various database (particularly SQL Server, MySQl and Postgres) using hibernate ; from db record create a xml file. For hibernate i am creating hbm files and pojos at run-time using JAssist. My code works great, for further modularization i implement fragment bundles for each database.so that my host bundle will handle runtime class creation and adding them in classloader, hbm file creation logic, and BL. fragment calls it by passing parameters. when i create a fragment bundle for each database, the runtime pojo class created in my host bundle is visible in my fragment

android利用apkplug框架实现主应用与插件通讯(传递任意对象)实现UI替换

谁说胖子不能爱 提交于 2019-12-01 19:13:18
时光匆匆,乍一看已半年过去了,经过这半年的埋头苦干今天终于有满血复活了。 利用apkplug框架实现动态替换宿主Activity中的UI元素,以达到不用更新应用就可以更换UI样式的目的。 先看效果图: 首先理解OSGI服务的基本概念,如下图 1.首先定义一个java接口(interface)用于规范宿主与插件之间的通讯协议 interface com.apkplug.osgi.service.showView void showView(Bundle bundle,View v,int index) ; //添加View void removeView(Bundle bundle,View v); //删除View 2.决定osgi服务提供者和使用者 ,这里我们定义是 宿主应用为"OSGI 服务提供者" ,插件为"OSGI 服务使用者"。 注:OSGI服务提供者 注册服务 OSGI服务使用者 查询服务 3.宿主应用实现showView接口,相应类为 com.apkplug.osgi.serviceImp.showViewImp 具体代码如下: public class showViewImp implements showView{ private LinearLayout layout =null; /** * @param root 插件 View保存UI容器 */

探索 Eclipse 的 OSGi 控制台

霸气de小男生 提交于 2019-12-01 19:13:05
从 V3.0 开始,Eclipse 通过选择开放服务网关协议(Open Services Gateway Initiative,OSGi)来替换先前版本中不稳定的 Eclipse 插件技术,从而实现了一次巨大飞跃。这次转变对于用户来说几乎是透明的,因为现在所使用的插件的安装和操作看上去和以前的插件没有什么不同。 图 1. Eclipse 内的插件 由 于 Eclipse 现在是在 OSGi 上构建的,因此我们在图 1 中看到的插件是功能完整的 OSGi 包。(图 2 显示了使用 OSGi 控制台运行 Eclipse 实例内的包。)通过使用 OSGi,Eclipse 支持业内认可的开放标准并且现在可以利用 OSGi 提供的功能,包括安全性、HTTP 服务、用户管理和其他功能。Eclipse 对 OSGi 的使用已经见到成效,因为我们看到插件间报告的冲突在减少而 Eclipse 的应用在持续增加。 图 2. Eclipse 内的 OSGi 包 Eclipse、Equinox、OSGi,天哪! OSGi Alliance 是一个独立的、非盈利性组织,负责 OSGi 技术,类似于 Eclipse Foundation 的职能。OSGi Alliance 负责制定描述 OSGi 技术的规范。简言之,OSGI 技术为应用程序开发提供了一种面向服务的基于组件的平台。各种实现都是基于这些规范的