All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.demos.travel.flight.FlightInfoDapClient

java.lang.Object
   |
   +----com.ibm.beans.demos.travel.flight.FlightInfoDapClient

public class FlightInfoDapClient
extends Object
implements Serializable, TravelInfoChangedListener, FlightRequestedListener

This class is part of the remote travel demo and implements the flight information data access part (DAP) client bean. For the remote travel demo, the flight information data access part (DAP) bean has been divided into a FlightInfoDapClient bean and a FlightInfoDapServer bean.

The FlightInfoDapClient bean serves as the event sink for the TravelInfoChanged event and the FlightRequested event. The TravelInfoChanged event is sent by the itinerary bean when the user selects an origin city, a destination city, and a departure date. The FlightRequested event is sent by the itinerary bean when the user requests confirmation for a selected flight itinerary.

The FlightInfoDapClient bean serves as the event source for the FlightInformationChanged and the FlightReserved events. The FlightInformationChanged event is sent to the flight selector bean when the Client DAP bean receives the TravelInfoChanged event notification from the itinerary bean. The FlightReserved event is sent to the itinerary bean when the Client DAP bean receives the FlightRequested event notification from the itinerary bean.

A customizer is provided for this DAP client so that a user can configure the serverAddress property value of the FlightInfoDapClient instance.

See Also:
FlightInfoDapClientBeanInfo, FlightInfoDapClientCustomizer, FlightInfoEvent, FlightInfoListener, FlightRequestedEvent, FlightRequestedListener, FlightReservedEvent, FlightReservedListener, TravelInfoChangedEvent, TravelInfoChangedListener

Constructor Index

 o FlightInfoDapClient()
Constructs an instance of the FlightInfoDapClient bean.

Method Index

 o addFlightInfoListener(FlightInfoListener)
Allows other beans to listen to the FlightInfo events this bean generates.
 o addFlightReservedListener(FlightReservedListener)
Allows other beans to listen to the FlightReserved events this bean generates.
 o fireFlightInfo(FlightInfoEvent)
Notifies all registered listeners.
 o fireFlightReserved(FlightReservedEvent)
Notifies all registered listeners that a flight has been reserved.
 o FlightRequested(FlightRequestedEvent)
Responds to a FlightRequested event.
 o getServerAddress()
Retrieves the hostname or IP address of the FlightInfoDapServer.
 o removeFlightInfoListener(FlightInfoListener)
Allows beans to remove themselves from the listener list for this bean's FlightInfo event.
 o removeFlightReservedListener(FlightReservedListener)
Allows beans to remove themselves from the listener list for this bean's FlightReserved event.
 o setServerAddress(String)
Specifies the hostname or IP address of the FlightInfoDapServer.
 o TravelInfoChanged(TravelInfoChangedEvent)
Responds to a TravelInfoChanged event.

Constructors

 o FlightInfoDapClient
 public FlightInfoDapClient()
Constructs an instance of the FlightInfoDapClient bean. The constructor initializes instance data.

Methods

 o TravelInfoChanged
 public void TravelInfoChanged(TravelInfoChangedEvent travelInfoChange)
Responds to a TravelInfoChanged event. This method is invoked when the Itinerary bean has been wired to this DAP bean and the user submits preliminary information needed to query the database for flights that meet the users preliminary requirements.

Parameters:
travelInfoChange - The event containing the preliminary travel requirements
 o FlightRequested
 public void FlightRequested(FlightRequestedEvent flightRequestedEvent)
Responds to a FlightRequested event. This method is invoked when the itinerary bean has been wired to this DAP bean and the user has selected a preferred itinerary. If the itinerary is approved, notification is sent back to the itinerary bean via a FlightReservedEvent.

Parameters:
flightRequestedEvent - The FlightRequestedEvent containing the preferred flight itinerary.
 o addFlightInfoListener
 public synchronized void addFlightInfoListener(FlightInfoListener fIL)
Allows other beans to listen to the FlightInfo events this bean generates. This is the addListener method for all listeners that want to be notified when a FlightInformationChanged event occurs. In the demo, the flight selector bean is wired to this DAP bean and is notified when the FlightInformationChanged event happens.

Parameters:
fIL - The registering listener.
See Also:
removeFlightInfoListener
 o removeFlightInfoListener
 public synchronized void removeFlightInfoListener(FlightInfoListener fIL)
Allows beans to remove themselves from the listener list for this bean's FlightInfo event. This is the removeListener method for all listeners that want to be notified when a FlightInformationChanged event occurs. In the demo, the flight selector bean is wired to this DAP bean and is notified when the FlightInformationChanged event happens.

Parameters:
fIL - The unregistering listener.
See Also:
addFlightInfoListener
 o addFlightReservedListener
 public synchronized void addFlightReservedListener(FlightReservedListener fRL)
Allows other beans to listen to the FlightReserved events this bean generates. This is the addListener method for all listeners that want to be notified when a FlightReserved event occurs. In the demo, this DAP bean is wired to the itinerary viewer bean and is notified by this DAP bean when the FlightReserved event happens.

Parameters:
fRL - The registering listener.
See Also:
removeFlightReservedListener
 o removeFlightReservedListener
 public synchronized void removeFlightReservedListener(FlightReservedListener fRL)
Allows beans to remove themselves from the listener list for this bean's FlightReserved event. This is the removeListener method for all listeners that want to be notified when a FlightReserved event occurs. In the demo, this DAP bean is wired to the itinerary viewer bean and is notified by this DAP bean when the FlightReserved event happens.

Parameters:
fRL - The registering FlightReservedListener object.
See Also:
addFlightReservedListener
 o fireFlightReserved
 public void fireFlightReserved(FlightReservedEvent fRE)
Notifies all registered listeners that a flight has been reserved. In the demo, this event fires in response to a FlightRequested event notification from the itinerary bean when the requested flight itinerary is confirmed.

Parameters:
fRE - The FlightRequestedEvent containing the preferred flight itinerary.
 o fireFlightInfo
 public void fireFlightInfo(FlightInfoEvent fIE)
Notifies all registered listeners. A list of flights are sent as a Vector. In the demo, this event fires in response to a TavelInfoChangedEvent which is fired by the itinerary bean after a user has entered the origin and destination cities and dates and has pressed the submit button. This DAP then queries the database for matching flights, builds this information into a vector, and fires the FlightInformationChanged notification to the flight selector bean.

Parameters:
fIE - The FlightInfoEvent containing the possible flight selections.
 o getServerAddress
 public String getServerAddress()
Retrieves the hostname or IP address of the FlightInfoDapServer.

Returns:
The TCP/IP designation of the machine on which the FlightInfoDapServer is running. An empty string (NOT null) indicates that the FlightInfoDapServer is running on the same machine as the FlightInfoDapClient.
 o setServerAddress
 public void setServerAddress(String newAddress)
Specifies the hostname or IP address of the FlightInfoDapServer.

Parameters:
newAddress - The TCP/IP designation of the machine on which the FlightInfoDapServer is running. Specify the empty string (NOT null) to indicate the FlightInfoDapServer is running on the same machine as the FlightInfoDapClient.

All Packages  Class Hierarchy  This Package  Previous  Next  Index