清明时节雨

导航

连接器的语义描述

      代理连接器声明组件实例具备的某项功能并非由其自身实现,而是由另一个具备兼容能力的实例。这可以是另一个组件的实例,或者(简单情况下)仅仅另一个类的实例。后一种情况下,代理连接器连接组件的接口或端口与作为其部件的一个包含的类。这个类必须和相连接的接口或端口存在实现关系。

      代理连接器用于对行为的层次化分解建模,这种情况下的服务的最终实现处于由多层嵌套之下。代理一词体现了具体的消息和信号在被连接的端口之间的转递,这些端口甚至有可能跨越很多层。要知道这些信号的传递并不一定被所有的系统环境或实现所理解。

      一个端口可以由多个下级组件的端口代理。这时,这些下级端口必须共同实现上级端口功能的代理。执行的时候,信号会传递给恰当的端口。如果多个目标端口都可以处理同一个信号,那么信号将会分别传递给每一个端口。 

      集合连接器的执行时语义描述信号从作为服务要求者的借口传递到座位服务提供者的接口。如果一个连接器连接了一个要求服务的接口或端口和多个提供服务的组件提供的接口,那么具体实现的实例需要在运行时才能决定。类似的,如果一个连接器连接了多个要求服务的接口或端口到同一个提供服务的组件提供的接口,表明请求可以来自多个不同的实例。

      相连接的要求和提供服务的端口之间的接口兼容性保证了系统中的组件可以由提供相同服务的组件来替换。相应的,如果需要依赖现有服务而扩展系统功能的时候,可以使用集合连接器连接新的组件。这样,增加和旧组件提供的服务外观相同的新组件,使其看起来和旧的类型相同,然后定义新的集合连接器,将新组建的端口和原端口相连接。

 

原文:

A delegation connector is a declaration that behavior that is available on a component instance is not actually realized by that component itself, but by another instance that has “compatible” capabilities. This may be another Component or a (simple) Class. The latter situation is modeled through a delegation connector from a component Interface or Port to a contained Class that functions as a Part. In that case, the Class must have an implements relationship to the Interface of the Port.

Delegation connectors are used to model the hierarchical decomposition of behavior, where services provided by a component may ultimately be realized by one that is nested multiple levels deep within it. The word delegation suggests that concrete message and signal flow will occur between the connected ports, possibly over multiple levels. It should be noted that such signal flow is not always realized in all system environments or implementations.

A port may delegate to a set of ports on subordinate components. In that case, these subordinate ports must collectively offer the delegated functionality of the delegating port. At execution time, signals will be delivered to the appropriate port. In the cases where multiple target ports support the handling of the same signal, the signal will be delivered to all these subordinate ports.

The execution time semantics for an assembly connector are that signals travel along an instance of a connector, originating in a required port and delivered to a provided port. Multiple connectors directed from a single required interface or port to provided interfaces on different components indicates that the instance that will handle the signal will be determined at execution time. Similarly, multiple required ports that are connected to a single provided port indicates that the request may originate from instances of different component types.

The interface compatibility between provided and required ports that are connected enables an existing component in a system to be replaced by one that offers the same set of services. Also, in contexts where components are used to extend a system by offering existing services, but also adding new functionality, assembly connectors can be used to link in the new component definition.

posted on 2012-06-24 23:46  学而不思  阅读(279)  评论(0编辑  收藏  举报