|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.geronimo.samples.daytrader.direct.TradeDirect
TradeDirect uses direct JDBC and JMS access to a javax.sql.DataSource
to implement the business methods
of the Trade online broker application. These business methods represent the features and operations that
can be performed by customers of the brokerage such as login, logout, get a stock quote, buy or sell a stock, etc.
and are specified in the TradeServices
interface
Note: In order for this class to be thread-safe, a new TradeJDBC must be created
for each call to a method from the TradeInterface interface. Otherwise, pooled
connections may not be released.
TradeServices
,
Trade
Constructor Summary | |
TradeDirect()
Zero arg constructor for TradeDirect |
Method Summary | |
OrderDataBean |
buy(java.lang.String userID,
java.lang.String symbol,
double quantity,
int orderProcessingMode)
Purchase a stock and create a new holding for the given user. |
void |
cancelOrder(java.lang.Integer orderID,
boolean twoPhase)
Cancel the Order identefied by orderID The boolean twoPhase specifies to the server implementation whether or not the method is to participate in a global transaction |
void |
cancelOrderOnePhase(java.lang.Integer orderID)
|
OrderDataBean |
completeOrder(java.lang.Integer orderID,
boolean twoPhase)
Complete the Order identefied by orderID Orders are submitted through JMS to a Trading agent and completed asynchronously. |
OrderDataBean |
completeOrderOnePhase(java.lang.Integer orderID)
|
QuoteDataBean |
createQuote(java.lang.String symbol,
java.lang.String companyName,
java.math.BigDecimal price)
Given a market symbol, price, and details, create and return a new QuoteDataBean |
static void |
destroy()
|
AccountDataBean |
getAccountData(int accountID)
|
AccountDataBean |
getAccountData(java.lang.String userID)
Return an AccountDataBean object for userID describing the account |
AccountProfileDataBean |
getAccountProfileData(java.lang.String userID)
Return an AccountProfileDataBean for userID providing the users profile |
java.util.Collection |
getAllQuotes()
Return a Collection of QuoteDataBean
describing all current quotes |
java.util.Collection |
getClosedOrders(java.lang.String userID)
Get the collection of completed orders for a given account that need to be alerted to the user |
HoldingDataBean |
getHolding(java.lang.Integer holdingID)
Return a specific user stock holding identifed by the holdingID |
java.util.Collection |
getHoldings(java.lang.String userID)
Return the portfolio of stock holdings for the specified customer as a collection of HoldingDataBeans |
MarketSummaryDataBean |
getMarketSummary()
Compute and return a snapshot of the current market conditions This includes the TSIA - an index of the price of the top 100 Trade stock quotes The openTSIA ( the index at the open) The volume of shares traded, Top Stocks gain and loss |
java.util.Collection |
getOrders(java.lang.String userID)
Get the collection of all orders for a given account |
QuoteDataBean |
getQuote(java.lang.String symbol)
Return a QuoteDataBean describing a current quote for the given stock symbol |
static void |
init()
|
AccountDataBean |
login(java.lang.String userID,
java.lang.String password)
Attempt to authenticate and login a user with the given password |
void |
logout(java.lang.String userID)
Logout the given user |
void |
orderCompleted(java.lang.String userID,
java.lang.Integer orderID)
Signify an order has been completed for the given userID |
void |
queueOrder(java.lang.Integer orderID,
boolean twoPhase)
Queue the Order identified by orderID to be processed Orders are submitted through JMS to a Trading Broker and completed asynchronously. |
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)
Register a new Trade customer. |
RunStatsDataBean |
resetTrade(boolean deleteAll)
Reset the TradeData by - removing all newly registered users by scenario servlet (i.e. |
OrderDataBean |
sell(java.lang.String userID,
java.lang.Integer holdingID,
int orderProcessingMode)
Sell a stock holding and removed the holding for the given user. |
AccountProfileDataBean |
updateAccountProfile(AccountProfileDataBean profileData)
Update userID's account profile information using the provided AccountProfileDataBean object |
QuoteDataBean |
updateQuotePriceVolume(java.lang.String symbol,
java.math.BigDecimal changeFactor,
double sharesTraded)
Update the stock quote price and volume for the specified stock symbol |
QuoteDataBean |
updateQuotePriceVolumeInt(java.lang.String symbol,
java.math.BigDecimal changeFactor,
double sharesTraded,
boolean publishQuotePriceChange)
Update a quote's price and volume |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TradeDirect()
Method Detail |
public MarketSummaryDataBean getMarketSummary() throws java.lang.Exception
TradeServices
getMarketSummary
in interface TradeServices
java.lang.Exception
TradeServices.getMarketSummary()
public OrderDataBean buy(java.lang.String userID, java.lang.String symbol, double quantity, int orderProcessingMode) throws java.lang.Exception
TradeServices
buy
in interface TradeServices
userID
- the customer requesting the stock purchasesymbol
- the symbol of the stock being purchasedquantity
- the quantity of shares to purchase
java.lang.Exception
TradeServices#buy(String, String, double)
public OrderDataBean sell(java.lang.String userID, java.lang.Integer holdingID, int orderProcessingMode) throws java.lang.Exception
TradeServices
sell
in interface TradeServices
userID
- the customer requesting the sellholdingID
- the users holding to be sold
java.lang.Exception
TradeServices#sell(String, Integer)
public void queueOrder(java.lang.Integer orderID, boolean twoPhase) throws java.lang.Exception
TradeServices
queueOrder
in interface TradeServices
orderID
- the Order being queued for processing
java.lang.Exception
TradeServices#queueOrder(Integer)
public OrderDataBean completeOrder(java.lang.Integer orderID, boolean twoPhase) throws java.lang.Exception
TradeServices
completeOrder
in interface TradeServices
orderID
- the Order to complete
java.lang.Exception
TradeServices#completeOrder(Integer)
public OrderDataBean completeOrderOnePhase(java.lang.Integer orderID) throws java.lang.Exception
java.lang.Exception
public void cancelOrder(java.lang.Integer orderID, boolean twoPhase) throws java.lang.Exception
TradeServices
cancelOrder
in interface TradeServices
orderID
- the Order to complete
java.lang.Exception
TradeServices.cancelOrder(Integer, boolean)
public void cancelOrderOnePhase(java.lang.Integer orderID) throws java.lang.Exception
java.lang.Exception
public void orderCompleted(java.lang.String userID, java.lang.Integer orderID) throws java.lang.Exception
TradeServices
orderCompleted
in interface TradeServices
userID
- the user for which an order has completedorderID
- the order which has completed
java.lang.Exception
public java.util.Collection getOrders(java.lang.String userID) throws java.lang.Exception
TradeServices
getOrders
in interface TradeServices
userID
- the customer account to retrieve orders for
java.lang.Exception
TradeServices.getOrders(String)
public java.util.Collection getClosedOrders(java.lang.String userID) throws java.lang.Exception
TradeServices
getClosedOrders
in interface TradeServices
userID
- the customer account to retrieve orders for
java.lang.Exception
TradeServices.getClosedOrders(String)
public QuoteDataBean createQuote(java.lang.String symbol, java.lang.String companyName, java.math.BigDecimal price) throws java.lang.Exception
TradeServices
QuoteDataBean
createQuote
in interface TradeServices
symbol
- the symbol of the stockprice
- the current stock price
java.lang.Exception
TradeServices.createQuote(String, String, BigDecimal)
public QuoteDataBean getQuote(java.lang.String symbol) throws java.lang.Exception
TradeServices
QuoteDataBean
describing a current quote for the given stock symbol
getQuote
in interface TradeServices
symbol
- the stock symbol to retrieve the current Quote
java.lang.Exception
TradeServices.getQuote(String)
public java.util.Collection getAllQuotes() throws java.lang.Exception
TradeServices
Collection
of QuoteDataBean
describing all current quotes
getAllQuotes
in interface TradeServices
java.lang.Exception
TradeServices#getAllQuotes(String)
public java.util.Collection getHoldings(java.lang.String userID) throws java.lang.Exception
TradeServices
getHoldings
in interface TradeServices
userID
- the customer requesting the portfolio
java.lang.Exception
TradeServices.getHoldings(String)
public HoldingDataBean getHolding(java.lang.Integer holdingID) throws java.lang.Exception
TradeServices
getHolding
in interface TradeServices
holdingID
- the holdingID to return
java.lang.Exception
TradeServices.getHolding(Integer)
public AccountDataBean getAccountData(java.lang.String userID) throws java.rmi.RemoteException
TradeServices
getAccountData
in interface TradeServices
userID
- the account userID to lookup
java.rmi.RemoteException
TradeServices.getAccountData(String)
public AccountDataBean getAccountData(int accountID) throws java.lang.Exception
java.lang.Exception
TradeServices.getAccountData(String)
public AccountProfileDataBean getAccountProfileData(java.lang.String userID) throws java.lang.Exception
TradeServices
getAccountProfileData
in interface TradeServices
userID
- the account userID to lookup
java.lang.Exception
TradeServices.getAccountProfileData(String)
public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) throws java.lang.Exception
TradeServices
updateAccountProfile
in interface TradeServices
java.lang.Exception
TradeServices.updateAccountProfile(AccountProfileDataBean)
public QuoteDataBean updateQuotePriceVolume(java.lang.String symbol, java.math.BigDecimal changeFactor, double sharesTraded) throws java.lang.Exception
TradeServices
updateQuotePriceVolume
in interface TradeServices
symbol
- for stock quote to update
java.lang.Exception
public QuoteDataBean updateQuotePriceVolumeInt(java.lang.String symbol, java.math.BigDecimal changeFactor, double sharesTraded, boolean publishQuotePriceChange) throws java.lang.Exception
symbol
- The PK of the quotechangeFactor
- the percent to change the old price by (between 50% and 150%)publishQuotePriceChange
- used by the PingJDBCWrite Primitive to ensure no JMS is used, should
be true for all normal calls to this API
java.lang.Exception
public AccountDataBean login(java.lang.String userID, java.lang.String password) throws java.lang.Exception
TradeServices
login
in interface TradeServices
userID
- the customer to loginpassword
- the password entered by the customer for authentication
java.lang.Exception
TradeServices.login(String, String)
public void logout(java.lang.String userID) throws java.lang.Exception
TradeServices
logout
in interface TradeServices
userID
- the customer to logout
java.lang.Exception
TradeServices.logout(String)
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 java.lang.Exception
TradeServices
register
in interface TradeServices
userID
- the new customer to registerpassword
- the customers passwordfullname
- the customers fullnameaddress
- the customers street addressemail
- the customers email addresscreditcard
- the customers creditcard number
java.lang.Exception
TradeServices#register(String, String, String, String, String, String, BigDecimal, boolean)
public RunStatsDataBean resetTrade(boolean deleteAll) throws java.lang.Exception
TradeServices
resetTrade
in interface TradeServices
java.lang.Exception
public static void init()
public static void destroy()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |