尽展体育的魅力,创造历史辉煌!2008让我们为奥运加油,为中国加油!
 
 奥运金牌榜
  
  高级搜索
  首页   技术论坛   博客   产品中心   资源中心   银弹在线   商城  





探讨: 为什么需要SDO?    
#1楼
给作者发送短消息 给作者发送短消息 实名会员 商务会员 
查看用户其他信息
总分 471 分
财富 484 goCom币
威望 67
排名 第 56 名
段位 新手必读

很多朋友对于SDO这个名词已经耳熟能详了,然而对于SDO解决什么问题,具体包括什么内容,可能还没什么概念,所以我从SDO白皮书和标准中摘录了部分内容,翻译成中文,放在这里,供大家参考。

SDO简介
Service Data Objects (SDO) [1] is a specification for a programming model that unifies data programming across data source types, provides robust support for common application patterns, and enables applications, tools, and frameworks to more easily query, view, bind, update, and introspect data. This white paper discusses the motivation behind SDO, presents the SDO architecture and discusses opportunities for further enhancements by vendors in the industry.
Service Data Objects (SDO) 是一种编程模型的规范,它统一了访问不同类型数据源时的数据编程,为常见应用模式提供全方位的支持,允许应用、工具和框架等更加容易的查询、展示、绑定、更新和检索数据。
 
SDO关键特性
动态数据API(Dynamic Data API).
Data Objects often have typed Java interfaces. However,sometimes it is either impossible or undesirable to create Java interfaces to represent the Data Objects. One common reason for this is when the data being transferred is defined by the output of a query. Examples would be:
A relational query against a relational persistence store.
An EJBQL queries against an EJB entity bean domain model.
Web services.
XML queries against an XML source.
In these situations, it is necessary to use a dynamic store and associated API. SDO
has the ability to represent Data Objects through a standard dynamic data API.
数据对象通常都有对应的Java接口。然而有时候开发者无法或者难于为一些数据对象创建Java接口,常见的情况是被传输的数据是通过查询的输出来定义的。比如以下场景:
对关系型数据库的一次查询.
使用EJBQL查询EJB实体Bean.
Web服务(Web services).
对XML资源进行的XML查询.
在这些情况下,我们需要使用动态的存储和相关API。SDO有能力支持通过标准的、动态的数据API来表示数据对象。
静态数据API支持(Support for Static Data API).
In cases where metadata is known at development time (for example, the XML Schema definition or the SQL relational schema is known), SDO supports code-generating interfaces for Data Objects. When static data APIs are used, the dynamic data APIs are still available. SDO enables static data API code generation from a variety of metamodels, including:
Popular XML schema languages.
Relational database schemas with queries known at the time of code
generation.
Web services, when the message is specified by an XML schema.
JCA connectors.
JMS message formats.
UML models
While code-generation rules for static data APIs is outside the scope of this core
SDO specification, it is the intent that SDO supports code-generated approaches
for Data Objects.
对于那些在应用开发时元数据已经明确的数据对象(比如XML Schema定义或者SQL关系Schema已经确定的情况),SDO支持使用接口来处理. 在使用静态API时,动态API仍然有效. SDO支持从多种元数据模型中生成静态数据API,包括:
通常的XML Schema.
在代码生成时能够确定的关系型数据库Schema.
那些通过XML Schema定义了消息接口的Web services.
JCA连接器(JCA connectors).
JMS消息格式(message formats).
UML模型(models)
复杂数据对象(Complex Data Objects).
It is common to have to deal with “complex” or “compound” Data Objects. This is the case where the Data Object is the root of a tree, or even a graph of objects. An example of a tree would be a Data Object for an Order that has references to other Data Objects for the Line Items. If each of the Line Items had a reference to a Data Object for Product Descriptions, the set of objects would form a graph. When dealing with compound data objects, the change history is significantly harder to implement because inserts, deletes, adds, removes and re-orderings have to be tracked, as well as simple changes. Service Data Objects support arbitrary graphs of Data Objects with full change
summaries.
我们经常需要处理"复杂"或者"复合"数据对象,这类数据对象可能是数据树的根节点或者是数据图(DataGraph) .比如一个订单对象中引用了多个订货信息就是数据树的例子,如果每一个订货信息还引用了货物详细信息,这些对象就组成了数据图.当处理复合数据对象时,数据对象的变更摘要是非常难于实现的,因为数据对象的简单变化或者是插入、删除、增加、移除和重新排序动作都要被记录下来. SDO支持任意的数据图和它的变更摘要。
变更摘要(Change Summary).
It is a common pattern for a client to receive a Data Object from another program component, make updates to the Data Object, and then pass the modified Data Object back to the other program component. To support this scenario, it is often important for the program component receiving the modified Data Object to know what modifications were made. In simple cases, knowing whether or not the Data Object was modified can be enough. For other cases, it can be necessary (or at least desirable) to know which properties were modified.Some standard optimistic collision detection algorithms require knowledge not only of which columns changed, but what the previous values were. Service Data Objects support full change summary.
一种很常见的场景是从另外一个构件中获取数据对象,对该数据对象进行更新,然后将更新过的数据对象传递给另外一个构件。为了支持这种场景,接收被修改后的数据对象的构件必须知道该数据对象的那些内容被修改了. 简单情况下,只要知道数据对象是否被修改就足够了,另外一些情况下,必须知道(或者最少想要)数据对象的那些属性被修改过.一些标准的乐观冲突检测算法不仅知道哪些列被修改过,还可以知道被修改之前的值是什么,SDO支持完整的变更摘要.
遍历数据图(Navigation through graphs of data).
SDO provides navigation capabilities on the dynamic data API. All Data Objects are reachable by breadth-first or depth-first traversals, or by using a subset of XPath 1.0 expressions.
SDO支持通过动态数据API遍历整个数据图,所有的数据对象通过广度优先遍历(breadth-first)或者深度优先遍历(depth-first)可以被访问。或者直接使用XPath 1.0的子集进行访问.
元数据(Metadata).
Many applications are coded with built-in knowledge of the shape of the data being returned. These applications know which methods to call or fields to access on the Data Objects they use. However, in order to enable development of generic or framework code that works with Data Objects, it is important to be able to introspect on Data Object metadata, which exposes the data model for the Data Objects. As Java reflection does not return sufficient information, SDO provides APIs for metadata. SDO metadata may be derived from:
XML Schema
EMOF (Essential Meta Object Facility)
Java
Relational databases
Other structured representations.
许多应用中数据被返回数据的范围都是编码在程序中的,他们知道要调用哪个方法,要访问数据对象的哪些字段。但是为了支持泛型、框架代码中数据对象的访问,必须能够反射访问数据对象的元数据,这些元数据暴露了数据对象的数据模型。由于Java反射没有返回足够的信息,SDO提供了元数据访问的API,SDO元数据可以从如下方式获得:
XML Schema
EMOF(Essential Meta Object Facility)
Java
关系型数据库
其他结构化表示方法
校验和约束(Validation and Constraints).
Supports validation of the standard set of constraints captured in the metadata. The metadata captures common constraints expressible in XML Schema and relational models (for example, occurrence constraints).
Provides an extensibility mechanism for adding custom constraints and validation.
 
支持在元数据中设置的一组标准约束条件的校验。元数据获取使用XMLSchema和关系型模型中表示的普通约束条件。
提供了约束和校验的可扩展机制,可以提供自定义的约束、校验。
关联关系完整性(Relationship integrity).
An important special case of constraints is the ability to define relationships between objects and to enforce the integrity of those constraints, including cardinality, ownership semantics and inverses. For example, consider the case where an employee has a relationship to its department and a department inversely has a list of its employees. If an employee’s department identifier is changed then the employee should be removed, automatically, from the original department’s list. Also, the employee should be added to the list of employees for the new department. Data Object relationships use regular Java objects as opposed to primary and foreign keys with external relationships.
Support for containment tree integrity is also important.
 
约束的重要应用就是定义对象之间的关联关系,保证约束的完整性,包括集合(cardinality,一对多)、所有者语义和反转(双向关系)等。比如一个雇员(employee)和他所在的部门存在关系,相反地,他的部门有一些雇员。如果一个雇员的部门发生了变化,那么这个雇员就必须自动地从原来的部门中移除,同时,这个雇员必须被加入到新的所属部门的雇员集合中去。数据对象关联关系使用正常的java对象表示,而不使用带有外部关系的主键、外键。
内容包容树的完整性也非常重要。
 
为什么是SDO
While the Java™ platform and J2EE provide a variety of data programming models and APIs, these technologies are fragmented and are not always amenable to tooling and frameworks. Further, some of the technologies can be hard to use and may not be sufficiently rich in functionality to support common application needs. SDO is intended to create a uniform data access layer that provides a data access solution for heterogeneous data sources in an easy-to-use manner that is amenable to tooling and frameworks. SDO is not motivated by a need to replace lower-level data access technologies (see Relationship to Other Technologies below). SDO has the following goals:
Java平台和JavaEE中提供了非常多的数据编程模型和API,这些技术都片面的解决一部分问题,而且对工具和框架的支持不够友好。此外,一部分技术非常难于使用,支持通用应用时在功能上也不够完善。SDO的目标是创建一个统一的数据访问层,通过简单易用的形式提供对异构数据源的数据访问解决方案,而且对于工具和框架是友好的。SDO并不是为了取代底层的数据访问技术(请参考后面的SDO与其它技术的关系)。SDO的目标如下:
    Unified data access to heterogeneous data sources. Current data programming technologies are more or less specific to data source types. In real-world applications, however, data frequently comes from a variety of sources, including relational databases (accessed through JDBC [2], Entity EJB [3], or other persistence frameworks), custom data access layers (implemented with well-known design patterns), Web services (accessed through JAX-RPC [4] or some other means), XML data stores, JMS [5] messages, and enterprise information systems (accessed through JCA [6] Resource
Adapters or via some custom APIs). This heterogeneity poses a significant challenge for application developers because of the broad diversity of programming models they need to learn and use. The plethora of data access APIs is an even more significant challenge for tools and frameworks that attempt to automate many common data programming tasks, such as binding UI components to back-end data sources (e.g., JSR-227 [7]). Thus, a common facility for representing collections of data regardless of data source type can provide a simpler, unified programming model for the application programmer, as well as providing new opportunities for tools and frameworks to work across heterogeneous data sources consistently.
对异构数据源的统一访问,现有的数据编程技术或多或少的针对特定数据源类型而设计。但是现实世界的应用中,数据往往都来自于多种数据源中,包括关系型数据库(用JDBC、EntityEJB或者其他持久化框架访问)、客户数据访问层(通过众所周知的设计模式实现)、Web Services(通过JAX-RPC或其他方式访问)、XML 数据存储、JMS消息和企业信息系统(通过JCA ResourceAdapters或者客户API访问)。这些异构数据源的存在使应用开发者面临很大的挑战,因为他们需要学习的编程模型非常多。过多的数据访问API也是那些希望自动化一些常见编程工作的工具和框架需要面临的巨大挑战,比如如何将UI组件绑定到后台数据资源。因此,可以忽略数据来源的普通数据的表达集可以为应用开发者提供一种简单、统一的编程模型,同时为工具和框架提供对异构数据源的一致支持提供新的机会。
Unified support for both static and dynamic data APIs. Static, strongly typed interfaces provide an easy to use programming model for application programmers. For example,Entity EJBs, JDO [8], Hibernate [9], and other object/relational persistence mechanisms provide typed Java interfaces to data that provides a convenient programming model to developers (e.g., account.getFirstName() or account.getBalance()). JDBC’s ResultSet and RowSet interfaces, in contrast, provide only dynamic, untyped data APIs (e.g., rs.getString(“FIRST_NAME”) or rs.getFloat(“BALANCE”)). Similarly, JAXB [10] provides code-generated Java interfaces to XML data, which makes XML data programming much simpler than using the DOM or SAX APIs.Neither static nor dynamic data APIs alone are sufficient, however: both are necessary. Static data APIs provide the ease-of-use application programmers needs. But in some
cases, static Java interfaces for data is neither feasible nor desirable. For example, dynamic queries where the shape of the resulting data is not known a priori, static Java interfaces for the data is not feasible. Thus, a unified data programming technology needs to support both static and dynamic data APIs seamlessly.
对静态和动态数据API的统一支持。静态、强类型接口为应用开发者提供了一种简单易用的编程模型。比如Entity EJB、JDO、Hibernate以及其他对象/关系持久化机制,他们提供了访问数据的强类型Java接口,这些接口为开发者提供了简便的编程模型(比如,account.getFirstName()或者account.getBalance())。相反,JDBC的ResultSet和RowSet接口,仅仅提供了动态的、没有类型的数据接口(比如rs.getString(“FIRST_NAME”)或者rs.getFloat(“BALCACE”))。同样的,JAXB提供了访问XML数据的Java接口,让XML数据的编程比如直接使用Dom和SAX更加简单。单独的静态或者动态API都是不够的,两者都是必须的。静态API是简单易用应用开发者们需要的数据API,但是在另外一些情况下,数据的静态Java接口既不可行也不是所想要的。比如,一些动态查询生成的结果数据的范围是不确定的,这种情况下,静态Java接口是不可行的。因此,对于一种统一的数据编程技术而言,需要同时无缝的支持静态和动态数据API。
Support for tools and frameworks. Current data programming technologies are not amenable to tools and frameworks across data source types. Tools and frameworks require several key features:
Uniform access to data across heterogeneous sources. As real-world applications use data from a variety of sources, frameworks need to rely on a uniform data representation.
Dynamic data APIs. As discussed above, it is much more appropriate for
frameworks to use dynamic data APIs, as frameworks are generic to particular
data and code-generated interfaces are often inappropriate or not feasible.
Simple introspection (or metadata) APIs. Frameworks commonly need to
introspect the “shape” of data in order to perform data rendering, updateable forms, data binding, etc.
支持工具和框架。现有的编程技术对于使用工具和框架访问异构数据源。工具和框架需要一些一些关键特性:
统一访问跨异构数据源的数据。因为现实世界中的应用使用的数据来自于不同数据源,框架需要依赖于一种统一的数据表示。
动态数据API。按照上面讨论的,对于那些框架来说,使用动态数据API是更合适的方式。因为框架中的数据都是泛型的,那些生成了代码的接口通常是不合适的,或者是不可行的。
简单的反射(或者元数据)API.框架为了完成数据修饰、可更新的表单、数据绑定等功能,通常需要反射数据的范围(“Shape”)。
Support for disconnected programming models. Many applications naturally have a disconnected usage pattern of data access: an application reads a set of data, retains it locally for a short period of time, manipulates the data, and then applies the changes back to the data source. For example, this is a very common pattern in Web-based applications: a Web client requests to view a form, a Servlet or JSP requests data in a local read transaction and renders the data in an HTML form, the Web client submits updates to a form, and the Servlet or JSP uses a new transaction to update the data. Best
practice typically dictates that optimistic concurrency semantics be used for this scenario, which provides for high levels of concurrency with the appropriate business-level semantic. There is no data access technology today that provides this disconnected, optimistic model in conjunction with the other features described above. Extensions to JDBC (through the CachedRowSet in JSR-114, “RowSet Implementations” [11]) provide the disconnected model, but as mentioned earlier, JDBC does not meet the requirements of heterogeneous data access or ease-of-use. Similarly, many Object/Relational persistence mechanisms (e.g., many Entity EJB implementations, JDO, Hibernate, etc.) support optimistic concurrency semantics, but they do not provide the necessary universal data access features.
支持离线编程模型。许多应用都天然需要一种离线数据访问模式。应用中读取一组数据,短时间内保留在本地,操作这些数据,然后将这些修改提交到数据源中。比如,在Web应用中,经常需要处理这样一种模式:Web客户段通过表单获取数据,Servlet或者JSP用一种本地读的事务获取数据并且显示在HTML表单中,Web客户段提交表单的更新,Servlet或者JPS使用一个新的事务去更新数据。最佳实践说明乐观并发语义可以应用于这种场合,它提供了支持合适的业务层次语义的并发的更高层次。今天还没有数据访问技术能提供这种离线的、乐观的模型和上面提到的其他特性。JDBC的扩展模型(JSR-114中的CachedRowSet)提供了这种离线模型,但是前面已经提到,JDBC无法满足对异构数据源访问的需求,也无法满足简单易用的需求。同样的,那些对象/关系持久化机制(比如,一些Entity EJB实现,JDO,Hibernate等)支持乐观并发语义,但是他们无法支持必须的通用数据访问特性。
Support for custom data access layers based on common design patterns. Many applications use well-known design patterns (e.g., Transfer Object [12], Transfer Object Assembler [13], Data Access Objects [14], and Domain Store [15]) to build custom data access layers. These patterns are commonly used when the application needs to be insulated from the physical data sources. Implementing data access layers commonly requires a significant amount of custom code, much of which can be automated. Further,these custom data access layers should be able to be integrated into tools and frameworks.
支持基于常见设计模式的客户数据访问层。许多应用使用众所周知的设计模式(比如Transfer Object、Transfer Object Assembler, Data Access Objects, 和 Domain Store)来构建客户化的数据访问层。这些模式在那些要求应用和物理数据源无关时经常被使用。实现这种客户数据访问层通常需要非常多的客户化代码,其中的一些代码可以被自动化生成。而且,这些客户化数据访问层必须可以被工具和框架集成。
Decouple application code from data access code. In order to be reusable and
maintainable, application code should be separable from data access. Data access technologies should be amenable to this separation of concerns.
降低应用代码和数据访问代码之间的耦合度。为了让代码可以重用和可维护,应用需要和数据访问分离。数据访问技术必须友好的支持这种分离。
 

Re: 探讨: 为什么需要SDO?    
#2楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 23 分
财富 112 goCom币
威望 21
排名 :(
段位 新手必读
 

Re: 探讨: 为什么需要SDO?    
#3楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 189 分
财富 419 goCom币
威望 24
排名 :(
段位 新手必读
 

Re: 探讨: 为什么需要SDO?    
#4楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
初级会员
 

Re: 探讨: 为什么需要SDO?    
#5楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 23 分
财富 122 goCom币
威望 21
排名 :(
段位 新手必读
SDO(Service Data Object)为我们提供了统一的数据应用开发框架,它提供了对多种企业信息系统 (EIS) 的统一的数据访问,包括数据库、遗留应用程序(使用 JCA)、XML 或者是 Web 服务数据源。SDO 为业务数据提供了一种中立的表示方法,建立了一种与数据源无关的模型,降低了耦合度.
 

Re: 探讨: 为什么需要SDO?    
#6楼
给作者发送短消息 给作者发送短消息 实名会员 
查看用户其他信息
总分 658 分
财富 293 goCom币
威望 21
排名 :(
段位 新手必读
 




发表回复
账号用户名   密码   登录
内容:url email imgsrc image code quote
范例 Example
bold italic underline linethrough   


 [更多...]