org.objectweb.jass.examples.travelagency.ejbs
Class HotelBean

java.lang.Object
  extended byorg.objectweb.jass.examples.travelagency.ejbs.HotelBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

public class HotelBean
extends java.lang.Object
implements javax.ejb.SessionBean

Makes the rooms reservation. It creates a ONT activity through the OpenNested service when methods that perform db changes are invoked (reserveRooms(), unreserveRooms()).

Author:
fran Date: Feb 16, 2004 org.objectweb.jass.examples.travelagency.ejbsHotelBean.java
See Also:
Serialized Form

Constructor Summary
HotelBean()
           
 
Method Summary
 void ejbActivate()
           
 void ejbCreate()
           
 void ejbPassivate()
           
 void ejbRemove()
           
 int getFreeRooms()
          Obtains the number of free rooms.
 int reserveRooms(int nRooms)
          Performs the rooms reservation.
 void setSessionContext(javax.ejb.SessionContext sessionContext)
           
 int unreserveRooms(int nRooms)
          Performs the compensation for the reserveRooms() operation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HotelBean

public HotelBean()
Method Detail

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Throws:
javax.ejb.CreateException

ejbActivate

public void ejbActivate()
                 throws javax.ejb.EJBException
Specified by:
ejbActivate in interface javax.ejb.SessionBean
Throws:
javax.ejb.EJBException

ejbPassivate

public void ejbPassivate()
                  throws javax.ejb.EJBException
Specified by:
ejbPassivate in interface javax.ejb.SessionBean
Throws:
javax.ejb.EJBException

ejbRemove

public void ejbRemove()
               throws javax.ejb.EJBException
Specified by:
ejbRemove in interface javax.ejb.SessionBean
Throws:
javax.ejb.EJBException

setSessionContext

public void setSessionContext(javax.ejb.SessionContext sessionContext)
                       throws javax.ejb.EJBException
Specified by:
setSessionContext in interface javax.ejb.SessionBean
Throws:
javax.ejb.EJBException

getFreeRooms

public int getFreeRooms()
                 throws java.sql.SQLException
Obtains the number of free rooms.

Returns:
- the number of free rooms.
Throws:
java.sql.SQLException

reserveRooms

public int reserveRooms(int nRooms)
                 throws NotEnoughRoomsException,
                        java.sql.SQLException
Performs the rooms reservation. If there are not enough rooms, it throws the NotEnoughRoomsException.

Parameters:
nRooms - - number of rooms to reserve.
Returns:
Throws:
NotEnoughRoomsException - - thown if there are not enough rooms.
java.sql.SQLException

unreserveRooms

public int unreserveRooms(int nRooms)
                   throws java.sql.SQLException
Performs the compensation for the reserveRooms() operation.

Parameters:
nRooms - - the number of rooms to cancel.
Returns:
Throws:
java.sql.SQLException