|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ITravelAgency
This interface describes the booking system of a travel agency. A travel agency uses several autonomous resource managers to book an itinerary. This interface defines an agency that can book hotels, flights and rental cars. An implementation must use a separate resource manager for each booking type. That is, one RM is responsible for hotels, one for flights and another one for rental cars. Transactions are started implicitly by calling one of the RMs. At most one transaction is active in one TravelAgency terminal. However, there may exist more than one TravelAgency terminal in parallel. Each transaction started implicitly by a travel agency terminal is always a distributed transaction. Use the transaction manager's begin() method to retrieve a unique global ID for the distributed transaction. Use the RM.beginDistributed(int globalXID) method to start an new subtransaction.
Method Summary | |
---|---|
boolean |
abort()
Abort the current transaction. |
boolean |
addResource(ResourceType resourceType,
int xid,
java.lang.String rid,
int num,
int price)
Add a new resource (e.g. hotel) to the database. |
boolean |
commit()
Commit the current transaction. |
boolean |
newCustomer(ResourceType resourceType,
int xid,
java.lang.String custName)
Add a new customer to the database. |
int |
queryAvailability(ResourceType resourceType,
java.lang.String rid)
Query the availability of a resource. |
int |
queryBill(java.lang.String customerName)
Calculate the bill for a certain customer. |
int |
queryPrice(ResourceType resourceType,
java.lang.String rid)
Query the price of a resource. |
boolean |
reserve(ResourceType resourceType,
java.lang.String rid,
java.lang.String customerName)
Reserve a resource. |
boolean |
reserveItinerary(java.lang.String hotelName,
java.lang.String flightNumber,
java.lang.String agencyName,
java.lang.String customerName)
Convenience method for reserving a whole itinerary. |
boolean |
updateResource(ResourceType resourceType,
int xid,
java.lang.String rid,
int num,
int price)
Update the attributes (total capacity and price) of a resource. |
Method Detail |
---|
boolean reserve(ResourceType resourceType, java.lang.String rid, java.lang.String customerName)
resourceType
- the type of resource (e.g. HOTEL)rid
- the unique name of the hotelcustomerName
- the unique customer name
boolean reserveItinerary(java.lang.String hotelName, java.lang.String flightNumber, java.lang.String agencyName, java.lang.String customerName)
hotelName
- the unique hotel nameflightNumber
- the unique flight numberagencyName
- the unique name of the car rental agencycustomerName
- the unique customer name
int queryPrice(ResourceType resourceType, java.lang.String rid)
resourceType
- the type of resource (e.g. HOTEL)rid
- the unique name of the resource
int queryAvailability(ResourceType resourceType, java.lang.String rid)
resourceType
- the type of resource (e.g. HOTEL)rid
- the unique name of the resource
int queryBill(java.lang.String customerName)
customerName
- the unique customer name
boolean newCustomer(ResourceType resourceType, int xid, java.lang.String custName)
resourceType
- the type of resource (e.g. HOTEL)xid
- the id of the transaction requesting this operationcustName
- the unique customer name
boolean addResource(ResourceType resourceType, int xid, java.lang.String rid, int num, int price)
resourceType
- the type of resource (e.g. HOTEL)xid
- the id of the transaction requesting this operationrid
- the unique identifier of the resource which is to be added (e.g. HotelA)num
- the total capacity of this resourceprice
- the price a customer needs to pay for reserving this resource
boolean updateResource(ResourceType resourceType, int xid, java.lang.String rid, int num, int price)
resourceType
- the type of resource (e.g. HOTEL)xid
- the id of the transaction requesting this operationrid
- the unique identifier of the resource which is to be added (e.g. HotelA)num
- a number indicating the change in total capacity, negative numbers decrease
capacity, positive values increase capacityprice
- the price a customer needs to pay for reserving this resource
boolean commit() throws TransactionAbortedException, InvalidTransactionException
InvalidTransactionException
TransactionAbortedException
boolean abort() throws TransactionAbortedException, InvalidTransactionException
TransactionAbortedException
InvalidTransactionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |