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

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

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

Makes the seats reservation. It creates a ONT activity through the OpenNested service when methods that perform db changes are invoked (reserveSeats(), unreserveSeats()).

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

Constructor Summary
AirlineBean()
           
 
Method Summary
 void ejbActivate()
           
 void ejbCreate()
           
 void ejbPassivate()
           
 void ejbRemove()
           
 int getFreeSeats()
          Obtains the number of free seats.
 int reserveSeats(int nSeats)
          Performs the seats reservation.
 void setSessionContext(javax.ejb.SessionContext sessionContext)
           
 int unreserveSeats(int nSeats)
          Performs the compensation for the reserveSeats() operation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AirlineBean

public AirlineBean()
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

getFreeSeats

public int getFreeSeats()
                 throws java.sql.SQLException
Obtains the number of free seats.

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

reserveSeats

public int reserveSeats(int nSeats)
                 throws NotEnoughSeatsException,
                        java.sql.SQLException
Performs the seats reservation. If there are not enough seats, it throws the NotEnoughSeatsException.

Parameters:
nSeats - - the number of seats to reserve.
Returns:
Throws:
NotEnoughSeatsException - - thown if there are not enough seats.
java.sql.SQLException

unreserveSeats

public int unreserveSeats(int nSeats)
                   throws java.sql.SQLException
Performs the compensation for the reserveSeats() operation.

Parameters:
nSeats - - the number of seats to cancel.
Returns:
Throws:
java.sql.SQLException