tp
Interface WC

All Superinterfaces:
Remote
All Known Implementing Classes:
MyWC

public interface WC
extends Remote

Workflow Controller stub


Method Summary
 void abort(Transaction context)
          Abort a transaction
 boolean addCars(Transaction context, String location, int numCars, int price)
          Add cars to a location.
 boolean addRooms(Transaction context, String location, int numRooms, int price)
          Add rooms to a location.
 boolean addSeats(Transaction context, String flight, int flightSeats, int flightPrice)
          Add seats to a flight This method will be used to create a new flight but if the flight already exists, seats will be added and the price overwritten
 boolean cancelItinerary(Customer customer)
          Cancel an itinerary owned by customer
 void commit(Transaction context)
          Commit a transaction
 boolean deleteCars(Transaction context, String location, int numCars)
          Delete cars.
 boolean deleteFlight(Transaction context, String flight)
          Delete the entire flight.
 boolean deleteRooms(Transaction context, String location, int numRooms)
          Delete rooms.
 boolean deleteSeats(Transaction context, String flight, int numSeats)
          delete seats from a flight
 String[] listCars(Transaction context)
          list existing cars
 Customer[] listCustomers(Transaction context)
          list existing customers that have itinerary
 String[] listFlights(Transaction context)
          list existing flights
 String[] listRooms(Transaction context)
          list existing rooms
 int queryCar(Transaction context, String location)
          Get the number of cars available.
 int queryCarPrice(Transaction context, String location)
          Get the cars price.
 int queryFlight(Transaction context, String flight)
          Get the number of seats available.
 int queryFlightPrice(Transaction context, String flight)
          Get the flight price.
 String queryItinerary(Transaction context, Customer customer)
          Get the bill for the customer
 int queryItineraryPrice(Transaction context, Customer customer)
          Get the total amount of money the customer owes
 int queryRoom(Transaction context, String location)
          Get the number of rooms available.
 int queryRoomPrice(Transaction context, String location)
          Get the room price.
 boolean reserveItinerary(Customer customer, String[] flights, String location, boolean car, boolean room)
          Reserve an itinerary
 Transaction start()
          Start a transaction return a unique transaction ID
 

Method Detail

reserveItinerary

boolean reserveItinerary(Customer customer,
                         String[] flights,
                         String location,
                         boolean car,
                         boolean room)
                         throws RemoteException
Reserve an itinerary

Parameters:
customer - the customer
flights - an integer array of flight numbers
location - travel location
car - true if car reservation is needed
room - true if a room reservation is needed
Returns:
true on success, false otherwise.
Throws:
RemoteException
See Also:
RM.reserve(Transaction, Customer, RID)

cancelItinerary

boolean cancelItinerary(Customer customer)
                        throws RemoteException
Cancel an itinerary owned by customer

Parameters:
customer - the customer
Returns:
true on success, false otherwise.
Throws:
RemoteException
See Also:
RM.unreserve(Transaction, Customer)

queryItinerary

String queryItinerary(Transaction context,
                      Customer customer)
                      throws RemoteException,
                             TransactionAbortedException,
                             InvalidTransactionException
Get the bill for the customer

Parameters:
context - the transaction ID
customer - the customer ID
Returns:
a string representation of reservations
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.queryReserved(Transaction, Customer)

queryItineraryPrice

int queryItineraryPrice(Transaction context,
                        Customer customer)
                        throws RemoteException,
                               TransactionAbortedException,
                               InvalidTransactionException
Get the total amount of money the customer owes

Parameters:
context - the transaction ID
customer - the customer ID
Returns:
total price of reservations
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.queryReserved(Transaction, Customer)

addSeats

boolean addSeats(Transaction context,
                 String flight,
                 int flightSeats,
                 int flightPrice)
                 throws RemoteException,
                        TransactionAbortedException,
                        InvalidTransactionException
Add seats to a flight This method will be used to create a new flight but if the flight already exists, seats will be added and the price overwritten

Parameters:
context - the transaction ID
flight - a flight number
flightSeats - the number of flight Seats
flightPrice - price per seat
Returns:
true on success, false otherwise.
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.add(Transaction, RID, int, int)

deleteSeats

boolean deleteSeats(Transaction context,
                    String flight,
                    int numSeats)
                    throws RemoteException,
                           TransactionAbortedException,
                           InvalidTransactionException
delete seats from a flight

Parameters:
context - the transaction ID
flight - a flight number
numSeats - the number of flight Seats
Returns:
true on success, false otherwise.
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.delete(Transaction,RID,int)

deleteFlight

boolean deleteFlight(Transaction context,
                     String flight)
                     throws RemoteException,
                            TransactionAbortedException,
                            InvalidTransactionException
Delete the entire flight. deleteFlight implies whole deletion of the flight, all seats, all reservations.

Parameters:
context - the transaction ID
flight - the flight number
Returns:
true on success, false otherwise.
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.delete(Transaction,RID)

addRooms

boolean addRooms(Transaction context,
                 String location,
                 int numRooms,
                 int price)
                 throws RemoteException,
                        TransactionAbortedException,
                        InvalidTransactionException
Add rooms to a location. This should look a lot like addFlight, only keyed on a string location instead of a flight number.

Parameters:
context - the transaction ID
location - the location to add rooms
numRooms - number of rooms to add
price - room price
Returns:
true on success, false otherwise.
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.add(Transaction, RID, int, int)

deleteRooms

boolean deleteRooms(Transaction context,
                    String location,
                    int numRooms)
                    throws RemoteException,
                           TransactionAbortedException,
                           InvalidTransactionException
Delete rooms.

Parameters:
context - the transaction ID
location - the location to add rooms
numRooms - the number of rooms to delete
Returns:
true on success, false otherwise.
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.delete(Transaction,RID,int)

addCars

boolean addCars(Transaction context,
                String location,
                int numCars,
                int price)
                throws RemoteException,
                       TransactionAbortedException,
                       InvalidTransactionException
Add cars to a location. This should look a lot like addFlight, only keyed on a string location instead of a flight number.

Parameters:
context - the transaction ID
location - the location to add cars
numCars - number of cars to add
price - rental price
Returns:
true on success, false otherwise.
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.add(Transaction, RID, int, int)

deleteCars

boolean deleteCars(Transaction context,
                   String location,
                   int numCars)
                   throws RemoteException,
                          TransactionAbortedException,
                          InvalidTransactionException
Delete cars.

Parameters:
context - the transaction ID
location - the location to add cars
numCars - the number of cars to delete
Returns:
true on success, false otherwise.
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.delete(Transaction,RID,int)

queryFlight

int queryFlight(Transaction context,
                String flight)
                throws RemoteException,
                       TransactionAbortedException,
                       InvalidTransactionException
Get the number of seats available. return the number of seats available

Parameters:
context - the transaction ID
flight - the flight number
Returns:
the number of seats available. negative value if the flight does not exists
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.query(Transaction, RID)

queryFlightPrice

int queryFlightPrice(Transaction context,
                     String flight)
                     throws RemoteException,
                            TransactionAbortedException,
                            InvalidTransactionException
Get the flight price. return the price

Parameters:
context - the transaction ID
flight - the flight number
Returns:
the price. Negative value if the flight does not exists
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.queryPrice(Transaction, RID)

queryRoom

int queryRoom(Transaction context,
              String location)
              throws RemoteException,
                     TransactionAbortedException,
                     InvalidTransactionException
Get the number of rooms available. return the number of rooms available

Parameters:
context - the transaction ID
location - the rooms location
Returns:
the number of rooms available
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.query(Transaction, RID)

queryRoomPrice

int queryRoomPrice(Transaction context,
                   String location)
                   throws RemoteException,
                          TransactionAbortedException,
                          InvalidTransactionException
Get the room price.

Parameters:
context - the transaction ID
location - the rooms location
Returns:
the price
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.queryPrice(Transaction, RID)

queryCar

int queryCar(Transaction context,
             String location)
             throws RemoteException,
                    TransactionAbortedException,
                    InvalidTransactionException
Get the number of cars available.

Parameters:
context - the transaction ID
location - the cars location
Returns:
the number of cars available
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.query(Transaction, RID)

queryCarPrice

int queryCarPrice(Transaction context,
                  String location)
                  throws RemoteException,
                         TransactionAbortedException,
                         InvalidTransactionException
Get the cars price.

Parameters:
context - the transaction ID
location - the cars location
Returns:
the price
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
RM.queryPrice(Transaction, RID)

listFlights

String[] listFlights(Transaction context)
                     throws RemoteException,
                            TransactionAbortedException,
                            InvalidTransactionException
list existing flights

Parameters:
context - transaction id
Returns:
list of existing flights
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
addSeats(Transaction, String, int, int), RM.listResources(Transaction, RID.Type)

listCars

String[] listCars(Transaction context)
                  throws RemoteException,
                         TransactionAbortedException,
                         InvalidTransactionException
list existing cars

Parameters:
context - transaction id
Returns:
list of existing cars
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
addCars(Transaction, String, int, int), RM.listResources(Transaction, RID.Type)

listRooms

String[] listRooms(Transaction context)
                   throws RemoteException,
                          TransactionAbortedException,
                          InvalidTransactionException
list existing rooms

Parameters:
context - transaction id
Returns:
list of existing rooms
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
addRooms(Transaction, String, int, int), RM.listResources(Transaction, RID.Type)

listCustomers

Customer[] listCustomers(Transaction context)
                         throws RemoteException,
                                TransactionAbortedException,
                                InvalidTransactionException
list existing customers that have itinerary

Parameters:
context - transaction id
Returns:
list of existing customers that have itineraries
Throws:
RemoteException
TransactionAbortedException
InvalidTransactionException
See Also:
reserveItinerary(Customer, String[], String, boolean, boolean), RM.listCustomers(Transaction)

start

Transaction start()
                  throws RemoteException
Start a transaction return a unique transaction ID

Returns:
a new transaction identifier
Throws:
RemoteException

commit

void commit(Transaction context)
            throws RemoteException,
                   InvalidTransactionException,
                   TransactionAbortedException
Commit a transaction

Parameters:
context - the transaction ID
Throws:
RemoteException
InvalidTransactionException
TransactionAbortedException

abort

void abort(Transaction context)
           throws RemoteException,
                  InvalidTransactionException
Abort a transaction

Parameters:
context - the transaction ID
Throws:
RemoteException
InvalidTransactionException