节点文献
基于开放实现原理的中间件——反射中间件的研究
MIddleware Based on Open Implementation--Researches on Reflective Middleware
【作者】 杨思忠;
【导师】 刘锦德;
【作者基本信息】 电子科技大学 , 计算机应用技术, 2002, 博士
【摘要】 软件设计在传统上遵循“黑箱”(black-box)抽象的原则,即一个模块应该呈现其功能而隐藏其本身的实现。这一点已成为处理计算机领域中许多重要问题,如可移植性、可重用性等的基本对策和理念。尽管黑箱抽象有许多优点,但事实表明,如果模块仅仅显露其功能性界面,有时并不能满足各种客户的不同需求。当前的中间件,无论CORBA、DCOM还是Java RMI基本上都采用了黑箱抽象的原则,因此它们都存在灵活性和适应性的先天性不足。但是中间件所处理的是十分复杂的分布式应用问题,因而常常需要上述的灵活性和适应性。 为此,我们建议采用开放其本身的实现(以下简称“开放实现”)的思想来设计中间件。所谓开放实现是一种新的抽象原则,就是将研究对象的下层实现“开放”出来。采用开放实现的模块呈现着双重界面,即基界面(base-interface)和元界面(meta-interface)。基界面就是这个对象应该呈现的传统界面,它提供了可对该对象所具功能的访问,而又不暴露其具体的实现。元界面则提供了客户所需的控制,可用于定制该对象的下层实现以使其适合用户的需要。但这种开放必须是有约束的和有效的。 反射是指所研究的对象“感知自己、自行推理和作用于自身”的一种能力,是设计对象的一种技术,也是一种具体实施开放实现的可用技术。开放实现所强调的是对象与客户之间的关系,而反射所强调的则是对象自身具有的一种潜在能力。如果要想将一个系统的实现开放出来,就得借助反射的能力将自身有效地且有约束地开放给客户,以提高系统的灵活性和适应性,并且还可以分离系统的功能性属性与非功能性属性。 每一次反射计算可以被分为两个逻辑部分:计算流上下文切换和元行为。经过研究,我们发现中间件的工作过程与反射机制的有类似之处,从而导出了中间件的反射视图,进而探索出了采用绑定具体化反射模型来设计中间件。在这个基础上,实现了一个反射中间件的原型RECOM,它支持着不同类型(不同协议、不同服务质量或其它绑定属性)的绑定器。随后设计了一个显式绑定协议,允许用户对特定分布式组件之间的绑定进行改动(配置),包括替换不同的激活器,以及配置请求级反射层和消息级反射层。依靠反射中间件RECOM的实现,可以满足分布式应用的不同服务质量的要求。 应用程序中涉及元界面的部分,称为元程序。一个相关的问题,就是元程序的复杂性。造成这种复杂性的一个重要原因是满足非功能性要求的分布式协议和算法的复杂性。应用程序编程人员,通常不是这些领域的专家,很难去定制这样的元程序以满足应用的需要。可以考虑由专门的元程序编程人员开发元程序,然后由应用程序编程人员根据需要选择使用,即将基程序与元程序关联起来。我们提出了一个基于交易器的关联协议,利用模板和策略实现了交易器的匹配规则。 文章通过反射中间件RECOM的实现,展示了开放实现思想和反射技术在中间件设计中的可行性和重要价值。
【Abstract】 Traditionally the design of software applies the principle of "black-box" abstraction, that is to say a model should present its function while hide the underlying implementation. It is already as the basic rule to deal with many important problems in computer science such as portability, reusability, and so on. Regardless of the advantages of the black-box abstraction, facts show that it is difficult to meet different demands of various clients if a model only exposes its functional interface. The current middleware, such as CORBA, DCOM, and Java RMI, basically depends on the principle of black-box abstraction, so they are inherently short of flexibility and adaptability. However, what middleware deals with is complex distributed applications, so the fore-mentioned flexibility and adaptability are usually required.For that reason, applying the conception of open implementation to the design of middleware is supposed. The so-called open implementation is a new abstraction principle which means to open the underlying implementation of the researched object. The model employing the open implementation presents dual interfaces, one is the base-interface, and the other is the meta-interface. The base-interface is really the traditional interface an object should supplies, which provides the access to the functions of the object while hides the implementation details. On the other hand, the meta-interface gives the control to clients, which is used to customize the underlying implementation to adapt to clients’ demands. But what is important is that this kind of openness should be restrictive and effective.Reflection is an ability of system to reason about and act upon itself. Reflection technology is a technology which can be used in object design, and also used as a feasible technology to carry out open implementation practically. What open implementation emphasizes is the relation between the client and the object, while what reflection stresses is a potential ability of the object itself. For a system to expose its implementation, the reflection capability is required to open itself effectively and restrictively to clients, which will improve the system’s flexibility and adaptability, as well as separate the non-functional properties from its functional properties.Every reflective computation can be divided into two logical parts, context switching and meta-computation. After studying carefully, we found the similarity between the procedure of middleware processing and the reflective mechanism. Then the reflective view of middleware is deduced, and a method applying binding-reification reflective model to design middleware is supposed. Based on this, a prototype of reflective middleware named RECOM is implemented, which supports different kinds of binders that represent different protocols, quality of service, and other binding properties. Then an explicit binding protocol is designed to allow users to adapt (or configure) the binding between specific distributed components, which means to replace the used binder, or configure request-level reflective layers and message-level reflective layers. Depending on the implementation of reflective middleware, various demands of QoS can be met in distributed applications.In an application program, the part pertained to the meta-interface is referred to as the meta-program. A related question is the complexity of meta-programs. One of the important reasons for the complexity is that the complexity of algorithms and distributed protocols used for non-functional requirements. It’s difficult for application programmers, who are usually not experts in these fields, to customize meta-programs to meet the requirements of applications. So it is desirable to let an other group of programmers to develop meta-programs, then the application programmer chooses the suitable meta-program as need, and binds the selected meta-program to the base-program. In order to do that, we present a binding protocol based on a trader, and apply the template and strategy to implement the m