Review Changes Made by a Different Entity
This third phase of XML data processing should complete two tasks:
- The program prints out the major information in the modified order.
- It displays all the modifications made in the processing phase.
While you can further modify the purchase order as in the previous recording changes phase, this section shows how to revoke all the modifications made using ReviewPO.java (see Listing 9). The lines below comment 2 (Shows the information in the modified purchase order) complete the first task above, and they should be straightforward to you by now. The call to printChangeSummary() under comment 3 (Display changes made in the second phase) once again prints out to the system console the changes made in ProcessPO.java.
Note that this second task is different from printing ChangeSummary in the previous section, where the printout is directly based on ChangeSummary as a Java object. Here, the change summary is reloaded into the runtime from an XML file. You can identify this difference by comparing the two printouts. In the previous one, printDataObject() generates nothing for the deleted item, while calls to printDeletedProperty() list all its properties and their values. In the current printout, the opposite is true. This discrepancy is probably a bug of the Apache Tuscany implementation (notice a second potential bug in the comments for CreatePO.java in Listing 2). I hope this provides some evidence of how difficult it is to implement a rigorous change tracking mechanism.
In the rest of the program, the block under comment 4 (Undo all changes in the second phase) calls the undoChanges() method of ChangeSummary, and the block under comment 5 (Modify the purchase order on the original version) makes a simple change to this reverted purchase order. Look at the persisted XML (po_reviewed.xml) to verify the effects of these operations.
You'll find successful SDO implementations not only in leading open source and commercial software such as Eclipse, BEA AquaLogic Data Services Platform (ALDSP), and IBM WebSphere Process Server etc., but also in various languages including Java, C++, and PHP.
In 2007, two major developments occurred in the SDO ecosystem:
- In March, Open SOA announced it would submit SDO to OASIS.
- In April, the JCP formally declared it will consider SDO for inclusion in future versions of Java EE.
Together with the recent release of the SDO Java implementation from Apache Tuscany, these ought to be driving forces for its further adoption.
This article showcased only one feature of SDO, which offers many others that are just as powerful and useful. Explore this technology and you will discover other ways it simplifies the implementation of some common requirements for data management in the service domain.
|Acknowledgement: The author would like to thank Laxma Reddy for reviewing a draft of this article and the example source code, and providing his valuable comments.|