Summary of interceptor introduced in POSA2

This pattern allows services to be added transparently to a framework and triggered automatically when certain events occur.

 

Concrete Framework : A concrete framework instantiates a generic and extensible architecture to define the services provided by a particular system.

 

Interceptors : Interceptors are associated with a particular event or set of events exposed by a concrete framwork. An interceptor defines the signatures of hook methods that the concrete framework will invoke automatically via a designated dispatching mechanism when the corresponding events occur. Concrete interceptors specialize interceptor interfaces and implement their hook methods to handle these events in an application-specific manner.

 

Dispatchers : To allow interceptors to handle the occurence of particular events, a concrete framework defines dispatchers for configuring and triggering concrete interceptors. Typically there is a dispatcher for each interceptor. A dispatcher defines registration and removal methods that applications use to subscribe and un-subscribe concrete interceptors with the concrete framework. A dispatcher also defines another interface that the concrete framework calls when specific events occur for which concrete interceptors have registered. When the concrete framework notifies a dispatcher that such an event has occurred, the dispatcher invokes all the concrete interceptor callbacks that have registered for it. A dispatcher maintains all its registered interceptors in a container.

 

Context Objects : Concrete interceptors can use context objects to access and control certain aspects of a concrete framework. Context objects can provide accessor methods to obtain information from the concrete framework and mutator methods to control the behavior of the concrete framework.

 

Application : An application runs on top of a concrete framework and reuses the services it provides. An application can also implement concrete interceptors and register them with the concrete framework to handle certain events. When these events occur, they trigger the concrete framework and its dispatchers to invoke concrete interceptor callbacks that perform application-specific event processing.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值