如何使用Eclipse ECF

时间:2016-04-29 09:27:19

标签: java osgi eclipse-ecf r-osgi

我正在尝试使用我现有的RCP应用程序(基于火星)来使用远程OSGi服务。但是它似乎不起作用 - 我的应用程序的两个实例看不到另一个实例发布的服务。

我已将最新的ECF SDK添加到目标平台,并且已将以下捆绑包添加到我的产品运行时;

  • org.eclipse.ecf.discovery
  • org.eclipse.ecf.provider
  • org.eclipse.ecf.provider.remoteservice
  • org.eclipse.ecf.sharedobject
  • org.eclipse.equinox.concurrent
  • org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy
  • org.eclipse.osgi.services.remoteserviceadmin
  • org.eclipse.ecf.remoteservice.asyncproxy
  • org.eclipse.ecf.remoteservice
  • org.eclipse.ecf.osgi.services.distribution
  • org.eclipse.ecf.provider.jmdns
  • ch.ethz.iks.r_osgi.remote
  • org.eclipse.ecf.provider.r_osgi
  • org.eclipse.ecf.console
  • org.eclipse.ecf.provider.dnssd
  • org.xbill.dns
  • org.eclipse.ecf.provider.discovery

在我的一个捆绑激活器中,我有以下内容在start方法()

中注册我的服务
ServiceTracker _containerManagerServiceTracker = new ServiceTracker(_context, IContainerManager.class.getName(), null);
_containerManagerServiceTracker.open();

IContainerManager containerManager = (IContainerManager) _containerManagerServiceTracker.getService();

IContainer container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer");


IMyService myService = new MyService();
Properties props = new Properties();
props.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES, IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD);
props.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS, "ecf.r_osgi.peer");
// register remote service
context.registerService(IMyService.class, myService, props);

我知道某些东西正在作为第二个实例报告;

"WARNING: Port 9278 already in use. This instance of R-OSGi is running on port 9279"

我也看到一条记录出现" _ECFOSGIRSVC"在zeroconf浏览器中。

许多教程似乎表明这个服务应该神奇地在另一个实例上可用。但是没有出现任何内容(运行"服务"在应用程序控制台中仅列出本地服务)。一些问题;

  • 这真的只需要吗?
  • 我该如何调试?
    • 我如何知道该服务是否真正导出?
    • 我如何知道其他实例是否真的在搜索它?
  • 是否可以a)报告容器端点和"手动"连接其他实例?

有很多" HelloService"内容不完全相同的教程会使开始变得非常混乱!

1 个答案:

答案 0 :(得分:0)

尝试Riena Communication对于发布和绑定远程服务来说,它不那么复杂。它使用hessian作为通信协议。它与soap和co。相比真的很快,因为它的基于二进制的协议(不是xml)

我希望这会有所帮助。