org.apache.geronimo.samples.daytrader
Class TradeJPA
java.lang.Object
org.apache.geronimo.samples.daytrader.TradeJPA
- All Implemented Interfaces:
- Serializable, EnterpriseBean, SessionBean
public class TradeJPA
- extends Object
- implements SessionBean
- See Also:
- Serialized Form
Method Summary |
OrderDataBean |
buy(String userID,
String symbol,
double quantity,
int orderProcessingMode)
|
void |
cancelOrder(Integer orderID,
boolean twoPhase)
|
void |
cancelOrderOnePhase(Integer orderID)
|
void |
cancelOrderOnePhaseDirect(Integer orderID)
|
OrderDataBean |
completeOrder(Integer orderID,
boolean twoPhase)
|
OrderDataBean |
completeOrderOnePhase(Integer orderID)
|
OrderDataBean |
completeOrderOnePhaseDirect(Integer orderID)
|
HoldingDataBean |
createHolding(AccountDataBean account,
QuoteDataBean quote,
double quantity,
BigDecimal purchasePrice)
|
OrderDataBean |
createOrder(AccountDataBean account,
QuoteDataBean quote,
HoldingDataBean holding,
String orderType,
double quantity)
|
QuoteDataBean |
createQuote(String symbol,
String companyName,
BigDecimal price)
|
void |
ejbActivate()
|
void |
ejbCreate()
|
void |
ejbPassivate()
|
void |
ejbRemove()
|
AccountDataBean |
getAccountData(String userID)
|
AccountProfileDataBean |
getAccountProfileData(String userID)
|
Collection |
getAllQuotes()
|
Collection |
getClosedOrders(String userID)
|
HoldingDataBean |
getHolding(Integer holdingID)
|
Collection |
getHoldings(String userID)
|
MarketSummaryDataBean |
getMarketSummary()
|
Collection |
getOrders(String userID)
|
QuoteDataBean |
getQuote(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(String userID,
String password)
|
void |
logout(String userID)
|
void |
orderCompleted(String userID,
Integer orderID)
|
QuoteDataBean |
pingTwoPhase(String symbol)
This method provides a ping test for a 2-phase commit operation |
void |
publishQuotePriceChange(QuoteDataBean quoteData,
BigDecimal oldPrice,
BigDecimal changeFactor,
double sharesTraded)
|
void |
queueOrder(Integer orderID,
boolean twoPhase)
|
void |
queueOrderOnePhase(Integer orderID)
|
AccountDataBean |
register(String userID,
String password,
String fullname,
String address,
String email,
String creditcard,
BigDecimal openBalance)
|
RunStatsDataBean |
resetTrade(boolean deleteAll)
|
OrderDataBean |
sell(String userID,
Integer holdingID,
int orderProcessingMode)
|
void |
setSessionContext(SessionContext sc)
|
AccountProfileDataBean |
updateAccountProfile(AccountProfileDataBean accountProfileData)
|
QuoteDataBean |
updateQuotePriceVolume(String symbol,
BigDecimal changeFactor,
double sharesTraded)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TradeJPA
public TradeJPA()
queueOrder
public void queueOrder(Integer orderID,
boolean twoPhase)
throws Exception
- Throws:
Exception
- See Also:
TradeServices.queueOrder(Integer, boolean)
queueOrderOnePhase
public void queueOrderOnePhase(Integer orderID)
- 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 Exception
- Throws:
Exception
createQuote
public QuoteDataBean createQuote(String symbol,
String companyName,
BigDecimal price)
getQuote
public QuoteDataBean getQuote(String symbol)
getAllQuotes
public Collection getAllQuotes()
throws Exception
- Throws:
Exception
updateQuotePriceVolume
public QuoteDataBean updateQuotePriceVolume(String symbol,
BigDecimal changeFactor,
double sharesTraded)
throws Exception
- Throws:
Exception
publishQuotePriceChange
public void publishQuotePriceChange(QuoteDataBean quoteData,
BigDecimal oldPrice,
BigDecimal changeFactor,
double sharesTraded)
buy
public OrderDataBean buy(String userID,
String symbol,
double quantity,
int orderProcessingMode)
throws Exception
- Throws:
Exception
sell
public OrderDataBean sell(String userID,
Integer holdingID,
int orderProcessingMode)
throws Exception
- Throws:
Exception
getOrders
public Collection getOrders(String userID)
throws FinderException,
Exception
- Throws:
FinderException
Exception
getClosedOrders
public Collection getClosedOrders(String userID)
throws FinderException,
Exception
- Throws:
FinderException
Exception
completeOrder
public OrderDataBean completeOrder(Integer orderID,
boolean twoPhase)
throws Exception
- Throws:
Exception
completeOrderOnePhase
public OrderDataBean completeOrderOnePhase(Integer orderID)
completeOrderOnePhaseDirect
public OrderDataBean completeOrderOnePhaseDirect(Integer orderID)
cancelOrderOnePhaseDirect
public void cancelOrderOnePhaseDirect(Integer orderID)
cancelOrder
public void cancelOrder(Integer orderID,
boolean twoPhase)
throws Exception
- Throws:
Exception
cancelOrderOnePhase
public void cancelOrderOnePhase(Integer orderID)
orderCompleted
public void orderCompleted(String userID,
Integer orderID)
throws Exception
- Throws:
Exception
createHolding
public HoldingDataBean createHolding(AccountDataBean account,
QuoteDataBean quote,
double quantity,
BigDecimal purchasePrice)
throws Exception
- Throws:
Exception
getHoldings
public Collection getHoldings(String userID)
throws FinderException,
Exception
- Throws:
FinderException
Exception
getHolding
public HoldingDataBean getHolding(Integer holdingID)
throws FinderException,
Exception
- Throws:
FinderException
Exception
createOrder
public OrderDataBean createOrder(AccountDataBean account,
QuoteDataBean quote,
HoldingDataBean holding,
String orderType,
double quantity)
throws CreateException,
Exception
- Throws:
CreateException
Exception
login
public AccountDataBean login(String userID,
String password)
throws FinderException,
Exception
- Throws:
FinderException
Exception
logout
public void logout(String userID)
throws FinderException,
Exception
- Throws:
FinderException
Exception
register
public AccountDataBean register(String userID,
String password,
String fullname,
String address,
String email,
String creditcard,
BigDecimal openBalance)
throws CreateException,
Exception
- Throws:
CreateException
Exception
getAccountData
public AccountDataBean getAccountData(String userID)
getAccountProfileData
public AccountProfileDataBean getAccountProfileData(String userID)
throws FinderException,
Exception
- Throws:
FinderException
Exception
updateAccountProfile
public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean accountProfileData)
throws FinderException,
Exception
- Throws:
FinderException
Exception
resetTrade
public RunStatsDataBean resetTrade(boolean deleteAll)
throws Exception
- Throws:
Exception
investmentReturn
public 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
- Parameters:
investment
- amountNetValue
- current value
- Returns:
- return on investment as a percentage
pingTwoPhase
public QuoteDataBean pingTwoPhase(String symbol)
- This method provides a ping test for a 2-phase commit operation
- Parameters:
symbol
- to lookup
- Returns:
- quoteData after sending JMS message
ejbCreate
public void ejbCreate()
throws CreateException
- Throws:
CreateException
ejbRemove
public void ejbRemove()
- Specified by:
ejbRemove
in interface SessionBean
ejbActivate
public void ejbActivate()
- Specified by:
ejbActivate
in interface SessionBean
ejbPassivate
public void ejbPassivate()
- Specified by:
ejbPassivate
in interface SessionBean
setSessionContext
public void setSessionContext(SessionContext sc)
- Specified by:
setSessionContext
in interface SessionBean
Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.