Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

Java and SNA: A case study

By Matt MacKinnon, Adam King, David Kaminsky
2003-05-24


Classic Transaction #5: The Database Update

Now that we've looked at the Pipe, the simplest of the classic transactions, we will look at the most complex transaction, Update, and study the differences.

In the Update transaction, a client requests information from a server, modifies the information, and returns it to the server. It demonstrates a "conversational transaction"--that is, it includes multiple sends and receives within a single conversation. Because the code follows directly from our prior discussion, we omit a detailed explanation of the transaction; the code is included in the appendix.

More interesting than the transaction itself is the use of an extended CPIC class. The update transaction requires two actions that are among the "building blocks" described in Walker and Schwaller's book. They place these actions in C functions (DOCPIC.C in the book) that are easily reused.

In JAVA we can take advantage of inheritance and can extend the CPIC class to include these new actions. We created a CPICClassic5 class that extends (Java's term for inheritance) the CPIC class and added the new actions to the CPICClassic5 class.

When a user instantiates a CPICClassic5 object (rather than a CPIC object) the user now gets all of the CPIC methods, augmented by the code developed for this transaction. The user of the CPICClassic5 object cannot distinguish between the native CPIC methods and the added function.

This example illustrates an important point: Because the CPIC tool kit is object-oriented, users can customize and extend it to fit their needs, seamlessly extending the base function. This opportunity does not exist in C.



Tutorial Pages:
» Java and SNA: A case study
» The Java/CPI-C API
» Classic Transaction #1: The Pipe
» Classic Transaction #5: The Database Update
» Native Calls
» Diversion: Native Calls and Applets
» Performance
» CPIC Calls That Have Been Implemented
» Conclusions
» Footnotes


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» All about JAXP, Part 1
» Make Database Queries Without the Database
» Load List Values for Improved Efficiency
» 2 Ways To Implement Session Tracking
» A Simple Way to Read an XML File in Java
» Develop Aspect-Oriented Java Applications with Eclipse and AJDT

Ask A Question
characters left.