|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--samples.j2ee.ejb.basic.statefulSession.TraderBean
TraderBean is a stateful SessionBean. This EJBean illustrates:
| Field Summary | |
java.lang.String |
traderName
|
double |
tradingBalance
|
| Constructor Summary | |
TraderBean()
|
|
| Method Summary | |
TradeResult |
buy(java.lang.String customerName,
java.lang.String stockSymbol,
int shares)
Buys shares of a stock for a named customer. |
void |
ejbActivate()
This method is required by the EJB Specification, but is not used by this example. |
void |
ejbCreate(java.lang.String traderName)
This method corresponds to the create method in the home interface "TraderHome.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. |
double |
getBalance()
Returns the current balance of a trading session. |
double |
getStockPrice(java.lang.String stockSymbol)
Returns the stock price for a given stock. |
java.lang.String |
getTraderName()
Returns the name of this Trader. |
TradeResult |
sell(java.lang.String customerName,
java.lang.String stockSymbol,
int shares)
Sells shares of a stock for a named customer. |
void |
setSessionContext(javax.ejb.SessionContext ctx)
Sets the session context. |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public java.lang.String traderName
public double tradingBalance
| Constructor Detail |
public TraderBean()
| Method Detail |
public void ejbActivate()
public void ejbRemove()
public void ejbPassivate()
public void setSessionContext(javax.ejb.SessionContext ctx)
ctx - SessionContext Context for session
public void ejbCreate(java.lang.String traderName)
throws javax.ejb.CreateException
TraderHome.create(), the container allocates an instance of
the EJBean and calls ejbCreate().traderName - String Trader NameTrader
public TradeResult buy(java.lang.String customerName,
java.lang.String stockSymbol,
int shares)
throws ProcessingErrorException
customerName - String Customer namestockSymbol - String Stock symbolshares - int Number of shares to buy
public TradeResult sell(java.lang.String customerName,
java.lang.String stockSymbol,
int shares)
throws ProcessingErrorException
customerName - String Customer namestockSymbol - String Stock symbolshares - int Number of shares to buypublic java.lang.String getTraderName()
public double getBalance()
public double getStockPrice(java.lang.String stockSymbol)
throws ProcessingErrorException
stockSymbol - String Stock symbol
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||