"Import-Bundle"和"Import-Bundle"之间有什么区别?和"Require-Bundle"? [英] What is the difference between "Import-Bundle" and "Require-Bundle"?

查看:232
本文介绍了"Import-Bundle"和"Import-Bundle"之间有什么区别?和"Require-Bundle"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

特定于spring source dm服务器的 Import-Bundle 和OSGi的 Require-Bundle 有什么区别?
我很困惑在项目中使用Import-Bundle还是Require-Bundle.

What is the difference between spring source dm server specific Import-Bundle and OSGi's Require-Bundle?
I am confused whether to use Import-Bundle or Require-Bundle in my project.

推荐答案

Import-Bundle与Require-Bundle相似,它在另一个捆绑软件上创建了完全依赖关系,包括该捆绑软件的依赖关系.这种 transitiveivity 不好,因为您不知道要依靠什么,从而制造了臭名昭著的"大泥巴"问题,我们在面向对象的编程中就非常熟悉.

Import-Bundle is similar to Require-Bundle, it creates a complete dependency on the other bundle, including that bundle's dependencies. This transitivity is bad because you have no idea what you depend, creating the infamous "big ball of mud" problem we're so familiar with in Object oriented programming.

在OO中,我们通过使用接口找到了解决这种纠缠的解决方案,它们将实现与规范分开. OSGi建立在类似的基础上,尽管它是服务合同的更高阶概念.这些合同(界面,权限,帮助程序类)存储在包中.在基于合同的编程中,您依赖合同,而不是实现.因此,OSGi捆绑包应依赖于软件包,因为它们代表合同.

In OO, we've found a solution to this entanglement by using interfaces, they separate implementation from specification. OSGi is built around a similar albeit of an higher order concept of service contracts. These contracts (interfaces, permissions, helper classes) are stored in a package. In contract based programming you depend on the contracts, not the implementations. Ergo, an OSGi bundle should depend on packages since they represent the contracts.

 Import-Package               <=> interface
 Import-Bundle/Require-Bundle <=> implementation class

Import-Bundle不是OSGi,它是专有的Spring扩展.这是Require-Bundle的较干净形式;不整洁对于支持某些Eclipse用例是必要的. OSGi决定不采用此标头,因为如果要从组件构建系统,则Require-Bundle/Import-Bundle基本上已损坏.

Import-Bundle is NOT OSGi, it is a proprietary Spring extension. It is a cleaner form for Require-Bundle; the uncleanliness was necessary to support some Eclipse use cases. The OSGi decided not to adopt this header since the Require-Bundle/Import-Bundle is fundamentally broken if you want to build systems from components.

这篇关于"Import-Bundle"和"Import-Bundle"之间有什么区别?和"Require-Bundle"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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