OSGI中的服务和组件 [英] Service and Component in OSGI

查看:105
本文介绍了OSGI中的服务和组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对OSGI概念有些疑问,但是需要澄清它们以便对概念有更好的理解.谁能告诉我OSGI Service和Component有什么区别.我所知道的是,服务就像Java中的接口文件一样,可以由其他服务或组件使用.而组件就像是服务的特定实现.

I have some little silly doubts in an OSGI concepts but they need to be clarified to have better understanding of concepts. Can anybody tell me what is the difference between OSGI Service and Component. What i know is that Service is like an interface file in java that can be used either by a different service or by a component. While component is like a particular implementation of the service.

请让我知道我是否做错了,或者建议我可以从中获得一些帮助的链接.

Please let me know if i am wrong or suggest some link from where i can get the things nicely.

推荐答案

OSGi核心规范定义了服务模型,该模型是OSGi概念的关键部分.服务是实现声明类型(通常是接口)的对象(实例). OSGi框架提供了服务层,该服务层是服务提供者和服务使用者之间的代理.

The OSGi Core specification defines the service model which is a key part of the OSGi concept. A service is an object (instance) which implements a declared type (normally an interface). The OSGi framework provides the service layer which is a broker between service providers and service consumers.

DS引入了服务组件的概念,它们是捆绑包中的类,由DS运行时(SCR)管理.组件由捆绑包中的XML描述,由SCR读取.这些组件一旦实例化并声明为服务,便可以由SCR注册为服务.

DS introduced the concept of Service Components which are classes in a bundle which that are managed by the DS runtime (SCR). The components are described by XML in the bundle which is read by SCR. These components, once instantiated and if declared to be services, can be registered as services by SCR.

因此组件可以是服务(但不一定是服务),并且可以使用服务.

So components can be services (but they do not have to be) and they can use services.

这篇关于OSGI中的服务和组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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