BEA Logo BEA Jolt Release 1.2

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   Jolt Doc Home   |   Jolt Developer's Guide   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Using JoltBeans

 

Formerly available as an add on, JoltBeans are included in BEA Jolt. Using JoltBeans, you can create Jolt client applications with the ease of using JavaBeans. JoltBeans are JavaBeans components that are used in Java development environments to construct Jolt clients. You can use popular Java-enabled development tools such as Symantec Visual Café to graphically construct client applications. JoltBeans provide a JavaBeans-compliant interface to BEA Jolt. You can develop a fully functional BEA Jolt client without writing any code.

"Using Jolt Beans" covers the following topics:

Overview of Jolt Beans

JoltBeans consists of two sets of Java Beans. The first set, the JoltBeans toolkit, is a beans version of the Jolt API. The second set consists of GUI beans, which include Jolt-aware AWT beans and Jolt-aware Swing beans. These GUI components are a "Jolt-enabled" version of some of the standard Java AWT and Swing components, and help you build a Jolt client GUI with minimal or no coding.

You can drag and drop JoltBeans from the component palette of a development tool and position them on the Java form (or forms) of the Jolt client application you're creating. You can populate the properties of the beans and graphically establish event source-listener relationships between various beans of the application or applet. Typically, the development tool is used to generate the event hook-up code, or you can code the hook-up manually. Client development using JoltBeans is integrated with the BEA Jolt repository, providing easy access to available BEA Tuxedo services.

Note: Currently, Symantec Visual Café 3.0 is the only IDE that has been certified by BEA for use with JoltBeans. However, JoltBeans are also compatible with other Java development environments such as Visual Age.

The first topics in this section provide a general, conceptual overview of how JoltBeans work, as well as a description of each Jolt bean and how it interacts with Tuxedo events. The JoltBeans walkthrough demonstrates the specific steps required to create a Jolt client that interacts with Tuxedo services.

To use the JoltBeans toolkit, it is recommended that you be familiar with JavaBeans-enabled, integrated development environments (IDEs). The walkthrough in this chapter is based on Symantec's Visual Café 3.0 IDE and illustrates the basic steps of building a sample applet.

JoltBeans Terms

Refer to the following terms as you work with JoltBeans:

JavaBeans

Reusable software components that are graphically displayed in a development environment.

JoltBeans

Two sets of Java Beans: JoltBeans toolkit and Jolt aware GUI beans.

Custom GUI element

A Java GUI class that communicates with JoltBeans. The means of communication can be JavaBeans events, methods, or properties offered by JoltBeans.

Jolt-Aware Bean

A bean that is source of JoltInputEvents, listener of JoltOutputEvents, or both. Jolt-aware beans are a subset of Custom GUI elements that follow beans guidelines.

Jolt-Aware GUI Beans

Two packages of GUI components (AWT and Swing), both containing the JoltList, JoltCheckBox, JoltTextField, JoltLabel, and JoltChoice components.

JoltBeans Toolkit

A JavaBeans-compliant interface to BEA Jolt, which includes the JoltServiceBean, JoltSessionBean, and JoltUserEventBean.

Wiring

The process of connecting beans together so that one bean is registered as a listener of events from another bean.

Adding JoltBeans to Your Java Development Environment

Before you can use JoltBeans, you must set up your development environment to include JoltBeans. To set up your Java development environment, you must:

The method of setting the CLASSPATH can vary, depending on the development environment you're using.

JoltBeans includes a set of .jar files containing all of the JoltBeans. You can add these .jar files to your preferred Java development environment so that JoltBeans are available in the component library of your Java tool. For example, using Symantec Visual Café, you can set the CLASSPATH so that the .jar files are visible in the Component Library window of Visual Café. You only need to set the CLASSPATH of these .jar files in your development environment once. After you have placed these .jar files in the CLASSPATH of your development environment, you can then add JoltBeans to the Component Library. Then you can simply drag and drop any JoltBean directly onto the Java form on which you are developing your Jolt client application.

To set the CLASSPATH in your Java development environment, follow the instructions in the product documentation for your development environment. Navigate from the IDE of your development tool to the directory where the jolt.jar file resides. The jolt.jar file is typically found in the directory called %TUXDIR%\udatadoj\jolt . The jolt.jar file contains the main Jolt classes. Set the CLASSPATH to include these classes. The JoltBean .jar files do not need to be added to the CLASSPATH . To use them, you only need to add them as components in your IDE.

After you have set the CLASSPATH to include the Jolt classes, you can add JoltBeans to the Component Library of your development environment. See the documentation for your particular development environment for instructions on populating the Component Library.

When you are ready to add JoltBeans to the Component Library of your development environment, add only the development version of JoltBeans, as explained in the next section, "Using Development and Runtime JoltBeans."

Using Development and Runtime JoltBeans

The .jar files containing JoltBeans contain two versions of each JoltBean, a development version and a runtime version. The development version of each JoltBean name ends with the suffix Dev . The runtime version of each class name ends with the suffix Rt . For example, the development version of the class, JoltBean, is JoltBeanDev , while the runtime version of the same class is JoltBeanRt .

Use the development version of JoltBeans during the development process. The development JoltBeans have additional properties that enhance development in a graphic IDE. For example, the development Beans have graphic properties ("bean information") that allow you to work with them as graphic icons in your development environment.

The runtime version of JoltBeans does not have these additional properties. You do not need the additional development properties of the beans at runtime. The runtime beans are simply a pared down version of the development JoltBeans.

When you compile your application in your development environment, it is compiled using the development beans. However, if you want to run it from a command line outside of your development environment, it is recommended that you set the CLASSPATH so that the runtime beans are used when compiling your application.

Basic Steps For Using JoltBeans

After you have added the development version of JoltBeans to the Component Library of your Java development environment, the basic steps in using JoltBeans during development are as follows:

  1. Drag the beans from the JoltBeans component palette of your development environment to the Java form-designer for a Jolt client application or applet.

  2. Populate the properties of the beans and set up the event-source listener relationships between the beans of the application or applet ( "wire" the beans together). The development tool generates the event hook-up code.

  3. Finally, add the application logic to the event callbacks.

These steps are explained in more detail in the following sections. The JoltBeans walkthrough demonstrates each of these steps with an example.

JavaBeans Events and Tuxedo Events

JavaBeans communicate through events. An event in a BEA Tuxedo system is different from an event in a JavaBeans environment. In a Tuxedo application, an event is raised from one part of an application to another part of the same application. JoltBeans events are communicated between beans.

Using Tuxedo Event Subscription and Notification with JoltBeans

Tuxedo supports brokered and unsolicited event notification. Jolt provides a mechanism for Jolt clients to receive Tuxedo events. JoltBeans also include this capability.

Note: Tuxedo event subscription and notification is different from JavaBeans events.

The following example shows how the Tuxedo asynchronous notification mechanism is used in JoltBeans applications.

  1. Use the setEventName() and setFilter() methods of the JoltUserEventBean to specify the Tuxedo event to which you want to subscribe.

  2. The component that receives the event notifications registers itself as a JoltOutputListener to the JoltSessionBean.

  3. The subscribe() method is called on JoltUserEventBean.

  4. When the actual Tuxedo event notification arrives, JoltSessionBean sends a JoltOutputEvent to its listeners by calling serviceReturned() on them. The JoltOutputEvent object contains the data of the Tuxedo event.

When the client is no longer interested in the event, it calls unsubscribe() on the JoltUserEventBean.

Note: If the client wants only to subscribe to unsolicited events, use setEventName ("\\.UNSOLMSG") , which can be set using the property sheet. EventName and Filter are properties of the JoltUserEventBean.)

How JoltBeans Use JavaBeans Events

A Jolt client applet or application that has been built using JoltBeans typically consists of Jolt-aware GUI Beans, such as JoltTextField or JoltList, and JoltBeans, such as JoltServiceBean and JoltSessionBean. The main mode of communication between Beans is by JavaBeans events.

Jolt-aware beans are sources of JoltInputEvents or listeners of JoltOutputEvents or both. JoltServiceBeans are sources of JoltOutputEvents and listeners of JoltInputEvents.

The Jolt-aware GUI Beans expose properties and methods so you can link the beans directly to the parameters of a Tuxedo service (represented by a JoltServiceBean). Jolt-aware beans notify the JoltServiceBean via a JoltInputEvent when their content changes. The JoltServiceBean sends a JoltOutputEvent to all registered Jolt-aware beans when the reply data is available after the service call. The Jolt-aware GUI Beans contain logic that updates their contents with the corresponding output parameter of the service.

The following figure shows a graphical representation of the possible relationships among the JoltBeans.

Figure 5-1 Possible Interrelationships Among the JoltBeans

The JoltBeans Toolkit

The JoltBeans Toolkit includes the following beans:

These components transform the complete Jolt Class Library into beans components, with all of the features of any typical JavaBean, including easy reuse and graphic development ease.

Refer to the online API Reference in Javadoc in this help system for specific descriptions of the JoltBeans classes, constructors, and methods.

The following sections provide information about the properties of each bean.

JoltSessionBean

The JoltSessionBean, which represents the Tuxedo session, encapsulates the functionality of the JoltSession, JoltSessionAttributes, and JoltTransaction classes. The JoltSessionBean offers properties to set session and security attributes, such as sending a timeout or a Tuxedo user name, as well as methods to open and close a Tuxedo session.

The JoltSessionBean sends a PropertyChange event when the Tuxedo session is established or closed. PropertyChange is a standard bean event defined in the java.beans package. The purpose of this event is to signal other beans about a change of the value of a property in the source bean. In this case, the source is the JoltSessionBean, the targets are JoltServiceBeans or JoltUserEventBeans, and the property changing is the LoggedOn property of the JoltSessionBean. When a logon is successful and a session is established, LoggedOn is set to true . After the logoff is successful and the session is closed, the LoggedOn property is set to false .

The JoltSessionBean provides methods to control transactions, including beginTransaction() , commitTransaction() , and rollbackTransaction() .

The following table shows the JoltSessionBean properties and descriptions.

Table 5-1 JoltSessionBean Properties and Descriptions

Property

Description

AppAddress

Set the IP address (host name) and port number of the JSL or the Jolt Relay. The format is //host:port number (e.g., myhost:7000 ).

AppPassword

Set the Tuxedo application password used at logon, if required.

IdleTimeOut

Set the IDLETIMEOUT value.

inTransaction

Indicate true or false depending if a transaction has been started and not committed or aborted.

LoggedOn

Indicate true or false if a Tuxedo session does or does not exist.

ReceiveTimeOut

Set the RECVTIMEOUT value.

SendTimeOut

Set the SENDTIMEOUT value.

SessionTimeOut

Set the SESSIONTIMEOUT value.

UserName

Indicate the Tuxedo user name, if required.

UserPassword

Indicate the Tuxedo user password, if required.

UserRole

Indicate the Tuxedo user role, if required.

JoltServiceBean

The JoltServiceBean represents a remote Tuxedo service. The name of the service is set as a property of the JoltServiceBean. The JoltServiceBean listens to JoltInputEvents from other beans to populate its input buffer. JoltServiceBean offers the callService() method to invoke the service. JoltServiceBean is an event source for JoltOutputEvents that carry information about the output of the service. After a successful callService() , listener beans are notified via a JoltOutputEvent that carries the reply message.

Although the primary way of changing and querying the underlying message buffer of the JoltServiceBean is via events, the JoltServiceBean also provides methods to access the underlying message buffer directly (setInputValue() , getOutputValue() ).

The following table shows the JoltServiceBean properties and descriptions.

Table 5-2 JoltServiceBean Properties and Descriptions

Property

Description

ServiceName

The name of the Tuxedo service represented by this JoltServiceBean.

Session

The JoltSessionBean associated with the bean that allows access to the Tuxedo client session.

Transactional

Set to true if this JoltServiceBean is to be included in the transaction that was started by its JoltSessionBean.

JoltUserEventBean

The JoltUserEventBean provides access to Tuxedo events. The Tuxedo event to subscribe to or unsubscribe from is defined by setting the appropriate properties of this bean (event name and event filter). The actual event notification is delivered in the form of a JoltOutputEvent from the JoltSessionBean.

The following table shows the JoltUserEventBean properties and descriptions.

Table 5-3 JoltUserEventBean Properties and Descriptions

Property

Description

EventName

Set the name of the user event represented by the bean.

Filter

Set the event filter

Session

The JoltSessionBean associated with the bean that allows access to the Tuxedo client session.

Jolt Aware GUI Beans

The Jolt-aware GUI Beans consist of Java AWTbeans and Swing beans, and are inherited from the Java Abstract Windowing Toolkit. They include:

JoltTextField

This is a Jolt-aware extension of java.awt.TextField and Swing JTextfield. JoltTextField contains parts of the input for a service. A JoltServiceBean may listen to events raised by a JoltTextField. JoltTextField sends JoltInputEvents to its listeners (typically JoltServiceBeans) when its contents changes.

JoltTextField displays output from a service. In this case, JoltTextField listens to JoltOutputEvents from JoltServiceBeans and updates its contents according to the occurrence of the field to which it is linked.

JoltLabel

This is a Jolt-aware extension of java.awt.Label and Swing JLabel that is linked to a specific field in the Jolt output buffer by its JoltFieldName property. If the field occurs multiple times, the occurrence this textfield is linked to is specified by the occurrenceIndex property of this bean. JoltLabel can be connected with JoltServiceBeans to display output from a service. A JoltLabel listens to JoltOutputEvents from JoltServiceBeans and updates its contents according to the occurrence of the field to which it is linked.

JoltList

This is a Jolt-aware extension of java.awt.List and Swing Jlist that is linked to a specific Jolt field in the Jolt input or output buffer by its JoltFieldName property. If the field occurs multiple times in the Jolt input buffer, the occurrence this list is linked to is specified by the occurrenceIndex property of this bean. JoltList can be connected with JoltServiceBeans in two ways:

JoltCheckbox

JoltCheckbox is a Jolt-aware extension of java.awt.Checkbox and Swing JCheckBox that is linked to a specific field in the Jolt input buffer by its JoltFieldName property. If the field occurs multiple times, the occurrence this checkbox is linked to is specified by the occurrenceIndex property of this bean.

JoltCheckbox can be connected with JoltServiceBeans to contain parts of the input for a service. A JoltServiceBean listens to events raised by a JoltCheckbox. JoltCheckbox sends JoltInputEvents to its listeners (typically JoltServiceBeans) when the selection in the checkbox changes. The JoltInputEvent in this case is populated with the TrueValue property of data type String (if the box is selected) or FalseValue (if the box is unselected).

JoltChoice

JoltChoice provides a Jolt-aware extension of java.awt.Choice and Swing JChoice that is linked to a specific field in the Jolt input buffer by its JoltFieldName property. If the field occurs multiple times, the occurrence this choice is linked to is specified by the occurrenceIndex property of this bean.

JoltChoice can be connected to JoltServiceBeans to contain parts of the input for a service. A JoltServiceBean may listen to events raised by a JoltChoice. JoltChoice sends JoltInputEvents to its listeners (typically JoltServiceBeans) when the selection in the choicebox changes. The JoltInputEvent in this case is populated with the single value of the selected item.

Note: For a detailed description of these classes, see the online Javadoc class reference library included with Jolt.

Using the Property List and the Property Editor to Modify the JoltBeans Properties

The values of most JoltBeans properties can be modified by simply editing the right column of the Property List, as shown in the following figure.

Custom Property Editors are provided, for some properties of JoltBeans.

The Custom Property Editors, accessed from the Property List, include dialog boxes that are used to modify the property values. You can invoke the Custom Property Editors from the Property List by selecting the button with the ellipsis ( "...") that is next to the value of the corresponding property value.

Figure 5-2 Example of the Property List and Ellipsis Button

When the ellipsis button is selected, the Property Editor shown in the following figure displays.

Figure 5-3 Custom Property Editor Dialog Box

.

The Custom Property Editor of JoltBeans reads cached information. Initially, there is no cached information available, so when the Property Editor is used for the first time, the dialog box is empty. Log on to the Jolt repository and load the property editor cache from the repository.

Details of the logon and an example of using the Property List and Property Editor are shown in the Using the Jolt Repository and Setting the Property Values section of the JoltBeans Class Library Walkthrough.

JoltBeans Class Library Walkthrough

This walkthrough describes how to build an applet that is used to:

This is an example of a completed Java form containing JoltBeans. The applet implements the client functionality for the INQUIRY service of the BANKAPP sample that is included with Tuxedo. To run this sample, the Tuxedo server must be running.

Figure 5-4 Sample Inquiry Applet

Refer to Figure 5-6 for an example of each item. To begin, select the following beans, shown in the following table.

Table 5-4 Required Form Components

Component

Purpose

Applet (or JApplet, if JFC applet is chosen)

A form used to paint the beans in your development environment.

JoltSessionBean

Logs on to a Tuxedo session.

JoltTextField

Gets input from the user (in this case, ACCOUNT_ID).

JoltTextField

Displays the result (in this case, SBALANCE).

JoltServiceBean

Accesses a Tuxedo service. (In this case, INQUIRY from BANKAPP).

Button

Initiates an action.

Label

Describes the field on the applet.

Building the Sample Form

The following example is created using the Visual Café 3.0 development environment. The example demonstrates how to build an applet that allows you to enter an account ID and use a Tuxedo service to get and show the account balance. The basic steps to create this example are as follows:

  1. Choose File | New Project and select either JFC Applet or AWT application. This step provides you with the basic form designer on which you drop the JoltBeans.

  2. Drag and drop all of the JoltBeans you want to use in your applet from the Component Library onto the form designer.

  3. Modify or customize each bean using the property list or the custom property editor.

  4. Wire the beans together using the Interaction Wizard.

  5. Compile the applet.

These steps are described in detail in the following sections.

Note: The graphic interface of previous versions of Visual Café will differ from the look of Visual Café 3.0. You can complete this sample applet in a previous version Visual Café, however, the steps executed in the Interaction Wizard differ slightly from this example.

Placing JoltBeans onto the Form Designer

  1. First, choose File | New Project, and choose JFC Applet.

  2. Drag and drop the beans from the Component Library (shown in the following figure) onto the form designer.

    The following figure shows how a JoltBean is selected and dragged and dropped onto the palette of Form Designer.

    The next figure shows how JoltBeans appear when they are placed on the palette of the Form Designer.

    Figure 5-5 JoltBeans and the Form Designer in Visual Café

    Figure 5-6 Visual Café 3.0 Form Designer

  3. Next, set the properties of each bean. To modify or customize the buttons, labels or fields, use the property list. Some JoltBeans use a Custom Property Editor.

    The example in the next figure shows how selecting the JoltFieldName of the button property list displays the Custom Property Editor.

  4. Set the properties of the beans (for example, set the JoltFieldName property of the JoltTextField to ACCOUNT_ID).

    Note: For complete information on setting and modifying the properties of the JoltBeans, refer to Using the Jolt Repository and Setting the Property Valuessection in this chapter.

    The following table specifies the property values that should be set. Values specified in bold and italic text are required, and those in plain text are recommended.

    Table 5-5 Required and Recommended Property Values

    Bean

    Property

    Value

    label1

    Text

    Account ID

    label2

    Text

    Balance

    JoltTextField1

    Name

    accountId

    JoltTextField1

    JoltFieldName

    ACCOUNT_ID

    JoltTextField2

    Name

    balance

    JoltTextField2

    JoltFieldName

    SBALANCE

    JoltSessionBean1

    AppAddress

    //tuxserv:2010

    JoltServiceBean1

    Name

    inquiry

    JoltServiceBean1

    ServiceName

    INQUIRY

    button1

    Label

    Inquiry

    Note: In this walkthrough, the default occurrenceIndex of 0 works for both JoltTextFields.

    Refer to the next table and the section, Using the Jolt Repository and Setting the Property Values for general guidelines on JoltBean properties.

    Figure 5-7 Example of JoltTextField Property List and Custom Property Editor

  5. To change the value of the JoltFieldName property, click on the ellipsis button of the JoltFieldName in the Property List. The Custom Property Editor displays. Select or type the new field name (in this example, "ACCOUNT_ID"). Select OK.

    Note: The properties that are visible in the Custom Property Editor are cached locally, therefore, if the source database is modified you must use the Refresh button to see the current, available properties.

    Figure 5-8 Revised JoltFieldName in the JoltTextField Property List

    The change is reflected in the Property List shown in the previous figure and on the text field shown in the next figure.

    Figure 5-9 Example of JoltBeans on the Form Designer with Property Changes

    The previous figure shows how the text on the button and the textfields changes after the text is added to the property list fields for these beans.

  6. After you set the properties to the right values (refer to the "Required and Recommended Properties" table for additional information on the required and recommended property values), define how the beans will interact by wiring them together using the Visual Café Interaction Wizard.

Wiring the JoltBeans Together

After all the beans are positioned on your form and the properties are set, wire the beans and their events together. Figure 5-10 gives an example of the flow to help you determine the order when you are ready to wire the beans.

Wiring the beans allows you to establish event source-listener relationships between various beans on the form. For example, the JoltServiceBean is a listener of ActionEvents from the button and invokes callService() when the event is received. Use the Visual Café Interaction Wizard to wire the beans together.

The following figure shows the sequence in which you will wire the beans together to create this sample applet. The numbers in this figure correspond to the numbers of the steps that follow.

Figure 5-10 How JoltBeans are Connected on the Form

Step 1: Wire the JoltSessionBean logon

  1. Click the Interaction Wizard button. Click in the applet window and drag a line to the JoltSessionBean.

    The Visual Cafe Interaction Wizard window displays.

    Figure 5-11 Wire the Applet to the Jolt Session Bean

  2. Select ComponentShown (as shown below) as the event you want to start the interaction. Click Next.

    The Visual Café Interaction Wizard displays.

    Figure 5-12 Visual Cafe Interaction Wizard

  3. With the "Perform an action" radio button enabled, select "Logon to the Tuxedo system." Click Finish.

    Figure 5-13 Select "Logon to the Tuxedo System

    Completing these three steps enables the logon() method of the JoltSessionBean to be triggered by an applet (for example, ComponentShown) that is sent when the applet is opened for the first time.

Step 2: Wire JoltSessionBean to JoltServiceBean using propertyChange

  1. Click the Interaction Wizard button. Click on the JoltSessionBean and drag a line to the JoltServiceBean (as shown in the following figure).

    Figure 5-14 Wire the JoltSessionBean to the JoltServiceBean

    The Interaction Wizard displays and asks, "What event in joltSessionBean1 do you want to start the interaction?" (as shown in the following figure).

    Figure 5-15 Select propertyChange as the Event

  2. Select propertyChange as the event that starts the interaction. Click Next.

    The Interaction Wizard window displays and asks, "What do you want to happen when joltSessionBean1 fires propertyChange event?" and provides a list of object and actions (as shown in the following figure).

    Figure 5-16 Select "Handle a Jolt property change event"

    S

  3. Select "Handle a Jolt property change event" as the method. Click Next.

    The Interaction Wizard window displays and asks, "How do you want to supply the parameter to this method?" and provides a list of available objects and actions to choose from (as shown in the following figure).

    Figure 5-17 Select joltSesssionBean1

  4. Select joltSessionBean1 as the object that supplies the action.

  5. Select "Get the current Property Change Event object" as the action. Click Finish.

    Completing these three steps enables the JoltSessionBean to send a propertyChange event when logon() completes. The JoltServiceBean listens to this event and associates its service with this session.

Step 3: Wire the accountID JoltTextField as input to the JoltServiceBean using JoltInputEvent

  1. Click the Interaction Wizard button. Select the accountID JoltTextField bean and drag a line to the JoltServiceBean.

    The Interaction Wizard displays.

    Figure 5-18 Select dataChanged as the Event to Start the Interaction

  2. Select dataChanged as the event. Click Next.

  3. With the joltServicebean "inquiry" selected as the object supplying the parameter, select "Handle a jolt input event" as the action. Click Next.

    Figure 5-19 Choose "inquiry" and "Handle a Jolt Input Event"

    The Interaction Wizard window displays, asking "How do you want to supply the parameter to this method?" and providing a list of available objects and actions to choose from (as shown in the following figure).

    Figure 5-20 Select "accountId" and Get the current Jolt Input Event

  4. With "accountId" selected as the object, select "get the current Jolt Input Event" as the action. Click Finish.

    Completing these four steps enables you to type the account number in the first text field. The JoltFieldName property of this JoltTextField is set to "ACCOUNT_ID". Whenever the text inside this text box changes, it sends a JoltInputEvent to the JoltServiceBean. (The JoltServiceBean listens to JoltInputEvents from this textbox.) The JoltInputEvent object contains the name, value, and occurrence index of the field.

Step 4: Wire Button to JoltServiceBean using JoltAction

  1. Click the Interaction Wizard button. Select the Inquiry Button and drag a line to the JoltServiceBean.

    The Interaction Wizard window displays.

    Figure 5-21 Select "action Performed" as the event

  2. Select "action Performed" as the event. Click Next.

    Figure 5-22 Select "inquiry" and "Invoke Tuxedo Service..."

  3. Select "Invoke Tuxedo Service represented by this bean" as the action. Click Finish.

    Completing these two steps enables the callService() method of the JoltServiceBean to be triggered by an ActionEvent from the Inquiry button.

Step 5: Wire JoltServiceBean to the balance JoltTextField using JoltOutputEvent

  1. Click the Interaction Wizard button. Select the JoltServiceBean and drag a line to the AmountJoltTextField bean. The Interaction Wizard displays (as shown in the following figure).

    Figure 5-23 Select "serviceReturned" as the event

  2. Select serviceReturned as the event. Click Next.

    Figure 5-24 Select "balance" and "Set the JoltTextField's text"

  3. Select "balance" as the available object, and "Handle a service returned event..." as the action. Click Next.

    Figure 5-25 Select "inquiry" and "Get the value of field..."

  4. Select "inquiry" as the object, and "Get the JoltOutputEvent object" as the action. Click Finish.

    Completing these three steps allows the JoltServiceBean to send a JoltOutputEvent when it receives reply data from the remote service. The JoltOutputEvent object contains methods to access fields in the output buffer. The JoltTextField displays the result of the INQUIRY service.

Step 6: Wire the JoltSessionBean logoff

  1. Click the Interaction Wizard button. Click in the applet window (not on another bean) and drag a line to the JoltSessionBean. The Interaction Wizard displays (as shown in the following figure).

    Figure 5-26 Select "Interaction Wizard"

  2. Select componentHidden as the event. Click Next.

    Figure 5-27 Select "joltSessionBean1" and "Logoff from the Tuxedo system"

  3. With "joltSessionBean1" selected as the object, select "Logoff from the Tuxedo system" as the action (as shown in the previous figure). Click Finish.

    Completing these two steps enables the logoff() method of the JoltSessionBean to be triggered by an applet (for example, componentHidden) that is sent when the applet gets hidden.

Step 7: Compile the applet

After wiring the JoltBeans together, compile the applet. It is also recommeded that you fill in the empty catch blocks for exceptions. Check the message window for any compilation errors and exceptions.

Refer to the following table and the following figure for additional information.

Running the Sample Application

To run the sample application, you must have the Tuxedo server running. Then enter an account number in the Account ID textfield. You may use any of the account numbers included in the BANKAPP database. Following are two examples of account numbers you can use to test the sample application:

Using the Jolt Repository and Setting the Property Values

Custom Property Editors are provided for the following properties:

The Property Editor, accessed from the Property List, includes dialog boxes that are used to add or modify the properties. You can invoke the boxes from the Property List by selecting the button with the ellipsis (...) that is next to the value of the corresponding property value.

Some JoltBeans require input to the Property List field. The beans are listed in the following table.

Table 5-6 JoltBean Specific Properties

JoltBean

Property

Input Description

JoltSessionBean

appAddress

userName, Password or AppPassword

e.g., //host:port

Type your Tuxedo user name and passwords.

JoltServiceBean

serviceName

isTransactional

INQUIRY, for example.

Set to true if the service needs to be executed within a transaction. Set isTransactional to false if the service does not require a transaction.

JoltUserEventBean

eventName

filter

Refer to the Tuxedo tpsubscribe calls.

All Jolt-aware GUI beans

joltFieldName

occurrenceIndex

ACCOUNT_ID, for example

Multiple fields of the same name. Index starts at 0.

JoltCheckbox

TrueValue and FalseValue

The field value corresponding to the state of the checkbox.

The property editor reads cached information from the repository and returns names of the available services and data elements in a list box. An example of the ServiceName property editor is shown in the following figure:

Figure 5-28 JoltServiceBean Property Editor

  1. Select the service name by clicking on the ellipsis in the ServiceName field shown in the previous figure.

    The Custom Property Editor for ServiceName shown in the following figure displays.

    Figure 5-29 Custom Property Editor for serviceName

    Note: If you cannot or do not want to connect to the Repository database, simply type the service name in the text box and proceed to Step 7.

  2. If you are not logged on, make sure the Jolt Server is running and select Logon. The JoltBeans Repository Logon shown in the following figure displays.

    Figure 5-30 JoltBeans Repository Log On

  3. Type the Tuxedo or Jolt Relay Machine name for Server and the JSL or Jolt Relay Port Number. Type password and user name information (if required) and click Logon.

  4. The Custom Property Editor loads its cache from the repository.

  5. Select the appropriate service name in the list box shown in Figure 5-31. Enter the property value (service or field name) directly. A text box is provided. Click OK on the property editor dialog (shown in the following figure). The bean property is set with the contents of the textbox.

  6. Click OK on the Custom Property Editor dialog (shown in the following figure).

    Figure 5-31 Property Editor with Selected Service

JoltBeans Programming Tasks

Additional programming tasks include:

Using Transactions with JoltBeans

Your Tuxedo application services may have functionality that updates your database. If so, you can use transactions with JoltBeans (for example, in the sample, BANKAPP, the services TRANSFER and WITHDRAWAL update the database of BANKAPP). If your application service is read-only (such as INQUIRY), you do not need to use transactions.

The following example shows how to use transactions with JoltBeans.

  1. The setTransactional (true) method is called on the JoltServiceBean. (isTransactional is a boolean property of the JoltServiceBean.)

  2. The beginTransaction() method is called on the JoltSessionBean.

  3. The callService() method is called on the JoltServiceBean.

  4. Depending on the outcome of the service call, the commitTransaction() or rollbackTransaction() method is called on the JoltSessionBean.

Using Custom GUI Elements with the JoltService Bean

JoltBeans provides a limited set of Jolt-enabled GUI components. You can also use controls that are not Jolt enabled together with the JoltServiceBean. You can link controls to the JoltServiceBean that display output information of the service represented by the JoltServiceBean. You can also link controls that display input information.

For example, a GUI element that uses an adapter class to implement the JoltOutputListener interface can listen to JoltOutputEvents. The JoltServiceBean as the event source for JoltOutputEvents calls the serviceReturned() method of the adapter class when it sends a JoltOutputEvent. Inside serviceReturned() , the control's internal data is updated using information from the event object.

The development tool generates the adapter class when the JoltServiceBean and the GUI element are wired together.

As another example, a GUI element can call the setInputTextValue() method on the JoltServiceBean. The GUI element contains input data for the Tuxedo service represented by the JoltServiceBean.

As a third example, a GUI element can implement the required methods (addJoltInputListener() and removeJoltInputListener() ) to act as event sources for JoltInputEvents. The JoltServiceBean acts as an event listener for these events. The control sends a JoltInputEvent when its own state changes to keep the JoltServiceBean updated with the input information.