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:
- Accessing a Jolt server
- Automatic persistence of state between calls to the SessionBean
- The statefulness of this EJBean is the teller's name
and the current Transaction (if any)
- Application-defined exceptions
- Author:
- Copyright (c) 1999 by BEA WebXpress, Inc. All Rights Reserved.
-
tellerName
-
-
tellerTransaction
-
-
TellerBean()
-
-
balance(int)
- Returns the current balance for an Account.
-
begin()
- Begins a transaction.
-
commit()
- Commits the current transaction.
-
deposit(int, double)
- Deposits amount in account.
-
ejbActivate()
- Called when the EJBEan is activated.
-
ejbCreate(String)
- This method corresponds to the create method in the home interface
"TellerHome.java".
-
ejbPassivate()
- Called when the EJBEan is passivated.
-
ejbRemove()
- Called when the EJBean is removed.
-
getTellerName()
- Returns the name of this Teller.
-
rollback()
- Rolls back the current transaction.
-
setSessionContext(SessionContext)
- Sets the session context.
-
withdraw(int, double)
- Withdraws amount from account.
tellerName
public String tellerName
tellerTransaction
public Transaction tellerTransaction
TellerBean
public TellerBean()
ejbActivate
public void ejbActivate() throws RemoteException
- Called when the EJBEan is activated.
Establishes reference to Jolt session pool.
ejbRemove
public void ejbRemove()
- Called when the EJBean is removed.
Removes reference to Jolt session pool.
ejbPassivate
public void ejbPassivate()
- Called when the EJBEan is passivated.
Removes reference to Jolt session pool.
setSessionContext
public void setSessionContext(SessionContext ctx)
- Sets the session context.
- Parameters:
- ctx - SessionContext Context for session
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
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
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
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
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
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
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
getTellerName
public String getTellerName()
- Returns the name of this Teller.
- Returns:
- String tellerName
All Examples All Jolt Examples This Package