org.apache.geronimo.samples.daytrader.ejb
Class TradeBean
java.lang.Object
org.apache.geronimo.samples.daytrader.ejb.TradeBean
- All Implemented Interfaces:
- javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean
- public class TradeBean
- extends java.lang.Object
- implements javax.ejb.SessionBean
- See Also:
- Serialized Form
Method Summary |
OrderDataBean |
buy(java.lang.String userID,
java.lang.String symbol,
double quantity,
int orderProcessingMode)
|
void |
cancelOrder(java.lang.Integer orderID,
boolean twoPhase)
|
void |
cancelOrderOnePhase(java.lang.Integer orderID)
|
void |
cancelOrderOnePhaseDirect(java.lang.Integer orderID)
|
OrderDataBean |
completeOrder(java.lang.Integer orderID,
boolean twoPhase)
|
OrderDataBean |
completeOrderOnePhase(java.lang.Integer orderID)
|
OrderDataBean |
completeOrderOnePhaseDirect(java.lang.Integer orderID)
|
LocalHolding |
createHolding(LocalAccount account,
LocalQuote quote,
double quantity,
java.math.BigDecimal purchasePrice)
|
LocalOrder |
createOrder(java.lang.Integer orderID,
LocalAccount account,
LocalQuote quote,
LocalHolding holding,
java.lang.String orderType,
double quantity)
|
LocalOrder |
createOrder(int orderID,
LocalAccount account,
LocalQuote quote,
LocalHolding holding,
java.lang.String orderType,
double quantity)
|
QuoteDataBean |
createQuote(java.lang.String symbol,
java.lang.String companyName,
java.math.BigDecimal price)
|
void |
ejbActivate()
|
void |
ejbCreate()
|
void |
ejbPassivate()
|
void |
ejbRemove()
|
AccountDataBean |
getAccountData(java.lang.String userID)
|
AccountProfileDataBean |
getAccountProfileData(java.lang.String userID)
|
java.util.Collection |
getAllQuotes()
|
java.util.Collection |
getClosedOrders(java.lang.String userID)
|
HoldingDataBean |
getHolding(java.lang.Integer holdingID)
|
java.util.Collection |
getHoldings(java.lang.String userID)
|
MarketSummaryDataBean |
getMarketSummary()
|
java.util.Collection |
getOrders(java.lang.String userID)
|
QuoteDataBean |
getQuote(java.lang.String symbol)
|
double |
investmentReturn(double investment,
double NetValue)
provides a simple session method with no database access to test performance of a simple
path through a stateless session |
AccountDataBean |
login(java.lang.String userID,
java.lang.String password)
|
void |
logout(java.lang.String userID)
|
void |
orderCompleted(java.lang.String userID,
java.lang.Integer orderID)
|
QuoteDataBean |
pingTwoPhase(java.lang.String symbol)
This method provides a ping test for a 2-phase commit operation |
void |
publishQuotePriceChange(QuoteDataBean quoteData,
java.math.BigDecimal oldPrice,
java.math.BigDecimal changeFactor,
double sharesTraded)
|
void |
queueOrder(java.lang.Integer orderID,
boolean twoPhase)
|
void |
queueOrderOnePhase(java.lang.Integer orderID)
|
AccountDataBean |
register(java.lang.String userID,
java.lang.String password,
java.lang.String fullname,
java.lang.String address,
java.lang.String email,
java.lang.String creditcard,
java.math.BigDecimal openBalance)
|
RunStatsDataBean |
resetTrade(boolean deleteAll)
|
OrderDataBean |
sell(java.lang.String userID,
java.lang.Integer holdingID,
int orderProcessingMode)
|
void |
setSessionContext(javax.ejb.SessionContext sc)
|
AccountProfileDataBean |
updateAccountProfile(AccountProfileDataBean accountProfileData)
|
QuoteDataBean |
updateQuotePriceVolume(java.lang.String symbol,
java.math.BigDecimal changeFactor,
double sharesTraded)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TradeBean
public TradeBean()
queueOrder
public void queueOrder(java.lang.Integer orderID,
boolean twoPhase)
throws java.lang.Exception
- Throws:
java.lang.Exception
- See Also:
TradeServices#queueOrder(Integer)
queueOrderOnePhase
public void queueOrderOnePhase(java.lang.Integer orderID)
throws java.rmi.RemoteException
- Throws:
java.rmi.RemoteException
- See Also:
Queue the Order identified by orderID to be processed in a One Phase commit
In short, this method is deployed as TXN REQUIRES NEW to avoid a
2-phase commit transaction across Entity and MDB access
getMarketSummary
public MarketSummaryDataBean getMarketSummary()
throws java.lang.Exception
- Throws:
java.lang.Exception
createQuote
public QuoteDataBean createQuote(java.lang.String symbol,
java.lang.String companyName,
java.math.BigDecimal price)
throws javax.ejb.CreateException,
java.lang.Exception
- Throws:
javax.ejb.CreateException
java.lang.Exception
getQuote
public QuoteDataBean getQuote(java.lang.String symbol)
throws java.lang.Exception
- Throws:
java.lang.Exception
getAllQuotes
public java.util.Collection getAllQuotes()
throws java.lang.Exception
- Throws:
java.lang.Exception
updateQuotePriceVolume
public QuoteDataBean updateQuotePriceVolume(java.lang.String symbol,
java.math.BigDecimal changeFactor,
double sharesTraded)
throws java.lang.Exception
- Throws:
java.lang.Exception
publishQuotePriceChange
public void publishQuotePriceChange(QuoteDataBean quoteData,
java.math.BigDecimal oldPrice,
java.math.BigDecimal changeFactor,
double sharesTraded)
throws java.rmi.RemoteException
- Throws:
java.rmi.RemoteException
buy
public OrderDataBean buy(java.lang.String userID,
java.lang.String symbol,
double quantity,
int orderProcessingMode)
throws java.lang.Exception
- Throws:
java.lang.Exception
sell
public OrderDataBean sell(java.lang.String userID,
java.lang.Integer holdingID,
int orderProcessingMode)
throws java.lang.Exception
- Throws:
java.lang.Exception
getOrders
public java.util.Collection getOrders(java.lang.String userID)
throws javax.ejb.FinderException,
java.lang.Exception
- Throws:
javax.ejb.FinderException
java.lang.Exception
getClosedOrders
public java.util.Collection getClosedOrders(java.lang.String userID)
throws javax.ejb.FinderException,
java.lang.Exception
- Throws:
javax.ejb.FinderException
java.lang.Exception
completeOrder
public OrderDataBean completeOrder(java.lang.Integer orderID,
boolean twoPhase)
throws java.lang.Exception
- Throws:
java.lang.Exception
completeOrderOnePhase
public OrderDataBean completeOrderOnePhase(java.lang.Integer orderID)
throws java.rmi.RemoteException
- Throws:
java.rmi.RemoteException
completeOrderOnePhaseDirect
public OrderDataBean completeOrderOnePhaseDirect(java.lang.Integer orderID)
throws java.rmi.RemoteException
- Throws:
java.rmi.RemoteException
cancelOrderOnePhaseDirect
public void cancelOrderOnePhaseDirect(java.lang.Integer orderID)
throws java.rmi.RemoteException
- Throws:
java.rmi.RemoteException
cancelOrder
public void cancelOrder(java.lang.Integer orderID,
boolean twoPhase)
throws java.lang.Exception
- Throws:
java.lang.Exception
cancelOrderOnePhase
public void cancelOrderOnePhase(java.lang.Integer orderID)
throws java.rmi.RemoteException
- Throws:
java.rmi.RemoteException
orderCompleted
public void orderCompleted(java.lang.String userID,
java.lang.Integer orderID)
throws java.lang.Exception
- Throws:
java.lang.Exception
createHolding
public LocalHolding createHolding(LocalAccount account,
LocalQuote quote,
double quantity,
java.math.BigDecimal purchasePrice)
throws java.lang.Exception
- Throws:
java.lang.Exception
getHoldings
public java.util.Collection getHoldings(java.lang.String userID)
throws javax.ejb.FinderException,
java.lang.Exception
- Throws:
javax.ejb.FinderException
java.lang.Exception
getHolding
public HoldingDataBean getHolding(java.lang.Integer holdingID)
throws javax.ejb.FinderException,
java.lang.Exception
- Throws:
javax.ejb.FinderException
java.lang.Exception
createOrder
public LocalOrder createOrder(int orderID,
LocalAccount account,
LocalQuote quote,
LocalHolding holding,
java.lang.String orderType,
double quantity)
throws java.lang.Exception
- Throws:
java.lang.Exception
createOrder
public LocalOrder createOrder(java.lang.Integer orderID,
LocalAccount account,
LocalQuote quote,
LocalHolding holding,
java.lang.String orderType,
double quantity)
throws javax.ejb.CreateException,
java.lang.Exception
- Throws:
javax.ejb.CreateException
java.lang.Exception
login
public AccountDataBean login(java.lang.String userID,
java.lang.String password)
throws javax.ejb.FinderException,
java.lang.Exception
- Throws:
javax.ejb.FinderException
java.lang.Exception
logout
public void logout(java.lang.String userID)
throws javax.ejb.FinderException,
java.lang.Exception
- Throws:
javax.ejb.FinderException
java.lang.Exception
register
public AccountDataBean register(java.lang.String userID,
java.lang.String password,
java.lang.String fullname,
java.lang.String address,
java.lang.String email,
java.lang.String creditcard,
java.math.BigDecimal openBalance)
throws javax.ejb.CreateException,
java.lang.Exception
- Throws:
javax.ejb.CreateException
java.lang.Exception
getAccountData
public AccountDataBean getAccountData(java.lang.String userID)
throws javax.ejb.FinderException,
java.rmi.RemoteException
- Throws:
javax.ejb.FinderException
java.rmi.RemoteException
getAccountProfileData
public AccountProfileDataBean getAccountProfileData(java.lang.String userID)
throws javax.ejb.FinderException,
java.lang.Exception
- Throws:
javax.ejb.FinderException
java.lang.Exception
updateAccountProfile
public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean accountProfileData)
throws javax.ejb.FinderException,
java.lang.Exception
- Throws:
javax.ejb.FinderException
java.lang.Exception
resetTrade
public RunStatsDataBean resetTrade(boolean deleteAll)
throws java.lang.Exception
- Throws:
java.lang.Exception
investmentReturn
public double investmentReturn(double investment,
double NetValue)
throws java.rmi.RemoteException
- provides a simple session method with no database access to test performance of a simple
path through a stateless session
- Parameters:
investment
- amountNetValue
- current value
- Returns:
- return on investment as a percentage
- Throws:
java.rmi.RemoteException
pingTwoPhase
public QuoteDataBean pingTwoPhase(java.lang.String symbol)
throws java.rmi.RemoteException
- This method provides a ping test for a 2-phase commit operation
- Parameters:
symbol
- to lookup
- Returns:
- quoteData after sending JMS message
- Throws:
java.rmi.RemoteException
ejbCreate
public void ejbCreate()
throws javax.ejb.CreateException
- Throws:
javax.ejb.CreateException
ejbRemove
public void ejbRemove()
- Specified by:
ejbRemove
in interface javax.ejb.SessionBean
ejbActivate
public void ejbActivate()
- Specified by:
ejbActivate
in interface javax.ejb.SessionBean
ejbPassivate
public void ejbPassivate()
- Specified by:
ejbPassivate
in interface javax.ejb.SessionBean
setSessionContext
public void setSessionContext(javax.ejb.SessionContext sc)
- Specified by:
setSessionContext
in interface javax.ejb.SessionBean
Copyright © 2005-2006 Apache Software Foundation. All Rights Reserved.