Composite View
做RCP经常用到,一个perspective是有多个独立的view动态组合,可定制,很灵活,易复用。
View Helper
展示层的变动需求很频繁。如果与Service访问,业务逻辑数据结构交织紧密。则系统就很僵硬,难以适应变化。将与业务逻辑有关的实现分离出来。View是干净的,Business Model是干净的,只有View Helper既了解Model,又了解View的数据结构。
进一步分层:使用Business Delegate(我们的Service Helper),View Helper与Business Model也独立了。
A view contains formatting code, delegating its processing responsibilities to its helper classes, implemented as JavaBeans or custom tags. Helpers also store the view's intermediate data model and serve as business data adapters.
Business Delegate as Helper Strategy
Helper components often make distributed invocations to the business tier. We suggest using a business delegate in order to hide the underlying implementation details of this request, such that the helper simply invokes a business service without knowing details about its physical implementation and distribution
Business Delegate
经常用,就是Client或Controller与Services或Business Model分层。有两种模式,代理和适配。目的不同,实现差不多。一个是为了代理,一个是为了接口对齐。
Session Facade
每个Service把给客户调用的功能接口暴露出来,每个方法可能是多个业务逻辑单元的组合。统一的入口,分层,减少小的功能调用次数。类似Service的Front Controller。反正就是好处特别的多。
Service Locater
又跟View Navigator差不多,逻辑跟实现分离(加了这一层)。IOC就行了吧。
Transfer Object Assembler
又跟Composite View类似,用各种Business Service返回结果的Bean组合成View Object。
Transfer Object(Value Object)
用来传输数据的对象,对Business Object的包装,打包数据减少了网络调用的次数,简化了接口。我们用的Transaction Object(里面包了一些List of SDO, 和其他标记属性)。通常需要序列化(传输需要)。
Transfer Object is constructed on demand by the enterprise bean and returned to the remote client
Data Access Object
又加一层,是数据库实现分离出来。透明,容易迁移,数据库访问集中化-易于维护,
Value List Handler
客户的Query请求可能需要跨越多个Services,会引起多个Servcies执行大量的遍历操作。用单独的Query Service,提供统一的查询入口,同时可以用缓存,或提供统一的分页,排序请求。
Composite Entiry
DAO是用来访问数据库的,当然不能与业务逻辑一一对应,Composite Entity应运而生,代表了Business Model的数据模型。这种Entity应该不止Getter & Setter,蕴含了模型之间的关系和业务逻辑。虽然分层是多了点但是也有意义。RDS之所以不好用,主要就是DAO=Business Object = Transfer Object = View Object
Use Composite Entity to model, represent, and manage a set of interrelated persistent objects rather than representing them as individual fine-grained entity beans. A Composite Entity bean represents a graph of objects.
Service Activator
异步。企业应用中,同步,异步的Service各有用武之地。
Use a Service Activator to receive asynchronous client requests and messages. On receiving a message, the Service Activator locates and invokes the necessary business methods on the business service components to fulfill the request asynchronously.The ServiceActivator is a JMS Listener