JavaTransaction
Interface ClientInterface

All Superinterfaces:
java.rmi.Remote

public interface ClientInterface
extends java.rmi.Remote

An interface for interaction with the clients.

This interface is already implemented by class MyWC in package WC.

Class MyWC will eventually be transformed into a real workflow controller. Currently, class MyWC only redirects calls to MyRM: the implementation of the resource manager. If you wish that clients interact directly with your resource manager, make sure that your Resource Manager class implements this interface


Method Summary
 void abort(int context)
          Abort a transaction
 boolean addCars(int context, java.lang.String location, int numCars, int price)
          Add cars to a location.
 boolean addFlight(int context, int 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 addRooms(int context, java.lang.String location, int numRooms, int price)
          Add rooms to a location.
 void commit(int context)
          Commit a transaction
 boolean deleteCars(int context, java.lang.String location, int numCars)
          Delete cars.
 boolean deleteCustomer(int context, int customer)
          Delete a customer
 boolean deleteFlight(int context, int flight)
          Delete the entire flight.
 boolean deleteRooms(int context, java.lang.String location, int numRooms)
          Delete rooms.
 int newCustomer(int context)
          Create a customer return a unique customer ID
 int queryCars(int context, java.lang.String location)
          Get the number of cars available.
 int queryCarsPrice(int context, java.lang.String location)
          Get the cars price.
 int queryCustomer(int context, int customer)
          Get the total amount of money the customer owes return total price of all reservations
 java.lang.String queryCustomerInfo(int context, int customer)
          Get the bill for the customer return a string representation of reservations
 int queryFlight(int context, int flight)
          Get the number of seats available.
 int queryFlightPrice(int context, int flight)
          Get the flight price.
 int queryRooms(int context, java.lang.String location)
          Get the number of rooms available.
 int queryRoomsPrice(int context, java.lang.String location)
          Get the room price.
 boolean reserveCar(int context, int customer, java.lang.String location)
          Reserve a car
 boolean reserveFlight(int context, int customer, int flight)
          Reserve a seat on a flight
 boolean reserveItinerary(int customer, int[] flights, java.lang.String location, boolean bCar, boolean bRoom)
          Reserve an itinerary
 boolean reserveRoom(int context, int customer, java.lang.String location)
          Reserve a room
 int start()
          Start a transaction return a unique transaction ID
 

Method Detail

start

public int start()
          throws java.rmi.RemoteException
Start a transaction return a unique transaction ID

Returns:
unique transaction ID
java.rmi.RemoteException

commit

public void commit(int context)
            throws java.rmi.RemoteException
Commit a transaction

java.rmi.RemoteException

abort

public void abort(int context)
           throws java.rmi.RemoteException
Abort a transaction

java.rmi.RemoteException

addFlight

public boolean addFlight(int context,
                         int flight,
                         int flightSeats,
                         int flightPrice)
                  throws java.rmi.RemoteException,
                         JavaTransaction.TransactionAbortedException,
                         JavaTransaction.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

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

deleteFlight

public boolean deleteFlight(int context,
                            int flight)
                     throws java.rmi.RemoteException,
                            JavaTransaction.TransactionAbortedException,
                            JavaTransaction.InvalidTransactionException
Delete the entire flight. deleteFlight implies whole deletion of the flight. all seats, all reservations. It's undecided what will happen if a customer has a reservation on this flight, but one possibility is to delete the customer as well. The other possibility is to return failure.

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

addCars

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

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

deleteCars

public boolean deleteCars(int context,
                          java.lang.String location,
                          int numCars)
                   throws java.rmi.RemoteException,
                          JavaTransaction.TransactionAbortedException,
                          JavaTransaction.InvalidTransactionException
Delete cars.

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

addRooms

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

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

deleteRooms

public boolean deleteRooms(int context,
                           java.lang.String location,
                           int numRooms)
                    throws java.rmi.RemoteException,
                           JavaTransaction.TransactionAbortedException,
                           JavaTransaction.InvalidTransactionException
Delete rooms.

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

queryFlight

public int queryFlight(int context,
                       int flight)
                throws java.rmi.RemoteException,
                       JavaTransaction.TransactionAbortedException,
                       JavaTransaction.InvalidTransactionException
Get the number of seats available. return the number of seats available

Returns:
the number of seats available
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

queryFlightPrice

public int queryFlightPrice(int context,
                            int flight)
                     throws java.rmi.RemoteException,
                            JavaTransaction.TransactionAbortedException,
                            JavaTransaction.InvalidTransactionException
Get the flight price. return the price

Returns:
the price
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

queryRooms

public int queryRooms(int context,
                      java.lang.String location)
               throws java.rmi.RemoteException,
                      JavaTransaction.TransactionAbortedException,
                      JavaTransaction.InvalidTransactionException
Get the number of rooms available. return the number of rooms available

Returns:
the number of rooms available
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

queryRoomsPrice

public int queryRoomsPrice(int context,
                           java.lang.String location)
                    throws java.rmi.RemoteException,
                           JavaTransaction.TransactionAbortedException,
                           JavaTransaction.InvalidTransactionException
Get the room price.

Returns:
the price
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

queryCars

public int queryCars(int context,
                     java.lang.String location)
              throws java.rmi.RemoteException,
                     JavaTransaction.TransactionAbortedException,
                     JavaTransaction.InvalidTransactionException
Get the number of cars available.

Returns:
the number of cars available
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

queryCarsPrice

public int queryCarsPrice(int context,
                          java.lang.String location)
                   throws java.rmi.RemoteException,
                          JavaTransaction.TransactionAbortedException,
                          JavaTransaction.InvalidTransactionException
Get the cars price.

Returns:
the price
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

newCustomer

public int newCustomer(int context)
                throws java.rmi.RemoteException
Create a customer return a unique customer ID

Returns:
a unique customer ID
java.rmi.RemoteException

deleteCustomer

public boolean deleteCustomer(int context,
                              int customer)
                       throws java.rmi.RemoteException,
                              JavaTransaction.TransactionAbortedException,
                              JavaTransaction.InvalidTransactionException
Delete a customer

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

reserveFlight

public boolean reserveFlight(int context,
                             int customer,
                             int flight)
                      throws java.rmi.RemoteException,
                             JavaTransaction.TransactionAbortedException,
                             JavaTransaction.InvalidTransactionException
Reserve a seat on a flight

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

reserveCar

public boolean reserveCar(int context,
                          int customer,
                          java.lang.String location)
                   throws java.rmi.RemoteException,
                          JavaTransaction.TransactionAbortedException,
                          JavaTransaction.InvalidTransactionException
Reserve a car

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

reserveRoom

public boolean reserveRoom(int context,
                           int customer,
                           java.lang.String location)
                    throws java.rmi.RemoteException,
                           JavaTransaction.TransactionAbortedException,
                           JavaTransaction.InvalidTransactionException
Reserve a room

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

reserveItinerary

public boolean reserveItinerary(int customer,
                                int[] flights,
                                java.lang.String location,
                                boolean bCar,
                                boolean bRoom)
                         throws java.rmi.RemoteException,
                                JavaTransaction.TransactionAbortedException,
                                JavaTransaction.InvalidTransactionException
Reserve an itinerary

Returns:
success
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException

queryCustomer

public int queryCustomer(int context,
                         int customer)
                  throws java.rmi.RemoteException
Get the total amount of money the customer owes return total price of all reservations

Returns:
total price of reservations
java.rmi.RemoteException

queryCustomerInfo

public java.lang.String queryCustomerInfo(int context,
                                          int customer)
                                   throws java.rmi.RemoteException,
                                          JavaTransaction.TransactionAbortedException,
                                          JavaTransaction.InvalidTransactionException
Get the bill for the customer return a string representation of reservations

Returns:
a string representation of reservations
java.rmi.RemoteException
JavaTransaction.TransactionAbortedException
JavaTransaction.InvalidTransactionException