org.apache.geronimo.samples.daytrader
Interface TradeServices

All Superinterfaces:
Remote
All Known Subinterfaces:
Trade, TradeJDBC
All Known Implementing Classes:
TradeAction, TradeDirect, TradeWebSoapProxy

public interface TradeServices
extends Remote

TradeServices interface specifies the business methods provided by 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. This interface is implemented by Trade providing an EJB implementation of these business methods and also by TradeDirect providing a JDBC implementation.

See Also:
Trade, TradeDirect

Method Summary
 OrderDataBean buy(String userID, String symbol, double quantity, int orderProcessingMode)
          Purchase a stock and create a new holding for the given user.
 void cancelOrder(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
 OrderDataBean completeOrder(Integer orderID, boolean twoPhase)
          Complete the Order identefied by orderID Orders are submitted through JMS to a Trading agent and completed asynchronously.
 QuoteDataBean createQuote(String symbol, String companyName, BigDecimal price)
          Given a market symbol, price, and details, create and return a new QuoteDataBean
 AccountDataBean getAccountData(String userID)
          Return an AccountDataBean object for userID describing the account
 AccountProfileDataBean getAccountProfileData(String userID)
          Return an AccountProfileDataBean for userID providing the users profile
 Collection getAllQuotes()
          Return a Collection of QuoteDataBean describing all current quotes
 Collection getClosedOrders(String userID)
          Get the collection of completed orders for a given account that need to be alerted to the user
 HoldingDataBean getHolding(Integer holdingID)
          Return a specific user stock holding identifed by the holdingID
 Collection getHoldings(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
 Collection getOrders(String userID)
          Get the collection of all orders for a given account
 QuoteDataBean getQuote(String symbol)
          Return a QuoteDataBean describing a current quote for the given stock symbol
 AccountDataBean login(String userID, String password)
          Attempt to authenticate and login a user with the given password
 void logout(String userID)
          Logout the given user
 void orderCompleted(String userID, Integer orderID)
          Signify an order has been completed for the given userID
 void queueOrder(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(String userID, String password, String fullname, String address, String email, String creditcard, 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. users with userID's beginning with "ru:") * - removing all buy/sell order pairs - setting logoutCount = loginCount return statistics for this benchmark run
 OrderDataBean sell(String userID, 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(String symbol, BigDecimal newPrice, double sharesTraded)
          Update the stock quote price and volume for the specified stock symbol
 

Method Detail

getMarketSummary

MarketSummaryDataBean getMarketSummary()
                                       throws Exception,
                                              RemoteException
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

Returns:
A snapshot of the current market summary
Throws:
Exception
RemoteException

buy

OrderDataBean buy(String userID,
                  String symbol,
                  double quantity,
                  int orderProcessingMode)
                  throws Exception,
                         RemoteException
Purchase a stock and create a new holding for the given user. Given a stock symbol and quantity to purchase, retrieve the current quote price, debit the user's account balance, and add holdings to user's portfolio. buy/sell are asynchronous, using J2EE messaging, A new order is created and submitted for processing to the TradeBroker

Parameters:
userID - the customer requesting the stock purchase
symbol - the symbol of the stock being purchased
quantity - the quantity of shares to purchase
Returns:
OrderDataBean providing the status of the newly created buy order
Throws:
Exception
RemoteException

sell

OrderDataBean sell(String userID,
                   Integer holdingID,
                   int orderProcessingMode)
                   throws Exception,
                          RemoteException
Sell a stock holding and removed the holding for the given user. Given a Holding, retrieve current quote, credit user's account, and reduce holdings in user's portfolio.

Parameters:
userID - the customer requesting the sell
holdingID - the users holding to be sold
Returns:
OrderDataBean providing the status of the newly created sell order
Throws:
Exception
RemoteException

queueOrder

void queueOrder(Integer orderID,
                boolean twoPhase)
                throws Exception,
                       RemoteException
Queue the Order identified by orderID to be processed Orders are submitted through JMS to a Trading Broker and completed asynchronously. This method queues the order for processing The boolean twoPhase specifies to the server implementation whether or not the method is to participate in a global transaction

Parameters:
orderID - the Order being queued for processing
Throws:
Exception
RemoteException

completeOrder

OrderDataBean completeOrder(Integer orderID,
                            boolean twoPhase)
                            throws Exception,
                                   RemoteException
Complete the Order identefied by orderID Orders are submitted through JMS to a Trading agent and completed asynchronously. This method completes the order For a buy, the stock is purchased creating a holding and the users account is debited For a sell, the stock holding is removed and the users account is credited with the proceeds The boolean twoPhase specifies to the server implementation whether or not the method is to participate in a global transaction

Parameters:
orderID - the Order to complete
Returns:
OrderDataBean providing the status of the completed order
Throws:
Exception
RemoteException

cancelOrder

void cancelOrder(Integer orderID,
                 boolean twoPhase)
                 throws Exception,
                        RemoteException
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

Parameters:
orderID - the Order to complete
Throws:
Exception
RemoteException

orderCompleted

void orderCompleted(String userID,
                    Integer orderID)
                    throws Exception,
                           RemoteException
Signify an order has been completed for the given userID

Parameters:
userID - the user for which an order has completed
orderID - the order which has completed
Throws:
Exception
RemoteException

getOrders

Collection getOrders(String userID)
                     throws Exception,
                            RemoteException
Get the collection of all orders for a given account

Parameters:
userID - the customer account to retrieve orders for
Returns:
Collection OrderDataBeans providing detailed order information
Throws:
Exception
RemoteException

getClosedOrders

Collection getClosedOrders(String userID)
                           throws Exception,
                                  RemoteException
Get the collection of completed orders for a given account that need to be alerted to the user

Parameters:
userID - the customer account to retrieve orders for
Returns:
Collection OrderDataBeans providing detailed order information
Throws:
Exception
RemoteException

createQuote

QuoteDataBean createQuote(String symbol,
                          String companyName,
                          BigDecimal price)
                          throws Exception,
                                 RemoteException
Given a market symbol, price, and details, create and return a new QuoteDataBean

Parameters:
symbol - the symbol of the stock
price - the current stock price
details - a short description of the stock or company
Returns:
a new QuoteDataBean or null if Quote could not be created
Throws:
Exception
RemoteException

getQuote

QuoteDataBean getQuote(String symbol)
                       throws Exception,
                              RemoteException
Return a QuoteDataBean describing a current quote for the given stock symbol

Parameters:
symbol - the stock symbol to retrieve the current Quote
Returns:
the QuoteDataBean
Throws:
Exception
RemoteException

getAllQuotes

Collection getAllQuotes()
                        throws Exception,
                               RemoteException
Return a Collection of QuoteDataBean describing all current quotes

Returns:
A collection of QuoteDataBean
Throws:
Exception
RemoteException

updateQuotePriceVolume

QuoteDataBean updateQuotePriceVolume(String symbol,
                                     BigDecimal newPrice,
                                     double sharesTraded)
                                     throws Exception,
                                            RemoteException
Update the stock quote price and volume for the specified stock symbol

Parameters:
symbol - for stock quote to update
price - the updated quote price
Returns:
the QuoteDataBean describing the stock
Throws:
Exception
RemoteException

getHoldings

Collection getHoldings(String userID)
                       throws Exception,
                              RemoteException
Return the portfolio of stock holdings for the specified customer as a collection of HoldingDataBeans

Parameters:
userID - the customer requesting the portfolio
Returns:
Collection of the users portfolio of stock holdings
Throws:
Exception
RemoteException

getHolding

HoldingDataBean getHolding(Integer holdingID)
                           throws Exception,
                                  RemoteException
Return a specific user stock holding identifed by the holdingID

Parameters:
holdingID - the holdingID to return
Returns:
a HoldingDataBean describing the holding
Throws:
Exception
RemoteException

getAccountData

AccountDataBean getAccountData(String userID)
                               throws FinderException,
                                      RemoteException
Return an AccountDataBean object for userID describing the account

Parameters:
userID - the account userID to lookup
Returns:
User account data in AccountDataBean
Throws:
FinderException
RemoteException

getAccountProfileData

AccountProfileDataBean getAccountProfileData(String userID)
                                             throws Exception,
                                                    RemoteException
Return an AccountProfileDataBean for userID providing the users profile

Parameters:
userID - the account userID to lookup
User - account profile data in AccountProfileDataBean
Throws:
Exception
RemoteException

updateAccountProfile

AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData)
                                            throws Exception,
                                                   RemoteException
Update userID's account profile information using the provided AccountProfileDataBean object

Parameters:
userID - the account userID to lookup
User - account profile data in AccountProfileDataBean
Throws:
Exception
RemoteException

login

AccountDataBean login(String userID,
                      String password)
                      throws Exception,
                             RemoteException
Attempt to authenticate and login a user with the given password

Parameters:
userID - the customer to login
password - the password entered by the customer for authentication
Returns:
User account data in AccountDataBean
Throws:
Exception
RemoteException

logout

void logout(String userID)
            throws Exception,
                   RemoteException
Logout the given user

Parameters:
userID - the customer to logout
Throws:
Exception
RemoteException

register

AccountDataBean register(String userID,
                         String password,
                         String fullname,
                         String address,
                         String email,
                         String creditcard,
                         BigDecimal openBalance)
                         throws Exception,
                                RemoteException
Register a new Trade customer. Create a new user profile, user registry entry, account with initial balance, and empty portfolio.

Parameters:
userID - the new customer to register
password - the customers password
fullname - the customers fullname
address - the customers street address
email - the customers email address
creditcard - the customers creditcard number
initialBalance - the amount to charge to the customers credit to open the account and set the initial balance
Returns:
the userID if successful, null otherwise
Throws:
Exception
RemoteException

resetTrade

RunStatsDataBean resetTrade(boolean deleteAll)
                            throws Exception,
                                   RemoteException
Reset the TradeData by - removing all newly registered users by scenario servlet (i.e. users with userID's beginning with "ru:") * - removing all buy/sell order pairs - setting logoutCount = loginCount return statistics for this benchmark run

Throws:
Exception
RemoteException


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.