The Composer
The Transactions node is a new node which is found in every MIDlet in the Composer. This Node can only accept a Transaction, found on the Transactions node of the Mobile Devices Palette.
Transactions have several properties which can be set in the property sheet for the main node, and six built-in nodes. In the property sheet for a Transaction, you can set the name of the transaction and the URL of the Servlet which the Transaction will connect to. The Browse button will bring up a dialog which lists the available servlets at the given address and port. The default setting, 127.0.0.1:8080, lists the servlets which Mobile Servers is running on the current machine. If Simplicity for Mobile Servers is not currently running, the list will be empty.
The Transaction Engine provides two different types of caching. Transaction Requests may be cached, and Responses may be cached.
If a Transaction Request is cached, then in the case where the Transaction is not able to get a response immediately, it will store the request and resend it the next time a new request is made. In addition, if the Enable polling checkbox is selected, the application will attempt to connect at a user-defined interval. If the request cache is Circular, then as the cache fills up the most recent requests will be saved and older ones will be discarded. If the cache is not circular, then after the cache is filled no new requests will be cached.
If a Transaction Response is cached, then in the case where the Transaction is not able to get a response immediately, it will check to see if there is a response to that particular query in the cache. If there is, then the old data will be retrieved from the cache with a message to this effect being displayed to the user. Response caches are always circular.
In most cases, a program will either have Request Caching or Response Caching enabled. Which one makes more sense will depend upon the needs of the individual program.
The six built-in nodes to a transaction object are
- Display options This node enables users to set the display which will be shown after a foreground (non-cached) Transaction, and also which commands will cause the transaction to execute.
- Data to send This node enables users to choose the data to send to the server. Data can be sent from the parts which are currently in the MIDlet. The variable name which will be sent to the server is on the left of the list, and the data which will be sent is on the right side.
- setupExecution This node enables users to enter Java code which will be used to send additional variables to the server, or to set any other properties of the Transaction.
- beforeExecution This node enables users to enter Java code which can do checks on the data to be sent (via the url) before a Transaction is executed. If the user wishes to prevent the Transaction from executing, a TransactionException may be thrown.
- Response mappings This node helps users display the data which is returned from the servlet in the Midlet. The data from the Servlet is displayed in the tree on the right, while the different parts of the Midlet are displayed on the left. Each part has different possibilities; all Displays may have their Titles and Tickers set, but TextBoxes may also have their text replaced with the data from the servlet, or the data may be appended or prepended to the existing text. Any combination is also possible.
- afterExecution This node enables users to enter Java code which will run after a transaction has occurred. The queued and resultsFromCache variables should be used to vary the program's response, depending upon whether the search was the result of a background, queued query, and whether the results were from the cache or from the servlet. The exportList of results from the query can be used to perform custom mappings which were not available in the Response mappings page.
| Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |