org.apache.geronimo.samples.daytrader.soap
Class TradeWebSoapProxy

java.lang.Object
  extended byorg.apache.geronimo.samples.daytrader.soap.TradeWebSoapProxy
All Implemented Interfaces:
java.rmi.Remote, TradeServices

public class TradeWebSoapProxy
extends java.lang.Object
implements TradeServices


Constructor Summary
TradeWebSoapProxy()
           
 
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
 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.
 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
 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 org.apache.geronimo.samples.daytrader.client.ws.TradeWSServices getTrade()
           
 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 newPrice, double sharesTraded)
          Update the stock quote price and volume for the specified stock symbol
static void updateServicePort()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TradeWebSoapProxy

public TradeWebSoapProxy()
Method Detail

getTrade

public static org.apache.geronimo.samples.daytrader.client.ws.TradeWSServices getTrade()

updateServicePort

public static void updateServicePort()

buy

public OrderDataBean buy(java.lang.String userID,
                         java.lang.String symbol,
                         double quantity,
                         int orderProcessingMode)
                  throws java.lang.Exception,
                         java.rmi.RemoteException
Description copied from interface: TradeServices
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

Specified by:
buy in interface TradeServices
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:
java.lang.Exception
java.rmi.RemoteException

cancelOrder

public void cancelOrder(java.lang.Integer orderID,
                        boolean twoPhase)
                 throws java.lang.Exception,
                        java.rmi.RemoteException
Description copied from interface: TradeServices
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

Specified by:
cancelOrder in interface TradeServices
Parameters:
orderID - the Order to complete
Returns:
OrderDataBean providing the status of the completed order
Throws:
java.lang.Exception
java.rmi.RemoteException

completeOrder

public OrderDataBean completeOrder(java.lang.Integer orderID,
                                   boolean twoPhase)
                            throws java.lang.Exception,
                                   java.rmi.RemoteException
Description copied from interface: TradeServices
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

Specified by:
completeOrder in interface TradeServices
Parameters:
orderID - the Order to complete
Returns:
OrderDataBean providing the status of the completed order
Throws:
java.lang.Exception
java.rmi.RemoteException

createQuote

public QuoteDataBean createQuote(java.lang.String symbol,
                                 java.lang.String companyName,
                                 java.math.BigDecimal price)
                          throws java.lang.Exception,
                                 java.rmi.RemoteException
Description copied from interface: TradeServices
Given a market symbol, price, and details, create and return a new QuoteDataBean

Specified by:
createQuote in interface TradeServices
Parameters:
symbol - the symbol of the stock
price - the current stock price
Returns:
a new QuoteDataBean or null if Quote could not be created
Throws:
java.lang.Exception
java.rmi.RemoteException

getAccountData

public AccountDataBean getAccountData(java.lang.String userID)
                               throws javax.ejb.FinderException,
                                      java.rmi.RemoteException
Description copied from interface: TradeServices
Return an AccountDataBean object for userID describing the account

Specified by:
getAccountData in interface TradeServices
Parameters:
userID - the account userID to lookup
Returns:
User account data in AccountDataBean
Throws:
javax.ejb.FinderException
java.rmi.RemoteException

getAccountProfileData

public AccountProfileDataBean getAccountProfileData(java.lang.String userID)
                                             throws java.lang.Exception,
                                                    java.rmi.RemoteException
Description copied from interface: TradeServices
Return an AccountProfileDataBean for userID providing the users profile

Specified by:
getAccountProfileData in interface TradeServices
Parameters:
userID - the account userID to lookup
Throws:
java.lang.Exception
java.rmi.RemoteException

getAllQuotes

public java.util.Collection getAllQuotes()
                                  throws java.lang.Exception,
                                         java.rmi.RemoteException
Description copied from interface: TradeServices
Return a Collection of QuoteDataBean describing all current quotes

Specified by:
getAllQuotes in interface TradeServices
Returns:
A collection of QuoteDataBean
Throws:
java.lang.Exception
java.rmi.RemoteException

getClosedOrders

public java.util.Collection getClosedOrders(java.lang.String userID)
                                     throws java.lang.Exception,
                                            java.rmi.RemoteException
Description copied from interface: TradeServices
Get the collection of completed orders for a given account that need to be alerted to the user

Specified by:
getClosedOrders in interface TradeServices
Parameters:
userID - the customer account to retrieve orders for
Returns:
Collection OrderDataBeans providing detailed order information
Throws:
java.lang.Exception
java.rmi.RemoteException

getHolding

public HoldingDataBean getHolding(java.lang.Integer holdingID)
                           throws java.lang.Exception,
                                  java.rmi.RemoteException
Description copied from interface: TradeServices
Return a specific user stock holding identifed by the holdingID

Specified by:
getHolding in interface TradeServices
Parameters:
holdingID - the holdingID to return
Returns:
a HoldingDataBean describing the holding
Throws:
java.lang.Exception
java.rmi.RemoteException

getHoldings

public java.util.Collection getHoldings(java.lang.String userID)
                                 throws java.lang.Exception,
                                        java.rmi.RemoteException
Description copied from interface: TradeServices
Return the portfolio of stock holdings for the specified customer as a collection of HoldingDataBeans

Specified by:
getHoldings in interface TradeServices
Parameters:
userID - the customer requesting the portfolio
Returns:
Collection of the users portfolio of stock holdings
Throws:
java.lang.Exception
java.rmi.RemoteException

getMarketSummary

public MarketSummaryDataBean getMarketSummary()
                                       throws java.lang.Exception,
                                              java.rmi.RemoteException
Description copied from interface: TradeServices
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

Specified by:
getMarketSummary in interface TradeServices
Returns:
A snapshot of the current market summary
Throws:
java.lang.Exception
java.rmi.RemoteException

getOrders

public java.util.Collection getOrders(java.lang.String userID)
                               throws java.lang.Exception,
                                      java.rmi.RemoteException
Description copied from interface: TradeServices
Get the collection of all orders for a given account

Specified by:
getOrders in interface TradeServices
Parameters:
userID - the customer account to retrieve orders for
Returns:
Collection OrderDataBeans providing detailed order information
Throws:
java.lang.Exception
java.rmi.RemoteException

getQuote

public QuoteDataBean getQuote(java.lang.String symbol)
                       throws java.lang.Exception,
                              java.rmi.RemoteException
Description copied from interface: TradeServices
Return a QuoteDataBean describing a current quote for the given stock symbol

Specified by:
getQuote in interface TradeServices
Parameters:
symbol - the stock symbol to retrieve the current Quote
Returns:
the QuoteDataBean
Throws:
java.lang.Exception
java.rmi.RemoteException

login

public AccountDataBean login(java.lang.String userID,
                             java.lang.String password)
                      throws java.lang.Exception,
                             java.rmi.RemoteException
Description copied from interface: TradeServices
Attempt to authenticate and login a user with the given password

Specified by:
login in interface TradeServices
Parameters:
userID - the customer to login
password - the password entered by the customer for authentication
Returns:
User account data in AccountDataBean
Throws:
java.lang.Exception
java.rmi.RemoteException

logout

public void logout(java.lang.String userID)
            throws java.lang.Exception,
                   java.rmi.RemoteException
Description copied from interface: TradeServices
Logout the given user

Specified by:
logout in interface TradeServices
Parameters:
userID - the customer to logout
Returns:
the login status
Throws:
java.lang.Exception
java.rmi.RemoteException

orderCompleted

public void orderCompleted(java.lang.String userID,
                           java.lang.Integer orderID)
                    throws java.lang.Exception,
                           java.rmi.RemoteException
Description copied from interface: TradeServices
Signify an order has been completed for the given userID

Specified by:
orderCompleted in interface TradeServices
Parameters:
userID - the user for which an order has completed
orderID - the order which has completed
Throws:
java.lang.Exception
java.rmi.RemoteException

queueOrder

public void queueOrder(java.lang.Integer orderID,
                       boolean twoPhase)
                throws java.lang.Exception,
                       java.rmi.RemoteException
Description copied from interface: TradeServices
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

Specified by:
queueOrder in interface TradeServices
Parameters:
orderID - the Order being queued for processing
Returns:
OrderDataBean providing the status of the completed order
Throws:
java.lang.Exception
java.rmi.RemoteException

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 java.lang.Exception,
                                java.rmi.RemoteException
Description copied from interface: TradeServices
Register a new Trade customer. Create a new user profile, user registry entry, account with initial balance, and empty portfolio.

Specified by:
register in interface TradeServices
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
Returns:
the userID if successful, null otherwise
Throws:
java.lang.Exception
java.rmi.RemoteException

resetTrade

public RunStatsDataBean resetTrade(boolean deleteAll)
                            throws java.lang.Exception,
                                   java.rmi.RemoteException
Description copied from interface: TradeServices
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

Specified by:
resetTrade in interface TradeServices
Throws:
java.lang.Exception
java.rmi.RemoteException

sell

public OrderDataBean sell(java.lang.String userID,
                          java.lang.Integer holdingID,
                          int orderProcessingMode)
                   throws java.lang.Exception,
                          java.rmi.RemoteException
Description copied from interface: TradeServices
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.

Specified by:
sell in interface TradeServices
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:
java.lang.Exception
java.rmi.RemoteException

updateAccountProfile

public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData)
                                            throws java.lang.Exception,
                                                   java.rmi.RemoteException
Description copied from interface: TradeServices
Update userID's account profile information using the provided AccountProfileDataBean object

Specified by:
updateAccountProfile in interface TradeServices
Throws:
java.lang.Exception
java.rmi.RemoteException

updateQuotePriceVolume

public QuoteDataBean updateQuotePriceVolume(java.lang.String symbol,
                                            java.math.BigDecimal newPrice,
                                            double sharesTraded)
                                     throws java.lang.Exception,
                                            java.rmi.RemoteException
Description copied from interface: TradeServices
Update the stock quote price and volume for the specified stock symbol

Specified by:
updateQuotePriceVolume in interface TradeServices
Parameters:
symbol - for stock quote to update
Returns:
the QuoteDataBean describing the stock
Throws:
java.lang.Exception
java.rmi.RemoteException


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