IBM Books

Open Host Interface Objects for Java


Concepts

The following sections describe several essential concepts of the Open Host Interface Objects (OHIO). Understanding these concepts will aid you in making effective use of the OHIO API.

Sessions

In the context of OHIO, a session object (iOhioSession) encapsulates the connection to the host and the characteristics of that connection. A session object also serves as a container for other session-specific objects: iOhioScreen (the presentation space or virtual screen), iOhioOIA (operator information area), and iOhioFields (the list of fields available on the virtual screen).

A session object has no associated graphical user interface (GUI). In other words, creating an instance of iOhioSession does not display an emulator screen.

Container Objects

Several OHIO classes contain other objects. For example, the iOhioSession object contains an instance of the iOhioScreen, iOhioOIA, and iOhioFields objects. Containers provide methods to return a pointer to the contained object. For example, the iOhioSession object has a getOIA method, which returns a pointer to an iOhioOIA object. Contained objects are not implemented as public members of the container's class, but rather are accessed only through methods.

List Objects

Several OHIO classes provide list iteration capabilities. For example, the iOhioFields class manages the list of fields. OHIO list classes are not asynchronously updated to reflect changes in the list content. The application must explicitly call the refresh method to update the contents of a list. This allows an application to iterate a list without concern that the list might change during the iteration.

Events

OHIO provides the capability of asynchronous notification of certain events. An application can choose to be notified when specific events occur. For example, the application can be notified when the status of a connection to a host changes. Currently OHIO supports notification for the following events:

Events

Interface Used to Capture Events

Communications connect and disconnect iOhioSessionListener
Presentation space updates iOhioScreenListener
Operator Information Area (OIA) updates iOhioOIAListener

Event notification is defined by the respective OHIO listener interfaces. A separate interface exists for each event type. To be notified of an event, the application must define and create an object which implements the interface for the type of events for which notification is required. That object must then be registered by calling the appropriate OHIO registration function. Once an application object is registered, its event method is called whenever an event occurs.

Note: The application's event method is called asynchronously on a separate thread of execution. Therefore, the event method should be re-entrant, and if it accesses application resources, appropriate locking or synchronization should be used.

Error Handling

In general, OHIO indicates errors to the application by throwing iOhioException objects. To catch errors, the application should enclose calls to the OHIO methods in a try/catch block such as:

    try {
        pos = myOhioScreen.SendKeys("Hello");
    } catch (iOhioException err) {
        System.out.println("iOhioScreen Error!");
    }

When a OHIO error is caught, the application can call methods on the iOhioException object to determine the exact cause of the error. iOhioScreen methods can also be called to construct a complete language-sensitive error message.

Addressing (Rows, Columns, Positions)

Addressing in OHIO is done by using iOhioPosition objects. iOhioPosition objects contain a row coordinate and a column coordinate that identifies a position in the virtual screen. Virtual Screen addressing is always 1-based (not zero-based), thus row 1, column 1 is the first position on the screen. The row and column addressing scheme is useful for applications that relate directly to the physical screen presentation of the host data. The rectangular coordinate system (with row 1 column 1 in the upper left corner) is a natural way to address points on the screen.


[ Top of Page | Previous Page| Next Page | Table of Contents]