The back end of the uBike application is written in C on the Tuxedo platform. The system emulates a bicycle inventory application that provides CRUD capabilities using business logic that is contained within Tuxedo services.
Tuxedo services are specialized functions that can be looked up and invoked transparently by Tuxedo clients much the way that Web services are called by Web service clients. The difference is that Tuxedo services use proprietary interfaces, called buffers, that handle the input and output of the service calls instead of using language-independent contracts based on WSDL and XML definitions. Although Tuxedo services may have programmatic service contracts, for the most part there was nothing that inherently defined the service contract for external consumption until the introduction of the metadata repository and SALT. There was a similar repository for Jolt, but it was not generally used for non-Java clients. Now, you can define and store service contract information in the Tuxedo metadata repository, then use that data to generate WSDL artifacts to provide loosely-coupled access to your legacy Tuxedo services through the SALT SOAP gateway, which automatically converts Web service SOAP and XML payloads to and from the buffer type of the corresponding Tuxedo service.
The Tuxedo services implemented for the uBike application are described in the table below:
Service Name |
Buffer Types |
Input |
Output |
Description |
---|---|---|---|---|
SEARCHINVENTORY |
FML32, VIEW32 |
SERIALNO - string |
0-n records of:
SERIALNO - string
SKU - string NAME - string TYPE - string PRICE - float SIZE - long INSTOCK - string ORDERDATE - string COLOR - string |
Search for bicycle records based on any field |
ORDERITEM |
FML32 |
SKU - string SIZE - long COLOR - string |
STATUS - string tpurcode - 0 or -1 |
Order a new item, which inserts a new bicycle record in the inventory list. Returns the new bicycle SERIALNO in the STATUS return field |
MODIFYITEM |
FML32 |
SERIALNO - string - required Any other field (at least 1 required) |
STATUS - string tpurcode - 0 or -1 |
Modify a bicycle record with the fields that are sent in as input for the changes to be made |
SOLDITEM |
FML32 |
SERIALNO - string - all other fields ignored |
STATUS - string tpurcode - 0 or -1 |
Deletes the bicycle record from the inventory list that matches the input SERIALNO field |
The uBike inventory database is not using a real database. It is implemented as a flat file on disk, uBikeDatabase.txt, that is read in using a Tuxedo FML32 buffer API so it can be manipulated in memory. Any changes to the in memory FML32 buffer are written out to the flat file when they are made. If the uBikeDatabase.txt file does not exist when the uBikeTuxSvr.exe server starts, then it will generate a new file of 100 bicycles using random data. If the uBikeDatabase.txt file has been around for a while, the uBikeTuxSvr.exe server will update the ORDERDATE fields to ensure the application can run without stale data. To reset the database, simply delete the uBikeDatabase.txt file and start the uBikeTuxSvr.exe server again.
The inventory of bicycles contained in the uBike database comprises the following data:
The SERIALNO field is the primary ID key for the bicycle record. Its uniqueness is generated and managed by the uBike services.
All bicycles come in the following colors: YELLOW, ORANGE, RED, GREEN, BLUE, WHITE, BLACK, SILVER
TYPE 'M' bicycles are considered mountain bikes, and come in a size range of 14-21" in 1" increments.
TYPE 'R' bicycles are considered road bikes, and come in a size range of 46-60cm in 2cm increments.
Bicycles that have an ORDERDATE of >= 7 days are considered INSTOCK=Y; otherwise, INSTOCK=N.
Image | Data |
---|---|
SKU - C800 NAME - Carver 800 TYPE - R PRICE - $800 |
|
SKU - F1200 NAME - Flyer 1200 TYPE - R PRICE - $1200 |
|
SKU - I1600 NAME - Infinity 1600 TYPE - R PRICE - $1750 |
|
SKU - A2500 NAME - Americana 2500 TYPE - R PRICE - $2000 |
|
SKU - C5200 NAME - Cutter 5200 TYPE - R PRICE - $3000 |
|
SKU - LS900 NAME - Led Sled 900 TYPE - M PRICE - $6800 |
|
SKU - S1100 NAME - Steeler 1100 TYPE - M PRICE - $900 |
|
SKU - RJ4500 NAME - RockJumper 4500 TYPE - M PRICE - $1400 |
|
SKU - M4S6000 NAME - M4 Sport 6000 TYPE - M PRICE - $1800 |
|
SKU - SLP8800 NAME - StumpLeaper Pro 8800 TYPE - M PRICE - $2400 |
Now that you have seen how the uBike back-end services work, you have the context needed to continue with the tutorial.