![]() |
Overview
|
|
The JBMSTours ScenarioThroughout this tutorial, we will be asking you to work with a Java application and database automatically installed with Cloudscape. The sample database is called toursDB; the sample application consists of a package of Java classes called JBMSTours. You will learn more about the specifics of this application in The Application: The JBMSTours Package. To make the most sense of the example, imagine the following scenario: The CompanyOur fictional company, JBMSTours, is a travel company specializing in do-it-yourself customized tours. The company distributes software that allows customers to book complete tours to two cities of their choice, including hotel stays as well as flights. JBMSTours has chosen to write the software in Java, because Java frees the firm from a specific operating system or type of hardware; the software can run on any computer with a JVM. Since the application is data-centric (it must find information about cities, and about available flights, and hotels), it needs to access a database. The company doesn't want customers to have to be connected to a central database server or wait for slow connections over the Internet; instead, JBMSTours wants each copy of the application to have its own copy of the database and the necessary database management software. JBMSTours has chosen Cloudscape as its database management software, for the following reasons:
The Application: The JBMSTours PackageThe fictional company's fictional application and database are included with your installation. The application consists of a set of class files, with a few main or entry classes (which contain main() methods). Javadoc for the application is also included; we encourage you to examine the javadoc as you do this tutorial. Javadoc is automatically generated HTML documentation about a Java class or package. You may also look at the Java source files, which are also provided.
Application OverviewTaking advantage of the object paradigm, the JBMSTours application builds a Tour object for the customer using it to create and book a tour. For the sake of simplicity, a Tour object in the example application is a two-city tour that includes a flight from the user's home city to the first city, a flight to the second city, and a return flight back home. It also includes a hotel stay in each of the two cities visited. The classical reason for using a DBMS is that it provides the following: The sample application uses Cloudscape for both purposes. It queries the databases to get information about cities, flights, and hotels, and it stores information in the database to make it persistent. The Application Queries the DataWhen generating a Tour object, the application queries the database for information about countries, cities, hotels, flights, and airlines. JBMSTours stores a repository of core data in the toursDB database:
The application queries these tables to construct a Tour object. A Tour object itself is made up of other Java objects--CustomerFlights, HotelStays, dates, and some other data. The Application Stores Tour DataAfter a user constructs a tour of his or her choice, the application writes some information to the database.
The Application May Use SynchronizationIn a Cloudscape synchronization system, information stored in tables by an application would be available at the company office and subsequently to the airlines and hotels with which JBMSTours does business. Depending on how the back office processes the data, replicating data allows the application to actually book tours. The application does not yet take advantage of synchronization. One "Temporary" Table: FlightObjectsThe JBMSTours application treats flights as Java objects. However, it stores basic flight information as SQL-92 data types, because of the large quantity of flight data. In the current release, it is faster to search tables holding SQL-92 data types because you can index the data. An index is a database object that allows Cloudscape to find specific data more quickly. You cannot currently index Java data types or Java methods. Before it builds a tour, the application searches the large Flights tables and generates several Flight objects based on the airport codes of cities the customer will visit. The appropriate airport columns are indexed in the table. However, when actually constructing a tour, the application wants to select the appropriate flight (or a set of flights that make up a transfer flight) based on more complex criteria. The application represents a flight as a Flight, OneStopFlight, or TransferFlight object. It stores them in a table called FlightObjects. When the customer actually chooses a flight, the application can search through the small FlightObjects table and use the Flight object's rich set of methods to choose the best flight for the customer. For example, for a customer visiting Paris, the application cleans out the FlightObjects table. Then it searches for flights from the airport of the customer's home city and to the airport in Paris and constructs a set of Flight objects. These various flight objects might be direct flights, one-stop flights, or transfer flights. When it comes time to build the tour, the application can search the FlightObjects table based on methods such as getTotalDuration or getRate to choose the best flight for the customer. What You Will Be Doing with JBMSToursIn the lessons that follow, you will:
Or Look on Your Own . . .You can bypass the lessons in this tutorial. If you just want to build the sample database and run the end-user applications, run them in this order:
In a Client/Server EnvironmentIn this tutorial, you will be working in an embedded environment. That is, you will work with an application that starts up an instance of Cloudscape. However, all the JBMSTours programs can be run as client applications with either RmiJdbc Server or Cloudconnector (purchased separately). To run these applications as client applications to a running server, provide two command-line arguments when you run them: If you are using the RmiJdbc framework, add the single character r. java JBMSTours.CreateToursDB jeeves 7001 java JBMSTours.BuildATour bertie 1099 r This tutorial does not teach you how to start a server. The Cloudscape Server and Administration Guide can help you get started with that task. |
|
![]() Cloudscape Version 3.6 For information about Cloudscape technical support, go to: www.cloudscape.com/support/.Copyright © 1998, 1999, 2000 Informix Software, Inc. All rights reserved. |