| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttp.impl.CSEP545ServiceObject
tp.impl.MyWC
public class MyWC
Your Workflow Controller. Rudimentary implementation is provided for your convenience.
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from interface tp.impl.CSEP545Service | 
|---|
| CSEP545Service.Type | 
| Field Summary | 
|---|
| Fields inherited from class tp.impl.CSEP545ServiceObject | 
|---|
| dir, registry, svcid | 
| Constructor Summary | |
|---|---|
| MyWC() | |
| 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 | 
| protected  void | init(String[] args)IMPLEMENT THIS METHOD process command line parameters and setup any parameterized values. | 
| protected  void | initStorage()IMPLEMENT THIS METHOD Initialize necessary data files. | 
|  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 customerowes | 
|  int | queryRoom(Transaction context,
          String location)Get the number of rooms available. | 
|  int | queryRoomPrice(Transaction context,
               String location)Get the room price. | 
| protected  void | readyToServe()IMPLEMENT THIS METHOD Bootstrapping completed and the server is up and running. | 
| protected  void | recovery()IMPLEMENT THIS METHOD Run recovery algorithm and reconstruct the state of service before failure. | 
|  void | refresh()IMPLEMENT THIS METHOD if you want to implement a different service architecture. | 
|  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 | 
| protected  void | startUp()IMPLEMENT THIS METHOD If you use extra threads in your service, start them in this method. | 
| Methods inherited from class tp.impl.CSEP545ServiceObject | 
|---|
| getDataRoot, getServiceID, kill, lookupRemote, lookupRemote, lookupRemote, lookupRemote, main, shutdown | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public MyWC()
| Method Detail | 
|---|
public boolean reserveItinerary(Customer customer,
                                String[] flights,
                                String location,
                                boolean car,
                                boolean room)
                         throws RemoteException
WC
reserveItinerary in interface WCcustomer - the customerflights - an integer array of flight numberslocation - travel locationcar - true if car reservation is neededroom - true if a room reservation is needed
true on success, false otherwise.
RemoteExceptionRM.reserve(Transaction, Customer, RID)
public boolean cancelItinerary(Customer customer)
                        throws RemoteException
WCcustomer
cancelItinerary in interface WCcustomer - the customer
true on success, false otherwise.
RemoteExceptionRM.unreserve(Transaction, Customer)
public int queryItineraryPrice(Transaction context,
                               Customer customer)
                        throws RemoteException,
                               TransactionAbortedException,
                               InvalidTransactionException
WCcustomer owes
queryItineraryPrice in interface WCcontext - the transaction IDcustomer - the customer ID
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.queryReserved(Transaction, Customer)
public String queryItinerary(Transaction context,
                             Customer customer)
                      throws RemoteException,
                             TransactionAbortedException,
                             InvalidTransactionException
WCcustomer
queryItinerary in interface WCcontext - the transaction IDcustomer - the customer ID
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.queryReserved(Transaction, Customer)
public boolean addSeats(Transaction context,
                        String flight,
                        int flightSeats,
                        int flightPrice)
                 throws RemoteException,
                        TransactionAbortedException,
                        InvalidTransactionException
WC
addSeats in interface WCcontext - the transaction IDflight - a flight numberflightSeats - the number of  flight SeatsflightPrice - price per seat
true on success, false otherwise.
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.add(Transaction, RID, int, int)
public boolean deleteSeats(Transaction context,
                           String flight,
                           int numSeats)
                    throws RemoteException,
                           TransactionAbortedException,
                           InvalidTransactionException
WCflight
deleteSeats in interface WCcontext - the transaction IDflight - a flight numbernumSeats - the number of  flight Seats
true on success, false otherwise.
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.delete(Transaction,RID,int)
public boolean deleteFlight(Transaction context,
                            String flight)
                     throws RemoteException,
                            TransactionAbortedException,
                            InvalidTransactionException
WC
deleteFlight in interface WCcontext - the transaction IDflight - the flight number
true on success, false otherwise.
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.delete(Transaction,RID)
public boolean addRooms(Transaction context,
                        String location,
                        int numRooms,
                        int price)
                 throws RemoteException,
                        TransactionAbortedException,
                        InvalidTransactionException
WC
addRooms in interface WCcontext - the transaction IDlocation - the location to add roomsnumRooms - number of rooms to addprice - room price
true on success, false otherwise.
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.add(Transaction, RID, int, int)
public boolean deleteRooms(Transaction context,
                           String location,
                           int numRooms)
                    throws RemoteException,
                           TransactionAbortedException,
                           InvalidTransactionException
WC
deleteRooms in interface WCcontext - the transaction IDlocation - the location to add roomsnumRooms - the number of rooms to delete
true on success, false otherwise.
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.delete(Transaction,RID,int)
public boolean addCars(Transaction context,
                       String location,
                       int numCars,
                       int price)
                throws RemoteException,
                       TransactionAbortedException,
                       InvalidTransactionException
WC
addCars in interface WCcontext - the transaction IDlocation - the location to add carsnumCars - number of cars to addprice - rental price
true on success, false otherwise.
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.add(Transaction, RID, int, int)
public boolean deleteCars(Transaction context,
                          String location,
                          int numCars)
                   throws RemoteException,
                          TransactionAbortedException,
                          InvalidTransactionException
WC
deleteCars in interface WCcontext - the transaction IDlocation - the location to add carsnumCars - the number of cars to delete
true on success, false otherwise.
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.delete(Transaction,RID,int)
public int queryFlight(Transaction context,
                       String flight)
                throws RemoteException,
                       TransactionAbortedException,
                       InvalidTransactionException
WC
queryFlight in interface WCcontext - the transaction IDflight - the flight number
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.query(Transaction, RID)
public int queryFlightPrice(Transaction context,
                            String flight)
                     throws RemoteException,
                            TransactionAbortedException,
                            InvalidTransactionException
WC
queryFlightPrice in interface WCcontext - the transaction IDflight - the flight number
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.queryPrice(Transaction, RID)
public int queryRoom(Transaction context,
                     String location)
              throws RemoteException,
                     TransactionAbortedException,
                     InvalidTransactionException
WC
queryRoom in interface WCcontext - the transaction IDlocation - the rooms location
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.query(Transaction, RID)
public int queryRoomPrice(Transaction context,
                          String location)
                   throws RemoteException,
                          TransactionAbortedException,
                          InvalidTransactionException
WC
queryRoomPrice in interface WCcontext - the transaction IDlocation - the rooms location
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.queryPrice(Transaction, RID)
public int queryCar(Transaction context,
                    String location)
             throws RemoteException,
                    TransactionAbortedException,
                    InvalidTransactionException
WC
queryCar in interface WCcontext - the transaction IDlocation - the cars location
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.query(Transaction, RID)
public int queryCarPrice(Transaction context,
                         String location)
                  throws RemoteException,
                         TransactionAbortedException,
                         InvalidTransactionException
WC
queryCarPrice in interface WCcontext - the transaction IDlocation - the cars location
RemoteException
TransactionAbortedException
InvalidTransactionExceptionRM.queryPrice(Transaction, RID)
public String[] listFlights(Transaction context)
                     throws RemoteException,
                            TransactionAbortedException,
                            InvalidTransactionException
WC
listFlights in interface WCcontext - transaction id
RemoteException
TransactionAbortedException
InvalidTransactionExceptionWC.addSeats(Transaction, String, int, int), 
RM.listResources(Transaction, RID.Type)
public String[] listCars(Transaction context)
                  throws RemoteException,
                         TransactionAbortedException,
                         InvalidTransactionException
WC
listCars in interface WCcontext - transaction id
RemoteException
TransactionAbortedException
InvalidTransactionExceptionWC.addCars(Transaction, String, int, int), 
RM.listResources(Transaction, RID.Type)
public String[] listRooms(Transaction context)
                   throws RemoteException,
                          TransactionAbortedException,
                          InvalidTransactionException
WC
listRooms in interface WCcontext - transaction id
RemoteException
TransactionAbortedException
InvalidTransactionExceptionWC.addRooms(Transaction, String, int, int), 
RM.listResources(Transaction, RID.Type)
public Customer[] listCustomers(Transaction context)
                         throws RemoteException,
                                TransactionAbortedException,
                                InvalidTransactionException
WC
listCustomers in interface WCcontext - transaction id
RemoteException
TransactionAbortedException
InvalidTransactionExceptionWC.reserveItinerary(Customer, String[], String, boolean, boolean), 
RM.listCustomers(Transaction)
public Transaction start()
                  throws RemoteException
WC
start in interface WCRemoteException
public void commit(Transaction context)
            throws RemoteException,
                   InvalidTransactionException,
                   TransactionAbortedException
WC
commit in interface WCcontext - the transaction ID
RemoteException
InvalidTransactionException
TransactionAbortedException
public void abort(Transaction context)
           throws RemoteException,
                  InvalidTransactionException
WC
abort in interface WCcontext - the transaction ID
RemoteException
InvalidTransactionException
protected void init(String[] args)
             throws Exception
CSEP545ServiceObject
init in class CSEP545ServiceObjectargs - command line arguments except common arguments
Exception
protected void initStorage()
                    throws Exception
CSEP545ServiceObjectRM
 and commit log file for TM
initStorage in class CSEP545ServiceObjectException
protected void recovery()
                 throws Exception
CSEP545ServiceObject
recovery in class CSEP545ServiceObjectException
protected void startUp()
                throws Exception
CSEP545ServiceObject
startUp in class CSEP545ServiceObjectException
protected void readyToServe()
                     throws Exception
CSEP545ServiceObject
readyToServe in class CSEP545ServiceObjectException
public void refresh()
             throws RemoteException,
                    NotBoundException
refresh in interface CSEP545ServiceRemoteException
NotBoundException| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||