|
WebLogic Server 6.0 Code Examples, BEA Systems, Inc. | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--examples.cluster.ejb.teller.TellerBean
TellerBean is a stateless SessionBean. This bean illustrates:
Inner Class Summary | |
(package private) class |
TellerBean.Balance
Performs a balance lookup. |
(package private) class |
TellerBean.Deposit
Performs a deposit. |
(package private) class |
TellerBean.Transaction
Inner class that is used for transactions with the entity beans. |
(package private) class |
TellerBean.Transfer
Performs a transfer. |
(package private) class |
TellerBean.Withdrawal
Performs a withdrawl. |
Field Summary | |
(package private) static int |
SLEEP
|
(package private) static boolean |
VERBOSE
|
Constructor Summary | |
TellerBean()
|
Method Summary | |
TellerResult |
balance(java.lang.String accountId)
Returns the balance of the account in a TellerResult object. |
boolean |
checkTransactionId(java.lang.String transactionId)
Returns true if the transaction with a given ID was completed (i.e., the transaction ID can be found in the transaction log table). |
TellerResult |
deposit(java.lang.String accountId,
double amount,
java.lang.String transactionId)
Deposits amount in specified account using a specific transactionID. |
void |
ejbActivate()
This method is required by the EJB Specification, but is not used by this example. |
void |
ejbCreate()
This method corresponds to the create method in the home interface "TellerHome.java". |
void |
ejbPassivate()
This method is required by the EJB Specification, but is not used by this example. |
void |
ejbRemove()
This method is required by the EJB Specification, but is not used by this example. |
void |
setSessionContext(javax.ejb.SessionContext ctx)
Sets the session context, server name, properties, maximum log table size and the log pool name. |
TellerResult |
transfer(java.lang.String accountFrom,
java.lang.String accountTo,
double amount,
java.lang.String transactionId)
Transfers amount from accountFrom to accountTo using a specific transactionID. |
TellerResult |
withdraw(java.lang.String accountId,
double amount,
java.lang.String transactionId)
Withdraws amount from a specified account using a specific transactionID. |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final int SLEEP
static final boolean VERBOSE
Constructor Detail |
public TellerBean()
Method Detail |
public TellerResult balance(java.lang.String accountId) throws TellerException, java.rmi.RemoteException
accountId
- string account IDTellerException
- if there is an error while checking the balancejava.rmi.RemoteException
- if there is a communications or systems failurepublic boolean checkTransactionId(java.lang.String transactionId) throws java.rmi.RemoteException
Note that the code in this method is specific for Oracle databases and would require adjustment for other databases.
transactionID
- string transaction IDjava.rmi.RemoteException
- if there is
a communications or systems failurepublic TellerResult deposit(java.lang.String accountId, double amount, java.lang.String transactionId) throws TellerException, java.rmi.RemoteException
accountId
- string account IDamount
- double amount to deposittransactionId
- string transaction IDTellerException
- if there is an error while making the depositjava.rmi.RemoteException
- if there is a communications or systems failurepublic void ejbActivate()
ejbActivate
in interface javax.ejb.SessionBean
public void ejbCreate() throws javax.ejb.CreateException
TellerHome.create()
, the container allocates an instance of
the EJBean and calls ejbCreate()
.javax.ejb.CreateException
- if there is a problem creating the beanexamples.cluster.ejb.Teller
public void ejbPassivate()
ejbPassivate
in interface javax.ejb.SessionBean
public void ejbRemove()
ejbRemove
in interface javax.ejb.SessionBean
public void setSessionContext(javax.ejb.SessionContext ctx)
setSessionContext
in interface javax.ejb.SessionBean
ctx
- SessionContextpublic TellerResult transfer(java.lang.String accountFrom, java.lang.String accountTo, double amount, java.lang.String transactionId) throws TellerException, java.rmi.RemoteException
accountFrom
- string account ID of account taking amount fromaccountTo
- string account ID of account sending amount toamount
- double amount to transfertransactionId
- string transaction IDTellerException
- if there is an error while making the transferjava.rmi.RemoteException
- if there is a communications or systems failurepublic TellerResult withdraw(java.lang.String accountId, double amount, java.lang.String transactionId) throws TellerException, java.rmi.RemoteException
accountId
- string account IDamount
- double amount to withdrawtransactionId
- string transaction IDTellerException
- if there is an error while making the withdrawaljava.rmi.RemoteException
- if there is a communications or systems failure
|
Documentation is available at http://e-docs.bea.com/wls/docs60 |
|||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |