ejb.reserving
Interface ReserveAndBuy

All Superinterfaces:
EJBObject, Remote

public interface ReserveAndBuy
extends EJBObject

The ReserveAndBuy interface is the remote interface for the ReserveAndBuy EJB component.

This component maintains no state related to a client between method calls. Each method is handled separately and the arguments contain all data that is necessary to perform the operation, i.e., there's no need to retrieve state from elsewhere.

This component is in the EJB tier of the architecture.

Category Functionality: use case 2 - make reservation, 3 - purchase tickets, and 4 - cancel reservation.
Behavior This component is a stateless session bean used that allows the user to make reservation, cancel reservation and buy tickets to a particular flight.
Exception handling The client may receive a RemoteException if a communication-related problem occurs during a call to any method of this component. The cause, which is not specific to the code of a particular method, can be:
  • The component is not available because the application server is not running.
  • This specific component is not deployed or the application server was not able to activate an instance to execute the requested method.
  • The reference (EJB handle) passed by the client is invalid.
  • There was a problem while marshalling or unmarshalling a remote call (or its response).
  • The method call and its arguments do not match the available skeleton (probably different versions).
The client may also receive an EJBException if the a severe problem occur when the component instance was processing the call.
Clients We don't know what clients may connect from outside of our system as the interfaces are exposed.

Version:
1.0
Author:
Team Two: Matthew Bass, Vijay Sai, Mannik Bhojwani, Paulo Merson

Method Summary
 void buyTickets(int reservationId, CreditCardValue creditCard, long transId)
          Given the reservation ID and credit card, purchase the tickets.
 void cancelReservation(int reservationId, long transId)
          Given a reservation ID, mark that reservation as cancelled.
 int makeReservation(FlightSelection selection, String[] passengers, CreditCardValue creditCard, long transId)
          Given the flight, passenger information, and credit card information creates a reservation and inserts it into the database.
 ReservationValue readReservation(int reservationId)
          Given a reservation ID, return all the reservation information.
 
Methods inherited from interface javax.ejb.EJBObject
getEJBHome, getHandle, getPrimaryKey, isIdentical, remove
 

Method Detail

makeReservation

public int makeReservation(FlightSelection selection,
                           String[] passengers,
                           CreditCardValue creditCard,
                           long transId)
                    throws RemoteException,
                           ValidationException
Given the flight, passenger information, and credit card information creates a reservation and inserts it into the database.
Parameters:
selection - the flight information that the customer has selected.
passengers - the list of passengers that need tickets.
creditCard - the credit card information to reserve the tickets.
transId - Universally unique identifier for this transaction.
Throws:
RemoteException - if a problem occured in the communication between the remote client and this component. See the description of Exception handling for this component.
ValidationException - if flight is null or doesn't match any existing flight in the database; if passengers is null or all elements of the array are null; if the credit card is null. If the credit card informed does not have sufficient credit to purchase the tickets or is not valid for some reason, as informed by the credit card authorizer application; if there are no seats available on the flight anymore.

buyTickets

public void buyTickets(int reservationId,
                       CreditCardValue creditCard,
                       long transId)
                throws RemoteException,
                       ValidationException
Given the reservation ID and credit card, purchase the tickets. This method calls the external application that validates the credit card and updates the reservation data in the database table, setting the field that indicates when the tickets were purchased. It also sends an e-mail message to the customer confirming that the tickets were successfully purchased.
Parameters:
reservationId - Reservation id for the flight reservation.
creditCard - credit card information that passenger uses to pay for flight. It may differ from the credit card informed to make the reservation.
transId - Universally unique identifier for this transaction.
Throws:
RemoteException - if a problem occured in the communication between the remote client and this component. See the description of Exception handling for this component.
ValidationException - if reservationId does not match any existing reservation in the database; or if the credit card is null or blank. If the credit card informed does not have sufficient credit to purchase the tickets or is not valid for some reason, as informed by the credit card authorizer application; if the reservation is no longer valid (has expired).

cancelReservation

public void cancelReservation(int reservationId,
                              long transId)
                       throws ValidationException,
                              RemoteException
Given a reservation ID, mark that reservation as cancelled. The seats that were reserved are released and other passengers will be able to reserve them. The reservation record is not deleted from the database though. If the reservation is already cancelled, this method does nothing.
Parameters:
reservationId - Reservation id for the flight reservation that is being cancelled.
transId - Universally unique identifier for this transaction.
Throws:
RemoteException - if a problem occured in the communication between the remote client and this component. See the description of Exception handling for this component.
ValidationException - if reservationId does not match any existing reservation in the database.

readReservation

public ReservationValue readReservation(int reservationId)
                                 throws RemoteException
Given a reservation ID, return all the reservation information.
Parameters:
reservationId - Reservation id for the flight reservation that is being queried.
Throws:
RemoteException - if a problem occured in the communication between the remote client and this component. See the description of Exception handling for this component.


Copyright © 2003 Team Two.