All Examples  All Jolt Examples  This Package

Class examples.jolt.ejb.bankapp.TellerBean

java.lang.Object
   |
   +----examples.jolt.ejb.bankapp.TellerBean

public class TellerBean
extends Object
implements SessionBean
TellerBean is a stateful SessionBean. This EJBean illustrates:

Author:
Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.

Variable Index

 o tellerName
 o tellerTransaction

Constructor Index

 o TellerBean()

Method Index

 o balance(int)
Returns the current balance for an Account.
 o begin()
Begins a transaction.
 o commit()
Commits the current transaction.
 o deposit(int, double)
Deposits amount in account.
 o ejbActivate()
Called when the EJBEan is activated.
 o ejbCreate(String)
This method corresponds to the create method in the home interface "TellerHome.java".
 o ejbPassivate()
Called when the EJBEan is passivated.
 o ejbRemove()
Called when the EJBean is removed.
 o getTellerName()
Returns the name of this Teller.
 o rollback()
Rolls back the current transaction.
 o setSessionContext(SessionContext)
Sets the session context.
 o withdraw(int, double)
Withdraws amount from account.

Variables

 o tellerName
 public String tellerName
 o tellerTransaction
 public Transaction tellerTransaction

Constructors

 o TellerBean
 public TellerBean()

Methods

 o ejbActivate
 public void ejbActivate() throws RemoteException
Called when the EJBEan is activated. Establishes reference to Jolt session pool.

 o ejbRemove
 public void ejbRemove()
Called when the EJBean is removed. Removes reference to Jolt session pool.

 o ejbPassivate
 public void ejbPassivate()
Called when the EJBEan is passivated. Removes reference to Jolt session pool.

 o setSessionContext
 public void setSessionContext(SessionContext ctx)
Sets the session context.

Parameters:
ctx - SessionContext Context for session
 o ejbCreate
 public void ejbCreate(String tellerName) throws CreateException
This method corresponds to the create method in the home interface "TellerHome.java". The parameter sets of the two methods are identical. When the client calls TellerHome.create(), the container allocates an instance of the EJBean and calls ejbCreate().

It sets the name of the Teller and then attempts to get a session from the Jolt session pool.

Parameters:
tellerName - String Teller name
Throws: CreateException
if there is an error while initializing the Jolt pool
See Also:
Teller
 o deposit
 public TellerResult deposit(int accountNumber,
                             double amount) throws ProcessingErrorException, TransactionErrorException
Deposits amount in account.

Parameters:
accountNumber - int Account number
amount - double Amount to deposit
Returns:
TellerResult Trade result
Throws: ProcessingErrorException
if there is an error making the deposit
Throws: TransactionErrorException
if there is an error making the deposit
 o withdraw
 public TellerResult withdraw(int accountNumber,
                              double amount) throws ProcessingErrorException, TransactionErrorException
Withdraws amount from account.

Parameters:
accountNumber - int Account number
amount - double Amount to withdraw
Returns:
TellerResult Trade result
Throws: ProcessingErrorException
if there is an error making the withdrawl
Throws: TransactionErrorException
if there is an error making the withdrawl
 o balance
 public TellerResult balance(int accountNumber) throws ProcessingErrorException, TransactionErrorException
Returns the current balance for an Account.

Parameters:
accountNumber - int Account number
Returns:
TellerResult Trade result
Throws: ProcessingErrorException
if there is an error retrieving the balance
Throws: TransactionErrorException
if there is an error retrieving the balance
 o begin
 public void begin() throws TransactionErrorException
Begins a transaction. If the bean already has a transaction, it is used and a new one is not started.

Returns:
TellerResult Trade result
Throws: TransactionErrorException
if there is an error beginning the transaction
 o commit
 public void commit() throws TransactionErrorException
Commits the current transaction.

Returns:
TellerResult Trade result
Throws: TransactionErrorException
if there is an error committing the transaction or there is no transaction to commit
 o rollback
 public void rollback() throws TransactionErrorException
Rolls back the current transaction.

Returns:
TellerResult Trade result
Throws: TransactionErrorException
if there is an error rolling back the transaction or there is no transaction to rollback
 o getTellerName
 public String getTellerName()
Returns the name of this Teller.

Returns:
String tellerName

All Examples  All Jolt Examples  This Package