|
The JCC provides a secure, robust, and reliable platform that enables software vendors of any size to write electronic commerce applications. With a framework, you focus on the application-specific business logic and let the framework handle the low-level programming details. Application-specific code is organized into modules called cassettes. A cassette represents one part (or module) of a transaction. Cassettes are mixed and matched to lay the foundation for an electronic transaction. A cassette designed by one vendor can interact with one or more cassettes by that same vendor or by agreement with a cassette from another vendor. The JCC framework orchestrates cassette interoperations and enforces the high level of security required for reliable transactions between clients and merchant servers. The framework and cassette innovation supports a full range of large and small money-based applications such as personal finance software, tax calculation programs, and retail sales applications--all of which can run on any Java-enabled platform with the JCC framework installed. This article is the first in a three-part series on writing cassettes. It introduces the JCC framework, summarizes the four steps to writing a cassette, and provides instructions for the first step. Step 2 is covered in Part Two of this series, and Steps 3 and 4 are covered in Part Three. Java Commerce Client Framework The JCC framework consists of commerce-related classes, interfaces, and cassettes for you to implement your own application-specific electronic commerce code, and an environment within which the application code runs. Clients with an installed and configured JCC framework can initiate transactions on a commerce server that execute on the client machine. Cassettes The JCC framework enables the cassette interoperations that form a transaction. A cassette is a signed Java ARchive (JAR) file containing the compiled classes that implement one part of an electronic commerce transaction on the client side. One transaction typically involves serveral interoperating cassettes. Cassette functionality is defined primarily by the code in a commerce Bean. There are several types of commerce Beans, but this series focuses on the following three types that provide the basic functionality for a purchase transaction:
An electronic purchase transaction requires a purchase operation cassette, one or more protocol cassettes, and one or more instrument cassettes. Note that a commerce Bean is similar to but not exactly like a standard JavaBean. Commerce Beans are not currently written to the same specifications as JavaBeans, and support additional security and other functions required by the JCC framework. To create the cassettes for a transaction, you can write your own cassette(s), and use or modify any of the following types of cassettes that come with the JCC framework:
The JCC framework uses roles, tickets, gates, and permits to ensure that only authorized cassettes have limited access to information and resources in other cassettes and the JCC framework. This model is called the Gateway Security model because access to sensitive data within a cassette is permitted through specific controlled gateways only. Roles define what a cassette can do. A cassette is signed for a role or set of roles. For example, every cassette is signed for the Cassette role because this role is required to install the cassette. If a cassette is not installed, the cassette cannot work with the JCC framework. Operation cassettes are signed with the Operation role, protocol cassettes are signed with the Protocol role, and instrument cassettes are signed with the Instrument role so they can register themselves in the JCC framework cassette registry. A ticket is a use-once token of the capabilities authorized by a given role. An operation cassette depends on one or more specific protocol cassettes. Protocol cassettes implement the functionality to carry out online commerce protocols. Gates are authentication methods. All communication with a cassette takes place through its gate. For example, the protocol cassette gives the ticket it received from the operation cassette to the JCC Role Manager, which checks that the ticket has not been altered since it was first loaded. If the security check passes, the cassette is given a permit. Permits are objects returned by the gate. For example, if the ticket has not been altered, the JCC framework stamps the ticket and passes it back to the protocol cassette's gate. To summarize, a cassette is signed with a role, which gets it a ticket, which gives the cassette a permit to do something. The JCC framework manages the interoperations between the operation, protocol, and instrument cassettes with tickets, gates, and permits. Four Steps to Writing a Cassette The short example for this series describes how to create the operation, protocol, and instrument cassettes for a simple purchase transaction. A purchase transaction might be initiated when a web store shopper chooses an item and selects the Pay button on a merchant server. The Java Commerce Message (JCM) contains information on valid instruments for that shopper. The JCC framework finds the intersection of valid instruments for the shopper and instruments recognized by the merchant server and displays those instruments on the merchant server so the shopper can choose the mode of payment. The JCC framework sends the JCM, which contains other information about the transaction, to the client machine where the correct cassettes are loaded (or installed and loaded) to execute the transaction. The four steps to writing a cassette are as follows:
Step 1: Implement a CassetteControl Class
Every cassette must have exactly one
The code below implements a
The
Create the Java Commerce Message for the Purchase Operation Every operation requires an associated Java Commerce Message (JCM). A JCM is an electronic message sent from the web server to the client JCC framework. There are many ways to structure a JCM transaction. One scenario for a purchase transaction initiated in an applet could be as follows:
A shopper makes a selection that triggers
the electronic purchase operation. The web server applet then
queries the shopper for payment and other relevant information,
plugs that information into a JCM template, and
sends the JCM to the JCC framework installed on the initiating
client's system. The JCM contains a body of
When the JCC framework finds the Here is the JCM for the Purchase operation. The purchase operation cassette uses MasterCard and VISA as instruments, and the Secure Electronic Transfer (SET) and Secure Socket Layer (SSL) protocols. The JCM for the purchase operation also includes product and price information.
Create the Java Commerce Message for the Install Operation Here is the JCM for the install operation. If the correct purchase cassette is not found on the local system, the correct purchase cassette is downloaded from the web server and automatically installed. The purchase and installation operations are separate operations each requiring their own JCM. The install JCM is usually a flat file because it does not normally contain any dynamic information.
The
The Conclusion
The Related Links The JCC framework includes APIs for working with smart cards. JavaWorld is running a series that explains how to use them: Java Card 2.0 is a framework and set of application programming interfaces (APIs) for designing and writing applets that implement smart card logic. Monica Pawlan, a staff writer for the Java Developer Connection (JDC), is author of Essentials of the Java Programming Language: A Hands-On Guide (Addison-Wesley, 2000), and co-author of Advanced Programming for the Java 2 Platform (Addison-Wesley, 2000). Lisa Stapleton, a former programmer, has been senior editor for InfoWorld, UnixWorld, and Open Computing. She has served as editorial director for NetscapeWorld, the JDC, and is currently consulting editor for Sunnyvale-based TechWeek. | |||||||||||
|
| ||||||||||||