| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface RM
Resource Manager Interface
| Method Summary | |
|---|---|
|  void | abort(Transaction xid)abort transaction | 
|  boolean | add(Transaction xid,
    RID resource,
    int qty,
    int price)add qtyitems described byresource. | 
|  void | commit(Transaction xid)commit transaction | 
|  boolean | delete(Transaction xid,
       RID resource)Drop resourcefrom this RM. | 
|  boolean | delete(Transaction xid,
       RID resource,
       int qty)Remove exactly qtyunreservedresourcefrom this RM. | 
|  String | getName()get the name of this RM | 
|  Customer[] | listCustomers(Transaction context)list of customers who reserve resources managed by this RM | 
|  String[] | listResources(Transaction context,
              RID.Type type)list of resources | 
|  int | query(Transaction xid,
      RID resource)query: equivalent to queryCars, queryFlights, queryRooms | 
|  int | queryPrice(Transaction xid,
           RID resource)query: equivalent to queryCarsPrice, queryFlightsPrice, queryRoomsPrice | 
|  String | queryReserved(Transaction context,
              Customer customer)Get the bill for the customerreturn a string representation of reservations | 
|  int | queryReservedPrice(Transaction context,
                   Customer customer)Get the total amount of money the customerowes
 in this RM. | 
|  boolean | reserve(Transaction context,
        Customer customer,
        RID resource)reserve a resource ion behalf of customerc | 
|  void | selfDestruct(int diskWritesToWait)Exit (simulate a failure) after a specified number of disk writes. | 
|  void | unreserve(Transaction context,
          Customer customer)drop all reserved resources for customer customer | 
| Method Detail | 
|---|
String getName()
               throws RemoteException
RemoteException
void commit(Transaction xid)
            throws InvalidTransactionException,
                   TransactionAbortedException,
                   RemoteException
xid - transaction identifier
InvalidTransactionException
TransactionAbortedException
RemoteException
void abort(Transaction xid)
           throws RemoteException
xid - transaction identifier
RemoteException
boolean add(Transaction xid,
            RID resource,
            int qty,
            int price)
            throws TransactionAbortedException,
                   InvalidTransactionException,
                   RemoteException
qty items described by resource. 
 If resource does not exist in the RM, create a new one.
xid - transaction identifierresource - resource identifierqty - quantity (seats, cars, rooms)price - price per unit
true on success. false otherwise
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.addSeats(Transaction, String, int, int), 
WC.addCars(Transaction, String, int, int), 
WC.addRooms(Transaction, String, int, int)
boolean delete(Transaction xid,
               RID resource)
               throws TransactionAbortedException,
                      InvalidTransactionException,
                      RemoteException
resource from this RM.
 All reservations on resource must be dropped as well.
xid - transaction identifierresource - resource identifier
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.deleteFlight(Transaction, String)
boolean delete(Transaction xid,
               RID resource,
               int qty)
               throws TransactionAbortedException,
                      InvalidTransactionException,
                      RemoteException
qty unreserved resource from this RM.
xid - transaction identifierresource - resource identifierqty - number of resource to remove. -1 removes all remaining
true on successful deletion.
 If there is no such resource, return true.
 false otherwise.
 If there are not enough qty to remove, return false.
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.deleteSeats(Transaction, String, int), 
WC.deleteCars(Transaction, String, int), 
WC.deleteRooms(Transaction, String, int)
int query(Transaction xid,
          RID resource)
          throws TransactionAbortedException,
                 InvalidTransactionException,
                 RemoteException
xid - transaction identifierresource - resource identifier
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.queryCar(Transaction, String), 
WC.queryRoom(Transaction, String), 
WC.queryFlight(Transaction, String)
int queryPrice(Transaction xid,
               RID resource)
               throws TransactionAbortedException,
                      InvalidTransactionException,
                      RemoteException
xid - transaction identifierresource - resource identifier
resource
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.queryCarPrice(Transaction, String), 
WC.queryRoomPrice(Transaction, String), 
WC.queryFlightPrice(Transaction, String)
String queryReserved(Transaction context,
                     Customer customer)
                     throws TransactionAbortedException,
                            InvalidTransactionException,
                            RemoteException
customer
 return a string representation of reservations
context - the transaction IDcustomer - the customer ID
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.queryItinerary(Transaction, Customer)
int queryReservedPrice(Transaction context,
                       Customer customer)
                       throws TransactionAbortedException,
                              InvalidTransactionException,
                              RemoteException
customer owes
 in this RM.
context - the transaction IDcustomer - the customer ID
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.queryItineraryPrice(Transaction, Customer)
boolean reserve(Transaction context,
                Customer customer,
                RID resource)
                throws TransactionAbortedException,
                       InvalidTransactionException,
                       RemoteException
i on behalf of customer c
context - the transaction IDcustomer - the customer IDresource - resource to reserve
true on successful reservation. false otherwise.
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.reserveItinerary(Customer, String[], String, boolean, boolean)
void unreserve(Transaction context,
               Customer customer)
               throws TransactionAbortedException,
                      InvalidTransactionException,
                      RemoteException
customer
context - the transaction IDcustomer - the customer ID
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.cancelItinerary(Customer)
String[] listResources(Transaction context,
                       RID.Type type)
                       throws TransactionAbortedException,
                              InvalidTransactionException,
                              RemoteException
context - type - listing resource type
resource name ',' available quantity ',' price
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.listCars(Transaction), 
WC.listFlights(Transaction), 
WC.listRooms(Transaction)
Customer[] listCustomers(Transaction context)
                         throws TransactionAbortedException,
                                InvalidTransactionException,
                                RemoteException
context - the transaction ID
TransactionAbortedException
InvalidTransactionException
RemoteExceptionWC.listCustomers(Transaction)
void selfDestruct(int diskWritesToWait)
                  throws RemoteException
diskWritesToWait - number of disk writes to wait until terminate
RemoteException| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||