This section discusses the steps in setting up a computer or computers to run the Travel Services demo. This demo may be built and run on a single computer (in which case the FlightInfoDap data access part bean is used) or the demo may be built and run on two machines as a multi-tier demonstration (in which case the FlightInfoDap data access part bean is split into two beans: a FlightInfoDapClient bean which is on the client machine and a FlightInfoDapServer bean which is on the server machine). Note that if you choose to build the multi-tier demo you must be running with the Java JDK 1.1.3 or later.
It is better to perform some of the assembly before starting the demo to make the demo less repetitive and less time consuming. For example, consider assembling the FlightSelector and Itinerary beans before the demo. Then, during the demo, add the FlightInfoDap bean (or the FlightInfoDapClient bean in the case of an RMI remote demo) to illustrate the procedure. Note that all references throughout this document to FlightInfoDap should be read as references to FlightInfoDapClient if you are constructing the demo using the RMI remote capabilities.
Perform the following steps to set up your computer for the Travel Services demo:
Where product represents the name of the directory in which you installed Bean Extender.
Note: | Using local copies avoids entering long path names during the demo and ensures that you have write access to the classes to be morphed. This step lists the full path for the files you should copy. The remainder of the demo uses only simple file names. |
product/src/com/ibm/beans/demos/travel/images/*.gif
Note: | Running the demo modifies this file, and you cannot rerun the demo unless you have an unmodified copy of the FlightInfo.jar file. |
java com.ibm.beans.tools.assembly.AssemblySurfaceMain
Notes:
A. | awidgets.jar |
B. | calendar.jar |
C. | controls.jar |
D. | media.jar |
E. | Travel.jar |
F. | FlightInfo.jar |
G. | FlightSelector.jar |
A. | Click on the Repositories tab in the center region of the Assembly Surface working area, under the Beans tab. |
B. | Click on the Add File Repository button at the bottom of the Assembly Surface. |
C. | Use the Open File dialog window to specify the location of one of the repository files. A new notebook tab, labeled with the name of the file you added is displayed under the Beans tab in the center section of the Assembly Surface working area. |
Note: | You must load these files in the listed order. Ignore any error messages while loading FlightInfo.jar and FlightSelector.jar. |
A. | Click on the Beans tab. Additional tabs are displayed in the center section of the Assembly Surface working area. | ||
B. | Click on the travel.jar tab. The Itinerary bean is displayed. | ||
C. | Select the Itinerary bean by clicking on it.
| ||
D. | Click on the Add beans button. The Itinerary bean is displayed in the left section of the Assembly Surface working area. | ||
E. | Layout the Itinerary bean. Click on View/Layout from the menu bar. The Layout notebook page is displayed in the center section of the Assembly Surface working area and the Layout tab is added to the view. | ||
F. | Right-click on the Layout tab and click on Move view to window to display the layout in an independent window. | ||
G. | Resize the Layout window so that all eight of the adjusting handles are visible and then minimize the window. | ||
H. | Click on the Beans tab and then click on the FlightSelector tab. | ||
I. | Add the FlightSelector bean to the left section of the Assembly Surface working area. |
A. | Click on View/Event Connections on the menu bar. | ||||||||
B. | Connect the FlightSelector bean to the Itinerary bean by picking the
following connections from the Event Connections view:
The columns are filled in automatically as you make selections from left to right, so your choices are limited. | ||||||||
C. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. |
A. | Click on View/Scripting on the menu bar to display the Scripting notebook page, if the Scripting view is not already displayed. Three icons and a combination box are displayed on the notebook page. | ||
B. | Click on the blue ball icon. A tree view of available objects to script is displayed. | ||
C. | Click on the Script0 object.
| ||
D. | Click on Script Globals in the combination box at the top of the new (right-hand) section. | ||
E. | Click on the text area and enter:
java.awt.Frame myFSFrame=null; | ||
F. | Click on public void initialize() in the combination box. | ||
G. | Click on the text area. Ensure that the cursor is positioned between the
curly braces and enter:
myFSFrame=new java.awt.Frame(); myFSFrame.add(FlightSelector); myFSFrame.pack(); | ||
H. | Click on the FlightSelector bean in the tree view of available objects to script. | ||
I. | Click on public void FlightSelector_actionPerformed(java.awt.event.ActionEvent arg0 in the combination box. | ||
J. | Click on the text area. Ensure that the cursor is positioned between the
curly braces and enter:
myFSFrame.setVisible(false); |
A. | Remove the Event Connections view from the Assembly Surface. You can either right-click the Event Connections tab and click on Close view on the pop-up menu or click on View/Event Connections on the menu bar. |
B. | Remove the Scripting view from the Assembly Surface. |
C. | Unload the FlightInfo.jar repository. During the demo, you can load this
repository as a typical example of loading a repository.
|
A. | Install any needed database software and start all necessary daemons on the server machine. For example, the default database implementation assumes that you are using DB/2 as your database. If you accept the default, you must install DB/2 and issue the db2start command. The rmiregistry daemon must always be started by typing: rmiregistry. |
B. | Set up your environment so that needed jar files can be found by setting your CLASSPATH to include the jars subdirectory off of where you installed BeanExtender. For example, you would issue the following command - set CLASSPATH=c:\extender\jars;%CLASSPATH% - assuming that you installed BeanExtender in c:\extender |
C. | Build the database on the server machine by running the
following application:
java com.ibm.beans.tools.JarJava com.ibm.beans.demos.travel.flight.CreateDBThis application uses JDBC to build the sample database with a default JDBC URL value of: "jdbc:odbc:DB2" and a default database table name value of: "FlightInfoTbl". If you need to change these values you may do so by adding command line arguments for both of these variables when you invoke the application: java com.ibm.beans.tools.JarJava com.ibm.beans.demos.travel.flight.CreateDB myJDBCURL mydbTableNameIf the records are successfully added to the database, they will be displayed in the GUI and an "All records were successfully entered into the database!" message will be presented. |
A. | Click on View/Beans from the menu bar. This adds a Repositories tab to the Client section of the Assembly Surface, below the Bean tab. |
B. | Click on the Add File Repository button. |
C. | Use the Open File dialog window to specify the location of the FlightInfo.jar repository file. A new notebook tab, labeled FlightInfo.jar, is added under the Beans tab in the center section of the Assembly Surface working area. The FlightInfoViewer and FlightInfoDap bean icons are displayed along with the beans for the remote RMI travel demo - the FlightInfoDapClient and FlightInfoDapServer bean icons. |
A. | Click on the Beans tab. Additional tabs are displayed. | ||
B. | Click on the FlightInfo.jar tab. The FlightInfoViewer and FlightInfoDap beans are displayed along with the beans for the remote RMI travel demo - the FlightInfoDapClient and FlightInfoDapServer beans.. | ||
C. | Click on the FlightInfoDap bean (or the FlightInfoDapClient bean
if you are doing a remote RMI demo).
| ||
D. | Click on the Add beans button. The FlightInfoDap (or FlightInfoDapClient) bean is added to the assembly and is displayed in the left section of the Assembly Surface working area. |
A. | Click on View/Event Connection on the menu bar. | ||||||||
B. | Pick the following connections from the columns in the Event Connections
view:
| ||||||||
C. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. | ||||||||
D. | Connect the FlightInfoDap (or FlightInfoDapClient) bean to the FlightSelector bean by
selecting:
| ||||||||
E. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. | ||||||||
F. | Connect the Itinerary bean to the FlightInfoDap (or FlightInfoDapClient)
bean by selecting:
| ||||||||
F. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. | ||||||||
G. | Connect the FlightInfoDap (or FlightInfoDapClient) bean to the
Itinerary bean by selecting:
| ||||||||
H. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. |
A. | Select the FlightInfoDapClient bean in the Contents view of the Assembly Surface, |
B. | Click on View/Customizer on the menu bar to display the customizer for the FlightInfoDapClient bean. |
C. | Fill in the hostname or IP address for the server where the FlightInfoDapServer bean will be running. If you leave this blank, it is assumed that the server is running on the local machine. |
A. | Bring up the Assembly Surface on the server machine and load the sql.jar file into the Assembly Surface. |
B. | Instantiate the FlightInfoDapServer bean by loading the FlightInfo.jar file into the Assembly Surface and adding the FlightInfoDapServer bean to the contents list. |
C. | Select the FlightInfoDapServer bean in the contents list and click on View/Customizer on the menu bar to display the customizer for the FlightInfoDapServer bean. |
D. | Check the "use JDBC to access database?" checkbox if you wish to use JDBC. It this is not checked, data will be retrieved from a default resource bundle. |
E. | If you decide to use JDBC you may accept the defaults for the "JDBC URL:" of "jdbc:odbc:DB2" and for the "Database table name" of "FlightInfoTbl" or you may override them. |
A. | Click on View/Scripting on the menu bar to display the Scripting notebook page, if the Scripting view is not already displayed. Three icons and a combination box are displayed on the notebook page. | ||
B. | Click on the icon that resembles a blue ball. This is the Beans view of
the Scripting IDE and shows all the beans that are instantiated.
| ||
C. | Click on FlightInfoDap (or the FlightInfoDapClient) bean from the list of instantiated
beans. A new section of the Assembly Surface is displayed on the right.
| ||
D. | Insure that you have selected the FlightInformationChanged method. It should be the method that is visible in the drop down list. |
Point pt = Itinerary.getLocationOnScreen(); myFSFrame.setLocation(pt); myFSFrame.setVisible(true); FlightSelector.setVisible(true);Alternatively, if you have the code in a file, you can click on the icon above the curly braces (the icon that resembles a piece of paper) to import the contents of the file.
A. | Supply information about the new bean in the Class,
Extends, Package, and Repository fields in
the control area of the Assembly Surface.
The class and package cannot be the same and cannot start with a number. For example, you might enter TravelDemo for the class, com.ibm.beans.Demo for the package, and TravelDemo.jar for the repository. Do not change the default contents of the Extends field (the default contents are java.awt.Panel). |
B. | Click on the Generate button in the action area of the Assembly Surface. Status messages are displayed in the status area of the action area of the Assembly Surface. The generation is complete when the "Successfully generated..." message is displayed in the status area and the Run button in the action area of the Assembly Surface is enabled. |
Run the new aggregate bean:
A. | Click on the Run button in the action area of the Assembly Surface. A window opens to run the new aggregate bean. This window contains a logo at the top and a row of buttons at the bottom. If necessary, resize the window so that the buttons are visible. |
B. | Click the Add Flight button at the bottom of the window. Two input fields are displayed in the right-hand side of the window. |
C. | Enter the city of origin (Austin) into the Depart from field and a destination city (either Dallas or Chicago) into the Arrive at field. |
D. | Click on the Click HERE to select flight label. The FlightSelector bean displays the corresponding flight choices for the stated parameters in a new window. Click on the desired flight and click on the Ok button. Information about the selected flight is displayed in the main window of the aggregate bean. To select alternate flights, click on the Click HERE to select flight label again and repeat the procedure. To add additional flights, click on the Add Flight button at the bottom of the window and repeat the procedure. |
E. | When finished viewing the running aggregate bean, close the window by clicking the Stop button in the action area of the Assembly Surface. |
A. | Click on View/Beans from the menu bar. | ||
B. | Click on the FlightInfo.jar tab. | ||
C. | Click on the FlightInfoDap (or FlightInfoDapServer) bean, if not already selected. | ||
D. | Click on the Morph bean button at the bottom of the Assembly Surface. The Morph Beans window is displayed. The Inheritance morphing option should be selected and the Save with original location should be specified. | ||
E. | Click on the Morph selected bean button at the bottom of the Morph Beans window. A progress window is displayed. | ||
F. | When the progress window closes, click on the Done button at
the bottom of the Morph Beans window. The FlightInfoDapDippable (or FlightInfoDapServerDippable if you
are morphing the server side for the remote RMI demo) bean icon is displayed in the Beans view.
|
A. | Click on the FlightInfoDapDippable (or FlightInfoDapServerDippable) bean. |
B. | Click on the Add beans to assembly button at the bottom of the Assembly Surface. An instance of FlightInfoDapDippable (or FlightInfoDapServerDippable) is added to the Contents list in the left section of the Assembly Surface working area. Note that if you are building the remote RMI demo you will have to reconfigure the customizer for the FlightInfoDapServerDippable bean as described earlier. |
C. | Click on the FlightInfoDap (or FlightInfoDapServer) bean. |
D. | Click on the Delete button at the bottom of the Contents list. The non-dippable bean is removed from the Contents list. |
A. | Click on View/Event Connection on the menu bar. | ||||||||
B. | Pick the following items from the columns, then click on the
Connect button at the bottom of the Assembly Surface to establish
each event connection.
Connect the Itinerary bean to the FlightInfoDapDippable bean by selecting:
| ||||||||
C. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. | ||||||||
D. | Connect the FlightInfoDapDippable bean to the Itinerary bean by
selecting:
| ||||||||
E. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. | ||||||||
F. | Connect the FlightInfoDapDippable bean to the FlightSelector bean by
selecting:
| ||||||||
G. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. | ||||||||
H. | Connect the Itinerary bean to the FlightInfoDapDippable bean by
selecting:
| ||||||||
I. | Click on the Connect button at the bottom of the Assembly Surface. The current event connections are displayed at the bottom of the Event Connections notebook page. |
A. | Click on View/Scripting on the menu bar to display the Scripting notebook page, if the Scripting view is not already displayed. Three icons and a combination box are displayed on the notebook page. | ||
B. | Click on the icon that resembles a blue ball. This is the Beans view of
the Scripting IDE, and shows all the beans that are instantiated.
| ||
C. | Click on FlightInfoDapDippable from the list of instantiated beans.
| ||
D. | Position the cursor between the curly braces and enter:
Point pt = Itinerary.getLocationOnScreen(); myFSFrame.setLocation(pt); myFSFrame.setVisible(true); FlightSelector.setVisible(true);Alternatively, if you have the code in a file, you can click on the icon above the curly braces (the icon that resembles a piece of paper) to import the contents of the file. |
A. | Click on View/Dips/Available dips from the menu bar. | ||||||
B. | Load the dip to be applied by clicking on the Add file
repository button at the bottom of the Assembly Surface, then specifying
the location of the FlightRules.jar file. Two icons are displayed representing
the following dips:
| ||||||
C. | Click on the CarrierRestrictionDip dip, then click on the FlightInfoDapDippable (or FlightInfoDapServerDippable in the remote RMI demo) bean in the contents list in the left section of the Assembly Surface. | ||||||
D. | Click on the Apply dips to selected bean button at the bottom of the Assembly Surface. A customization window for the dip is displayed. | ||||||
E. | In the customization window, enter the name of an airline in the Carrier field. Click on the Apply button and then click on the Done button. | ||||||
F. | Click on the ConnectingFlightDip dip, then click on the FlightInfoDapDippable (or FlightInfoDapServerDippable in the remote RMI demo) bean in the contents list in the left section of the Assembly Surface. | ||||||
G. | Click on the Apply dips to selected bean button at the bottom of the Assembly Surface. A customization window for the dip is displayed. | ||||||
H. | In the customization window, enter a dollar amount (for example, $100) that should not be exceeded in the Dollar amount field. Click on the Apply button and then click on the Done button. | ||||||
I. | View the applied dips. Click on View/Dips/Applied dips on the
menu bar to display a window listing all dips that have been applied.
|
A. | Modify the class name in the control section of the Assembly Surface. For example, you might use the class name "TravelDemoDipped." |
B. | Click on the Generate button in the action area of the Assembly Surface. Status messages are displayed in the status area in the action area of the Assembly Surface. When the status messages complete, the aggregate bean has been generated. |
A. | Click on the Run button in the action area of the Assembly Surface. |
B. | Verify that when the user requests the list of possible flights, the carrier that was restricted when customizing the dip does not appear in the list. Further, any direct flights with a difference in cost greater than $100 compared to a scenario involving connecting flights do not appear in the list of possible flights. Otherwise, the bean works as before. |
Restore the system to its original state: