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 tellerName
-  
  
-   tellerTransaction tellerTransaction
-  
   
  -   TellerBean() TellerBean()
-  
   
  -   balance(int) balance(int)
-   Returns the current balance for an Account.
  
-   begin() begin()
-   Begins a transaction.
  
-   commit() commit()
-   Commits the current transaction.
  
-   deposit(int, double) deposit(int, double)
-   Deposits amount in account.
  
-   ejbActivate() ejbActivate()
-   Called when the EJBEan is activated.
  
-   ejbCreate(String) ejbCreate(String)
-   This method corresponds to the create method in the home interface
 "TellerHome.java".
  
-   ejbPassivate() ejbPassivate()
-   Called when the EJBEan is passivated.
  
-   ejbRemove() ejbRemove()
-   Called when the EJBean is removed.
  
-   getTellerName() getTellerName()
-   Returns the name of this Teller.
  
-   rollback() rollback()
-   Rolls back the current transaction.
  
-   setSessionContext(SessionContext) setSessionContext(SessionContext)
-   Sets the session context.
  
-   withdraw(int, double) withdraw(int, double)
-   Withdraws amount from account.
   
 tellerName
tellerName
 public String tellerName
 tellerTransaction
tellerTransaction
 public Transaction tellerTransaction
   
 TellerBean
TellerBean
 public TellerBean()
   
 ejbActivate
ejbActivate
 public void ejbActivate() throws RemoteException
  -  Called when the EJBEan is activated.
 Establishes reference to Jolt session pool.
 
 ejbRemove
ejbRemove
 public void ejbRemove()
  -  Called when the EJBean is removed.
 Removes reference to Jolt session pool.
 
 ejbPassivate
ejbPassivate
 public void ejbPassivate()
  -  Called when the EJBEan is passivated.
 Removes reference to Jolt session pool.
 
 setSessionContext
setSessionContext
 public void setSessionContext(SessionContext ctx)
  -  Sets the session context.
   
- 
    -  Parameters:
    
-  ctx - SessionContext Context for session
  
 
 ejbCreate
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 callsejbCreate().
 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
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
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
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
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
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
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
getTellerName
 public String getTellerName()
  -  Returns the name of this Teller.
   
- 
    -  Returns:
    
-  String tellerName
  
 
All Examples  All Jolt Examples  This Package