All Examples  All Cluster Examples  This Example  This Package

Class examples.cluster.ejb.teller.TellerBean

java.lang.Object
   |
   +----examples.cluster.ejb.teller.TellerBean

public class TellerBean
extends Object
implements SessionBean
TellerBean is a stateless SessionBean. This bean illustrates:

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

Constructor Index

 o TellerBean()

Method Index

 o balance(String)
Returns the balance of the account in a TellerResult object.
 o checkTransactionId(String)
Returns true if the transaction with a given id was completed (ie, the transaction ID can be found in the transaction log table).
 o deposit(String, double, String)
Deposits amount in specified account using a specific transactionID.
 o ejbActivate()
This method is required by the EJB Specification, but is not used by this example.
 o ejbCreate()
This method corresponds to the create method in the home interface "TellerHome.java".
 o ejbPassivate()
This method is required by the EJB Specification, but is not used by this example.
 o ejbRemove()
This method is required by the EJB Specification, but is not used by this example.
 o setSessionContext(SessionContext)
Sets the session context, server name, properties, maximum log table size and the log pool name.
 o transfer(String, String, double, String)
Transfers amount from accountFrom to accountTo using a specific transactionID.
 o withdraw(String, double, String)
Withdraws amount from specified account using a specific transactionID.

Constructors

 o TellerBean
 public TellerBean()

Methods

 o ejbActivate
 public void ejbActivate() throws RemoteException
This method is required by the EJB Specification, but is not used by this example.

 o ejbRemove
 public void ejbRemove() throws RemoteException
This method is required by the EJB Specification, but is not used by this example.

 o ejbPassivate
 public void ejbPassivate() throws RemoteException
This method is required by the EJB Specification, but is not used by this example.

 o setSessionContext
 public void setSessionContext(SessionContext ctx)
Sets the session context, server name, properties, maximum log table size and the log pool name.

Parameters:
ctx - SessionContext
 o ejbCreate
 public void ejbCreate()
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().

See Also:
Teller
 o balance
 public TellerResult balance(String accountId) throws TellerException, RemoteException
Returns the balance of the account in a TellerResult object.

Parameters:
accountId - String Account ID
Returns:
TellerResult Result of inquiry
Throws: TellerException
if there is an error while checking the balance
Throws: RemoteException
if there is a communications or systems failure
 o deposit
 public TellerResult deposit(String accountId,
                             double amount,
                             String transactionId) throws TellerException, RemoteException
Deposits amount in specified account using a specific transactionID.

Parameters:
accountId - String Account ID
amount - double Amount to deposit
transactionId - String Transaction ID
Returns:
TellerResult Result of inquiry
Throws: TellerException
if there is an error while making the deposit
Throws: RemoteException
if there is a communications or systems failure
 o withdraw
 public TellerResult withdraw(String accountId,
                              double amount,
                              String transactionId) throws TellerException, RemoteException
Withdraws amount from specified account using a specific transactionID.

Parameters:
accountId - String Account ID
amount - double Amount to withdraw
transactionId - String Transaction ID
Returns:
TellerResult Result of inquiry
Throws: TellerException
if there is an error while making the withdrawal
Throws: RemoteException
if there is a communications or systems failure
 o transfer
 public TellerResult transfer(String accountFrom,
                              String accountTo,
                              double amount,
                              String transactionId) throws TellerException, RemoteException
Transfers amount from accountFrom to accountTo using a specific transactionID.

Parameters:
accountFrom - String Account ID of account taking amount from
accountTo - String Account ID of account sending amount to
amount - double Amount to transfer
transactionId - String Transaction ID
Returns:
TellerResult Result of inquiry
Throws: TellerException
if there is an error while making the transfer
Throws: RemoteException
if there is a communications or systems failure
 o checkTransactionId
 public boolean checkTransactionId(String transactionId) throws RemoteException
Returns true if the transaction with a given id was completed (ie, the transaction ID can be found in the transaction log table).

Note that the code in this method is specific for Oracle databases and would require adjustment for other databases.

Parameters:
transactionID - String Transaction ID
Returns:
boolean
Throws: RemoteException
if there is a communications or systems failure

All Examples  All Cluster Examples  This Example  This Package