JSR227:J2EE数据绑定及数据访问标准

Oracle提交了一份关于“J2EE数据绑定及数据访问标准”的标准提案,JSR227,计划将MVC模式中view到controller的数据绑定及访问形式标准化,涉及的MVC实现可能包括Struts、JSF和Swing等。这是个有趣的尝试,如果成功,Java开发者将获得一个统一的MVC数据绑定及访问方法。不过我怀疑它成功的可能性。

下列JSR227的一个简单介绍

——————————————————

Increasingly, enterprise applications model persistent datasources as Java classes and develop Business Services[1] that query, manipulate, and persist these objects. However, developing interactive user interfaces that use Business Services to correctly manipulate the data objects requires understanding and coding against complex sets of design patterns and standards that underly the various Service technologies. This proposed specification will define a framework of classes, called Declarative Bindings, that formalize the characteristic interactions between typical UI components and values and methods available on Business Services. By using the Declarative Bindings set forth in this specificiation, any Java UI rendering technology can declaratively bind to any Business Service. Example UI components and controller technologies include: JSP JSTL tags, JSF, Struts, and Swing. Example business services include SOAP Web Services, EJB Session Beans or any Java class being used as an interface to some functionality.

When accessed by the UI components and UI controller, the metadata-driven Declarative Bindings interact with the classes that they are bound to, providing J2EE standards-compliant support for things like:

  1. Binding (locating and accessing)
    1. single attribute (appropriate for input fields and other single value UI components)
    2. objects with related collection attributes (appropriate for tree controls)
    3. collections of objects (appropriate for displaying in tables)
  2. Navigating
    1. current row tracking (first, next, prev, last)
    2. current range (appropriate for scrollbar pagination)
    3. coordinating related collections (appropriate for master/detail display)
    4. multiple iterators sharing same collection (appropriate for split pane)
  3. Performing actions
    1. normalizing the interaction of generic insert, update and delete operations on transactional objects and collections of objects
    2. surfacing status of bound objects (to know whether the UI component needs to be re-rendered)
    3. dispatching to methods to perform custom services.
    4. validating and reporting validation exceptions.

Declarative Bindings completely decouple the user interface from the data portions of the application. In the nomenclature of MVC application architectures, this specification standardizes metadata and behavior for binding to elements of the Model from both the View and the Controller.

The Declarative Binding classes provide attributes that are easily accessible to all user interface technologies that support EL or Java. Declarative Bindings manage the interaction with Business Services. They drive their behavior off metadata, which is convenient for tools vendors. One of the goals of this proposal is allow interoperability between tools products that interactively bind sophisticated interfaces to the services that provide the data.

To facilitate a common mechanism for accessing diverse Business Service technologies this specification proposes that the Declarative Bindings access the Business Services via a lightweight abstraction layer called Data Controls.

Data Controls provide supplemental metadata about the Business Service's capabilities and constraints as well as support a simple interface for normalizing typical interactions with the Service. Data Controls comprehensively describe the attributes and methods so that UI components can make intelligent assumptions about how to render the data. In addtion, the Data Control standardizes access to functionality that is typically required by data-intensive, interactive user interfaces. Examples of functionality could include how the Business Service is instantiated, navigated, invoked, sychronized, transacted or released. This JSR will not impose any requirements for the types of attributes or methods on the Data Control or any implementation requirements. Those decisions will be left to the implementor of the Data Control and revealed to the Declarative Bindings and UI via the Data Control interface.

[1] By Business Service we mean any class that publishes objects and provides methods that manipulate the objects. I.e. The actual term may vary according to the Business Service technology, SessionFacade, WebService, ApplicationModule, etc.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值