RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Tracking XML Data Changes Easily with SDO

Service Data Object (SDO) provides developers with an easy-to-implement mechanism for tracking data history at the system level. Learn how to use a Java implementation of SDO to track changes made to XML data.

racking data changes is an essential requirement in many software, application, and business-integration scenarios. Rigorously implementing this requirement is relatively difficult because modeling and working with the delta for typical changes is generally very involved. On the other hand, repetitively implementing it in all the applicable situations is a waste as a single proper model for the delta is suitable for many situations, and in most of cases, the requirements are similar. Service Data Object (SDO), a BEA Systems and IBM-led JSR defining a generic solution for heterogeneous data access, provides developers with an easy-to-implement mechanism for tracking data history at the system level.

This article shows an example of processing XML data with SDO using version 1.0 of Apache Tuscany, a Java implementation of SDO. Since SDO is not (yet) the standard solution for XML processing, the article also covers basic XML data operations in SDO to provide context.

Three Phases of Processing XML Data
The XML data-processing example in this article assumes the following three phases with a separate party responsible for each phase:

  1. Create
  2. Process
  3. Review

The XML data are transported between these phases (and parties) through a file system. The central scenario of this example is as follows: the second party needs to record changes he/she makes to an XML file created by the first party, and when the third party reviews the XML data, he/she hopes to know of such changes. If you use the Track Changes feature of Microsoft Word, you will recognize the value of these requirements immediately.

Many applications have these requirements, including optimistic concurrency-control implementation, synchronization of offline application data with an active database, and business process management (BPM) systems. The sections to follow demonstrate how SDO helps to implement these requirements easily.

The XML data for the example (based on a sample in the SDO 2.1.0 specification) models a purchase order (see Listing 1 for the schema po_original.xsd). The next section demonstrates how to create a purchase order based on this schema and persist it into a file system with SDO. The example uses the dynamic API. SDO also provides a static API for working with all data sources.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date