• Set the CLASSPATH in your development environment to include all Jolt classes.The method of setting the CLASSPATH can vary, depending on the development environment you use.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 place 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. Refer to “Using Development and Run-time JoltBeans” for complete details.The .jar files containing JoltBeans contain two versions of each JoltBean, a development version and a run-time version. The development version of each JoltBean name ends with the suffix Dev. The run-time version of each class name ends with the suffix Rt. For example, the development version of the class, JoltBean, is JoltBeanDev, while the run-time version of the same class is JoltBeanRt.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 run-time beans are used when compiling your application.
1.
1. Use the setEventName() and setFilter() methods of the JoltUserEventBean to specify the Oracle Tuxedo event to which you want to subscribe.
3. The subscribe() method is called on JoltUserEventBean.
4. When the actual Oracle Tuxedo event notification arrives, JoltSessionBean sends a JoltOutputEvent to its listeners by calling serviceReturned() on them. The JoltOutputEvent object contains the data of the Oracle Tuxedo event.When the client no longer needs to receive the event, it calls unsubscribe() on the JoltUserEventBean.
Note: If the client will only subscribe to unsolicited events, use setEventName ("\\.UNSOLMSG"), which can be set using the property sheet. EventName and Filter are properties of the JoltUserEventBean.Figure 6‑1 represents the possible relationships among the JoltBeans.Figure 6‑1 Possible Interrelationships Among JoltBeansThe JoltSessionBean sends a PropertyChange event when the Oracle 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().Table 6‑1 shows the JoltSessionBean properties and descriptions.
Set the IP address (host name) and port number of the JSL or the Jolt Relay. The format is //host:port number
(for example, myhost:7000). The JoltServiceBean represents a remote Oracle 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(…)).Table 6‑2 shows the JoltServiceBean properties and descriptions.
Set to true if this JoltServiceBean is to be included in the transaction that was started by its JoltSessionBean.Table 6‑3 shows the JoltUserEventBean properties and descriptions.
• This is a Jolt-aware extension of java.awt.TextField and Swing JTextfield. JoltTextField contains parts of the input for a service. A JoltServiceBean can listen to events raised by a JoltTextField. JoltTextField sends JoltInputEvents to its listeners (typically JoltServiceBeans) when its contents changes.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 to which this textfield is linked 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.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 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 to which this checkbox is linked 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 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 to which this choice is linked is specified by the occurrenceIndex property of this bean.The values of most JoltBeans properties can be modified by editing the right column of the Property List in your integrated development environment (IDE), such as Visual Café, as shown in the following figure “Property List: Ellipsis Button.”Figure 6‑2 Property List: Ellipsis ButtonFigure 6‑3 Custom Property Editor Dialog BoxFor details about the logon and using the Property List and Property Editor, see “Using the Jolt Repository and Setting the Property Values” on page 6‑41.Figure 6‑4 shows 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 Oracle Tuxedo. To run this sample, the Oracle Tuxedo server must be running.Figure 6‑4 Sample Inquiry AppletRefer to the figure “Visual Café 3.0 Form Designer” on page 6‑18 for an example of each item required by the Java form. Each item in that figure is described in the following table “Required Form Elements”.
Table 6‑4 Required Form Elements
1. In Visual Café, 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.
1. Choose File→New Project, and choose JFC Applet.
2. Drag and drop the beans from the Component Library (shown in Figure 6‑5) onto the palette of the form designer.The following figure “Visual Café 3.0 Form Designer” illustrates how JoltBeans appear when they are placed on the palette of the Form Designer.Figure 6‑6 Visual Café 3.0 Form DesignerThe following figure,“Example of JoltTextField Property List and Custom Property Editor,” shows how selecting the JoltFieldName of the button property list displays the Custom Property Editor.
Note: Table 6‑5 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 6‑5 Required and Recommended Property Values Refer to the following figure “Example of JoltTextField Property List and Custom Property Editor”and “Using the Jolt Repository and Setting the Property Values” on page 6‑41 for general guidelines about JoltBean properties.The change is reflected in the Property List shown in the following figure “Revised JoltFieldName in the JoltTextField Property List”and on the text field shown on the figure “Example of JoltBeans on the Form Designer with Property Changes” on page 6‑21.The following figure “Example of JoltBeans on the Form Designer with Property Changes” illustrates how the text on the button and the textfield changes after the text is added to the property list fields for these beans.
7. After you set the properties to the right values (refer to the table “Required and Recommended Property Values” on page 6‑18 for additional information), define how the beans will interact by wiring them together using the Visual Café Interaction Wizard. Refer to “Wiring the JoltBeans Together” for details.After all the beans are positioned on your form and the properties are set, you must wire the beans and their events together. The following figure “Sequence in Which JoltBeans Are Wired” illustrates an example of the flow to help you determine the correct order in which 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.Figure 6‑10 shows the sequence in which you will wire the beans together to create this sample applet. The numbers in this figure correspond to the numbered steps that follow.Figure 6‑10 Sequence in Which JoltBeans Are WiredThe steps below correspond to the callouts shown in the figure “Sequence in Which JoltBeans Are Wired” on page 6‑23. Each of the steps below is detailed in the sections that follow.Step 7: Compile the Applet (not shown as a callout)Figure 6‑11 Wire the Applet to the Jolt Session BeanThe Interaction Wizard window is displayed as shown in the figure “Select ComponentShown Event” on page 6‑25, with the prompt:
3. Figure 6‑12 Select ComponentShown Event
4. The Interaction Wizard window is displayed, as shown in the figure “Select Logon to the Tuxedo System Action” on page 6‑26, with the prompt:
5. With the Perform an action radio button enabled, select the action Logon to the TUXEDO system, as shown in Figure 6‑13.Figure 6‑13 Select Logon to the Tuxedo System Action
6. Click Finish.Completing “Step 1: Wire the JoltSessionBean Logon” 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.Figure 6‑14 Wire the JoltSessionBean to the JoltServiceBeanThe Interaction Wizard window is displayed as shown in the figure “Select propertyChange Event” on page 6‑28, with the prompt:
3. Figure 6‑15 Select propertyChange Event
4. The Interaction Wizard window is displayed as shown in the figure “Select Handle a Jolt property change event...” on page 6‑29, with the prompt:
5. Figure 6‑16 Select Handle a Jolt property change event...
6. Click Next.The Interaction Wizard window is displayed as shown in the figure “Select joltSesssionBean1” on page 6‑30, with the prompt:
7. Select joltSessionBean1 as the object that supplies the action, as shown in the following figure.
8. Figure 6‑17 Select joltSesssionBean1Completing “Step 2: Wire JoltSessionBean to JoltServiceBean Using PropertyChange”enables the JoltSessionBean to send a propertyChange event when logon() completes. The JoltServiceBean listens to this event and associates its service with this session.
2. Select the accountID JoltTextField bean and drag a line to the JoltServiceBean.
3. Figure 6‑18 Select dataChanged Event
4. Click Next.The Interaction Wizard window is displayed as shown in the figure “Select inquiry Object and Handle a Jolt input event Action” on page 6‑32, with the prompt:
5. Select the joltServiceBean inquiry as the object supplying the parameter, as shown in the following figure.
6.
7. Click Next.The Interaction Wizard window is displayed as shown in “Select accountId Object and Get the current Jolt Input Event Action” on page 6‑33, with the prompt:
8. Select accountId as the object, as shown in the following figure.
9.
10. Click Finish.Completing “Step 3: Wire the accountID JoltTextField as Input to the JoltServiceBean Using JoltInputEvent” 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 text box.) The JoltInputEvent object contains the name, value, and occurrence index of the field.
3. Figure 6‑21 Select action Performed Event
4. The Interaction Wizard window is displayed, as shown in the figure “Select inquiry Object and Invoke the TUXEDO Service... Action” on page 6‑35, with the prompt:
5. Select inquiry as the object, as shown in the following figure.
6. Select Invoke the TUXEDO Service represented by this Bean as the action, also as shown in Figure 6‑22.
7. Click Finish.Completing “Step 4: Wire Button to JoltServiceBean Using JoltAction” enables the callService() method of the JoltServiceBean to be triggered by an ActionEvent from the Inquiry button.
3. Figure 6‑23 Select ServiceReturned Event
4. The Interaction Wizard window is displayed, as shown in the figure “Select balance Object and Handle a service returned event Action” on page 6‑37, with the prompt:
5. Select balance as the object, as shown in the following figure.
6. Select Handle a service returned event... as the action, also as shown in the following figure.
7. Click Next.The Interaction Wizard window is displayed, as shown in the figure “Select inquiry Object and Get the JoltOutputEvent object Action” on page 6‑38, with the prompt:
8. Select inquiry as the object, as shown in the following figure.
9.
10. Click Finish.Completing “Step 5: Wire JoltServiceBean to the Balance JoltTextField Using JoltOutputEvent”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.
3. Figure 6‑26 Select componentHidden Event
4. The Interaction Wizard window is displayed, as shown in the figure “Select joltSessionBean1 Object and Logoff from the Tuxedo System Action” on page 6‑40, with the prompt:
5. Select joltSessionBean1 as the object, as shown in the following figure.
6.
7. Click Finish.Completing “Step 6: Wire the JoltSessionBean Logoff” enables the logoff() method of the JoltSessionBean to be triggered by an applet (for example, componentHidden) that is sent when the applet gets hidden.For additional information see the following section “Using the Jolt Repository and Setting the Property Values.” Also refer to the table “JoltBean Specific Properties” on page 6‑41 and the figure “JoltServiceBean Property Editor” on page 6‑42.
•
•
Table 6‑6 JoltBean Specific Properties e.g., //host:port 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. Refer to the Oracle Tuxedo tpsubscribe calls. 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 “JoltServiceBean Property Editor.”
1. Figure 6‑28 JoltServiceBean Property EditorFigure 6‑29 Custom Property Editor for ServiceNameThe JoltBeans Repository Logon shown in Figure 6‑30 is displayed.Figure 6‑30 JoltBeans Repository LogonThe Custom Property Editor loads its cache from the repository and is displayed, as shown in the following figure “Property Editor with Selected Service.”
7. Click OK in the Custom Property Editor dialog.Figure 6‑31 Property Editor with Selected Service
8. Click OK in the Custom Property Editor dialog box again.
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.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.As another example, a GUI element can call the setInputTextValue() method on the JoltServiceBean. The GUI element contains input data for the Oracle 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.