Home | » | Java | » | Advance Java | » | Java RMI | » | Air-line Reservation |
---|
Example:
The following example develops a simple block of an Airline Reservation System. A User Interface, captures the flight number. On clicking the 'Seat Availability' button, a method on the Server is called. This method displays the flight number on the Server's console and returns the number of seats available for the specified flight. The number is then displayed in the results text area on the User Interface at the client. If information fot the specified flight is not available, the number returned is zero.
To create the above application the following steps needs to be done:
The following defines the table structure for the Airline Reservation Application in access.
Table Name : Flight
Primary Key : FlightNo
Column Definition:
|
Diagram 23.3 Flight Table |
Test Records:
|
Diagram 23.4 Test Records of Flight Table |
To allow the User Interface to communicate with the database, a DSN with the name 'airline' needs to be created.
The following classes and interfaces are needed for server application:
- AirlineInterface: Defines the methods that are remotely accessible.
- AirlineServer: Implements the methods declared in the interface that will be invoked by the remote client.
- AirlineClient: The User Interface, which captures user data calls the remote method that checks for the validation.
SERVER APPLICATION
Code for AirlineInterface.java
Compile the above code on the Server
This will create AirlineInterface.class.
Code for AirlineInterface.java
Compile the above code on the Server
|
This will create AirlineServer.class. |
|
This will create the stubs and skeltons:
AirlineServer_stub.class and AirelineServer_skel.class
CLIENT APPLICATION
Code for AirlineClient.java
Compile the above code on the Client (in a separate console window)
|
This will create AirlineClient.class. Start the rmiregistry on the Server. |
|
|
Execute the server program on the server. |
|
Diagram 23.5 Output of AirlineServer (at the Console) |
Execute the client program on the client |
|
|
Diagram 23.6 Output of AirlineClient.class when seats are available(User Interface) |
|
Diagram 23.7 Output of AirlineClient.class when no seats are available(User Interface) |
BigValue Travels is a reputed travel agency in India offering airline reservations at the lowest airfare. Call at +91-9990780550 to our 24x7 customer support for booking.
ReplyDeleteWhile upgrades are possible you won't get one due to the priority order for the way upgrades are distributed checkout United Upgrade to First Class option can help gain several benefits.
ReplyDeleteTo submit your warranty claim at registeryourninja.com you will need to call customer service but have your proof of purchase receipt. You will be guided through the instructions by the customer service team on how to return the item.
ReplyDelete