Chapter 6: Creating an Airline Reservation Application


Download CD Content

The Jabber protocol allows you to develop an application to communicate with the Jabber server for accessing an Extensible Markup Language (XML) file that contains data. This chapter describes how to develop the Airline Reservation application that allows end users to search for airline schedules and make airline reservations by specifying the departure and arrival dates of the journey.

Architecture of the Airline Reservation Application

The Airline Reservation application uses the following files:

  • UserInformation.html: Allows end users to specify personal information and shows the user interface of the Airline Reservation application.

  • Reservation.html: Opens the user interface of the Airline Reservation application by calling the ReservationStatus.java file.

  • ReservationStatus.java: Allows end users to select the starting place, destination, departure date, and arrival date of the journey. This file allows end users to submit the information to the Jabber server through the SocketClass.java file.

  • SocketClass.java: Opens a socket and establishes a connection with the Jabber server to send and receive messages.

  • SocketConnector.java: Reads the airlines.xml file based on the search information specified by end users. The SocketConnector.java file then connects with the Jabber server to send the airline schedules and confirmation message, written in the airlines.xml file, to the Airline Reservation application.

  • ReservationResultTable.java: Allows end users to select the required schedule and send schedule information to the Jabber server.

  • XMLReader.java: Allows the Airline Reservation application and the Jabber server to read the airlines.xml file.

  • airlines.xml: Contains the information related to airline reservation. The Airline Reservation application reads this XML file to show the required information to end users.

Figure 6-1 shows the architecture of the Airline Reservation application:

click to expand: this figure shows the files that the airline reservation application uses and the sequence in which the application uses them.
Figure 6-1: Architecture of the Airline Reservation Application

The UserInformation.html file creates the Web interface of Airlines Enquiry System that contains five labels, five text fields, and two command buttons. The UserInformation.html file allows end users to specify personal information.

If end users press the Cancel button on the Web interface, the Airline Enquiry System window closes. If an end user presses the OK button, the end user's information is submitted to the Reservation.html file. The Reservation.html file calls the ReservationStatus.java file.

The ReservationStatus.java file creates the user interface for the Airline Reservation application that contains combo boxes for starting place, destination, departure date, and arrival date. The user interface of the Airline Reservation application also contains two buttons, Reset and Search. When an end user clicks the Reset button, the Airline Reservation application refreshes the values stored in the combo boxes. When an end user clicks the Search button, the Airline Reservation application checks the existing airline schedule in the Jabber server based on the requirements specified by the end user and displays the schedule in the user interface.

The Jabber server passes an end user's query to the SocketConnector.java file. The SocketConnector.java file reads the airlines.xml file to search for the query specified by the end user. The airlines.xml file stores the database of existing airline schedules. If an end user’s query matches any existing airline schedule, the SocketConnector.java file returns the information to the Jabber server. The Jabber server sends the information to the Airline Reservation application. The application shows the information received from the Jabber server in the Airline Reservation window by using the ReservationResultTable.java file.

End users can select any of the available airline schedules to reserve the required airline schedule. End users can click the Submit button to send the information to the Jabber server. The Jabber server receives the information and sends a confirmation message to the Airline Reservation application, which appears on the Airline Reservation window.




Developing Applications Using Jabber
Developing Applications Using Jabber
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 68

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net