如何从非OSGi应用程序调用OSGi应用程序,反之亦然 [英] How do you call an OSGi application from a non-OSGi application, and vice versa

查看:89
本文介绍了如何从非OSGi应用程序调用OSGi应用程序,反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用OSGi编写一组新的应用程序,但是它们将需要与现有的非OSGi应用程序进行大量交互.

I am considering writing a new set of applications using OSGi, but they will need to interact heavily with existing non-OSGi applications.

为澄清起见,新应用程序将需要调用由其他团队维护的现有非OSGi代码库(通常是各种协议的专有服务),而新的非OSGi应用程序将需要调用新的OSGi服务.

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

推荐答案

听起来您想将OSGi嵌入到更大的应用程序中.一个不错的起点是我前段时间写的博客文章: http://njbartlett.name/2011/07/03/embedding-osgi.html

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 time ago: http://njbartlett.name/2011/07/03/embedding-osgi.html

在OSGi捆绑包和外部" OSGi对象之间创建可见性的技巧是使用系统捆绑包的BundleContext发布和/或使用服务.嵌入代码必须知道要在OSGi中可见的外部应用程序中的对象,并且应将它们作为服务发布.请注意,您需要通过系统捆绑包导出来导出服务接口包-博客文章中介绍了如何做到这一点.

The trick to creating visibility between OSGi bundles and the objects "outside" OSGi is to publish and/or consume services using the system bundle's BundleContext. The embedding code must be aware of the objects from the outer application that you want to make visible into OSGi, and it should publish them as services. Be aware that you need to export the service interface packages via the system bundle exports -- how to do this is described in the blog post.

这篇关于如何从非OSGi应用程序调用OSGi应用程序,反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆