geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r290479 [3/16] - in /geronimo/trunk/sandbox/daytrader: ./ bin/ derby/ modules/ modules/core/ modules/core/src/ modules/core/src/conf/ modules/core/src/java/ modules/core/src/java/org/ modules/core/src/java/org/apache/ modules/core/src/java/...
Date Tue, 20 Sep 2005 16:08:17 GMT
Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeAction.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeAction.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeAction.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeAction.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,493 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader;
+
+import javax.naming.*;
+
+import org.apache.geronimo.samples.daytrader.direct.*;
+import org.apache.geronimo.samples.daytrader.ejb.*;
+import org.apache.geronimo.samples.daytrader.util.*;
+
+import java.util.Collection;
+import java.math.BigDecimal;
+// import com.ibm.websphere.cache.*;
+
+/**
+ * The TradeAction class provides the generic client side access to each of the
+ * Trade brokerage user operations. These include login, logout, buy, sell,
+ * getQuote, etc. The TradeAction class does not handle user interface
+ * processing and should be used by a class that is UI specific. For example,
+ * {@link trade_client.TradeServletAction}manages a web interface to Trade,
+ * making calls to TradeAction methods to actually performance each operation.
+ *  
+ */
+public class TradeAction implements TradeServices {
+	private TradeServices trade = null;
+	private static TradeHome tradeHome = null;
+	
+
+	public TradeAction() {
+		if (Log.doTrace())
+			Log.trace("TradeAction:TradeAction()");
+		createTrade();
+	}
+
+	public TradeAction(TradeServices trade) {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:TradeAction(trade)");
+		this.trade = trade;
+	}
+
+	private void createTrade() {
+		if (TradeConfig.runTimeMode == TradeConfig.EJB) {
+			try {
+				if (tradeHome == null) {
+					InitialContext ic = new InitialContext();
+					try {
+						tradeHome = (TradeHome) (javax.rmi.PortableRemoteObject.narrow(ic.lookup("java:comp/env/ejb/Trade"), TradeHome.class));
+					}
+					catch (Exception e) {
+						Log.log("TradeAction:createTrade lookup of java:comp/env/ejb/Trade failed. Reverting to JNDI lookup of Trade");
+						tradeHome = (TradeHome) (javax.rmi.PortableRemoteObject.narrow(ic.lookup("Trade"), TradeHome.class));
+					}
+				}
+				trade = tradeHome.create();
+			}
+			catch (Exception e) {
+				Log.error("TradeAction:TradeAction() Creation of Trade EJB failed\n" + e);
+				e.printStackTrace();
+			}
+		}
+		else if (TradeConfig.runTimeMode == TradeConfig.DIRECT) {
+			try {
+				trade = new TradeDirect();
+			}
+			catch (Exception e) {
+				Log.error("TradeAction:TradeAction() Creation of Trade Direct failed\n" + e);
+			}
+		}
+	}
+
+	/**
+	 * 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
+	 * 
+	 * @return A snapshot of the current market summary
+	 */
+	public MarketSummaryDataBean getMarketSummary() throws Exception {
+		if (Log.doActionTrace()) {
+			Log.trace("TradeAction:getMarketSummary()");
+		}
+		MarketSummaryDataBean marketSummaryData = null;
+		marketSummaryData = trade.getMarketSummary();
+		return marketSummaryData;
+	}
+
+	/**
+	 * 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.
+	 * 
+	 * @param userID
+	 *            the customer requesting the stock purchase
+	 * @param symbol
+	 *            the symbol of the stock being purchased
+	 * @param quantity
+	 *            the quantity of shares to purchase
+	 * @return OrderDataBean providing the status of the newly created buy order
+	 */
+	public OrderDataBean buy(String userID, String symbol, double quantity, int orderProcessingMode) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:buy", userID, symbol, new Double(quantity), new Integer(orderProcessingMode));
+		OrderDataBean orderData = null;
+		orderData = trade.buy(userID, symbol, quantity, orderProcessingMode);
+		//after the purchase or sell of a stock, update the stocks volume and
+		// price
+		updateQuotePriceVolume(symbol, TradeConfig.getRandomPriceChangeFactor(), quantity);
+		return orderData;
+	}
+
+	/**
+	 * Sell(SOAP 2.2 Wrapper converting int to Integer) 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.
+	 * 
+	 * @param userID
+	 *            the customer requesting the sell
+	 * @param holdingID
+	 *            the users holding to be sold
+	 * @return OrderDataBean providing the status of the newly created sell
+	 *         order
+	 */
+	public OrderDataBean sell(String userID, int holdingID, int orderProcessingMode) throws Exception {
+		return sell(userID, new Integer(holdingID), orderProcessingMode);
+	}
+
+	/**
+	 * 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.
+	 * 
+	 * @param userID
+	 *            the customer requesting the sell
+	 * @param holdingID
+	 *            the users holding to be sold
+	 * @return OrderDataBean providing the status of the newly created sell
+	 *         order
+	 */
+	public OrderDataBean sell(String userID, Integer holdingID, int orderProcessingMode) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:sell", userID, holdingID, new Integer(orderProcessingMode));
+		OrderDataBean orderData = null;
+			orderData = trade.sell(userID, holdingID, orderProcessingMode);
+		if (!(orderData.getOrderStatus().equalsIgnoreCase("cancelled")))
+			//after the purchase or sell of a stock, update the stocks volume
+			// and price
+			updateQuotePriceVolume(orderData.getSymbol(), TradeConfig.getRandomPriceChangeFactor(), orderData.getQuantity());
+		return orderData;
+	}
+
+	/**
+	 * 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
+	 * 
+	 * @param orderID
+	 *            the Order being queued for processing
+	 * @return OrderDataBean providing the status of the completed order
+	 */
+	public void queueOrder(Integer orderID, boolean twoPhase) {
+		throw new UnsupportedOperationException("TradeAction: queueOrder method not supported");
+	}
+
+	/**
+	 * 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
+	 * 
+	 * @param orderID
+	 *            the Order to complete
+	 * @return OrderDataBean providing the status of the completed order
+	 */
+	public OrderDataBean completeOrder(Integer orderID, boolean twoPhase) {
+		throw new UnsupportedOperationException("TradeAction: completeOrder method not supported");
+	}
+
+	/**
+	 * Cancel the Order identified by orderID
+	 * 
+	 * 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
+	 * 
+	 * @param orderID
+	 *            the Order being queued for processing
+	 * @return OrderDataBean providing the status of the completed order
+	 */
+	public void cancelOrder(Integer orderID, boolean twoPhase) {
+		throw new UnsupportedOperationException("TradeAction: cancelOrder method not supported");
+	}
+
+	public void orderCompleted(String userID, Integer orderID) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:orderCompleted", userID, orderID);
+		if (Log.doTrace())
+			Log.trace("OrderCompleted", userID, orderID);
+		return;
+	}
+
+	/**
+	 * Get the collection of all orders for a given account
+	 * 
+	 * @param userID
+	 *            the customer account to retrieve orders for
+	 * @return Collection OrderDataBeans providing detailed order information
+	 */
+	public Collection getOrders(String userID) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:getOrders", userID);
+		Collection orderDataBeans = null;
+		orderDataBeans = trade.getOrders(userID);
+		return orderDataBeans;
+	}
+
+	/**
+	 * Get the collection of completed orders for a given account that need to
+	 * be alerted to the user
+	 * 
+	 * @param userID
+	 *            the customer account to retrieve orders for
+	 * @return Collection OrderDataBeans providing detailed order information
+	 */
+	public Collection getClosedOrders(String userID) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:getClosedOrders", userID);
+		Collection orderDataBeans = null;
+		orderDataBeans = trade.getClosedOrders(userID);
+		return orderDataBeans;
+	}
+
+	/**
+	 * Given a market symbol, price, and details, create and return a new
+	 * {@link QuoteDataBean}
+	 * 
+	 * @param symbol
+	 *            the symbol of the stock
+	 * @param price
+	 *            the current stock price
+	 * @param details
+	 *            a short description of the stock or company
+	 * @return a new QuoteDataBean or null if Quote could not be created
+	 */
+	public QuoteDataBean createQuote(String symbol, String companyName, BigDecimal price) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:createQuote", symbol, companyName, price);
+		QuoteDataBean quoteData = null;
+		quoteData = trade.createQuote(symbol, companyName, price);
+		return quoteData;
+	}
+
+	/**
+	 * Return a collection of {@link QuoteDataBean}describing all current
+	 * quotes
+	 * 
+	 * @return the collection of QuoteDataBean
+	 */
+	public Collection getAllQuotes() throws Exception {
+		if (Log.doActionTrace()) {
+			Log.trace("TradeAction:getAllQuotes");
+		}
+		Collection quotes = null;
+		quotes = trade.getAllQuotes();
+		return quotes;
+	}
+
+	/**
+	 * Return a {@link QuoteDataBean}describing a current quote for the given
+	 * stock symbol
+	 * 
+	 * @param symbol
+	 *            the stock symbol to retrieve the current Quote
+	 * @return the QuoteDataBean
+	 */
+	public QuoteDataBean getQuote(String symbol) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:getQuote", symbol);
+		if ((symbol == null) || (symbol.length() == 0) || (symbol.length() > 10)) {
+			if (Log.doActionTrace()) {
+				Log.trace("TradeAction:getQuote   ---  primitive workload");
+			}
+			return new QuoteDataBean("Invalid symbol", "", 0.0, FinancialUtils.ZERO, FinancialUtils.ZERO, FinancialUtils.ZERO, FinancialUtils.ZERO, 0.0);
+		}
+		QuoteDataBean quoteData = null;
+		quoteData = trade.getQuote(symbol);
+		return quoteData;
+	}
+
+	/**
+	 * Update the stock quote price for the specified stock symbol
+	 * 
+	 * @param symbol
+	 *            for stock quote to update
+	 * @param price
+	 *            the updated quote price
+	 * @return the QuoteDataBean describing the stock
+	 */
+	/* avoid data collision with synch */
+	public QuoteDataBean updateQuotePriceVolume(String symbol, BigDecimal changeFactor, double sharesTraded) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:updateQuotePriceVolume", symbol, changeFactor, new Double(sharesTraded));
+		QuoteDataBean quoteData = null;
+		try {
+			quoteData = trade.updateQuotePriceVolume(symbol, changeFactor, sharesTraded);
+		}
+		catch (Exception e) {
+			Log.error("TradeAction:updateQuotePrice -- ", e);
+		}
+		return quoteData;
+	}
+
+	/**
+	 * Return the portfolio of stock holdings for the specified customer as a
+	 * collection of HoldingDataBeans
+	 * 
+	 * @param userID
+	 *            the customer requesting the portfolio
+	 * @return Collection of the users portfolio of stock holdings
+	 */
+	public Collection getHoldings(String userID) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:getHoldings", userID);
+		Collection holdingDataBeans = null;
+		holdingDataBeans = trade.getHoldings(userID);
+		return holdingDataBeans;
+	}
+
+	/**
+	 * Return a specific user stock holding identifed by the holdingID
+	 * 
+	 * @param holdingID
+	 *            the holdingID to return
+	 * @return a HoldingDataBean describing the holding
+	 */
+	public HoldingDataBean getHolding(Integer holdingID) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:getHolding", holdingID);
+		HoldingDataBean holdingData = null;
+		holdingData = trade.getHolding(holdingID);
+		return holdingData;
+	}
+
+	/**
+	 * Return an AccountDataBean object for userID describing the account
+	 * 
+	 * @param userID
+	 *            the account userID to lookup
+	 * @return User account data in AccountDataBean
+	 */
+	public AccountDataBean getAccountData(String userID) throws javax.ejb.FinderException, Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:getAccountData", userID);
+		AccountDataBean accountData = null;
+		accountData = trade.getAccountData(userID);
+		return accountData;
+	}
+
+	/**
+	 * Return an AccountProfileDataBean for userID providing the users profile
+	 * 
+	 * @param userID
+	 *            the account userID to lookup
+	 * @param User
+	 *            account profile data in AccountProfileDataBean
+	 */
+	public AccountProfileDataBean getAccountProfileData(String userID) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:getAccountProfileData", userID);
+		AccountProfileDataBean accountProfileData = null;
+		accountProfileData = trade.getAccountProfileData(userID);
+		return accountProfileData;
+	}
+
+	/**
+	 * Update userID's account profile information using the provided
+	 * AccountProfileDataBean object
+	 * 
+	 * @param userID
+	 *            the account userID to lookup
+	 * @param User
+	 *            account profile data in AccountProfileDataBean
+	 */
+	public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean accountProfileData) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:updateAccountProfile", accountProfileData);
+		accountProfileData = trade.updateAccountProfile(accountProfileData);
+		return accountProfileData;
+	}
+
+	/**
+	 * Attempt to authenticate and login a user with the given password
+	 * 
+	 * @param userID
+	 *            the customer to login
+	 * @param password
+	 *            the password entered by the customer for authentication
+	 * @return User account data in AccountDataBean
+	 */
+	public AccountDataBean login(String userID, String password) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:login", userID, password);
+		AccountDataBean accountData = null;
+		accountData = trade.login(userID, password);
+		return accountData;
+	}
+
+	/**
+	 * Logout the given user
+	 * 
+	 * @param userID
+	 *            the customer to logout
+	 * @return the login status
+	 */
+	public void logout(String userID) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:logout", userID);
+		trade.logout(userID);
+		return;
+	}
+
+	/**
+	 * Register a new Trade customer. Create a new user profile, user registry
+	 * entry, account with initial balance, and empty portfolio.
+	 * 
+	 * @param userID
+	 *            the new customer to register
+	 * @param password
+	 *            the customers password
+	 * @param fullname
+	 *            the customers fullname
+	 * @param address
+	 *            the customers street address
+	 * @param email
+	 *            the customers email address
+	 * @param creditcard
+	 *            the customers creditcard number
+	 * @param initialBalance
+	 *            the amount to charge to the customers credit to open the
+	 *            account and set the initial balance
+	 * @return the userID if successful, null otherwise
+	 */
+	public AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditCard, BigDecimal openBalance) throws Exception {
+		if (Log.doActionTrace())
+			Log.trace("TradeAction:register", userID, password, fullname, address, email, creditCard, openBalance);
+		AccountDataBean accountData = null;
+		accountData = trade.register(userID, password, fullname, address, email, creditCard, openBalance);
+		return accountData;
+	}
+
+	public AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditCard, String openBalanceString) throws Exception {
+		BigDecimal openBalance = new BigDecimal(openBalanceString);
+		return register(userID, password, fullname, address, email, creditCard, openBalance);
+	}
+
+	/**
+	 * 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
+	 */
+	public RunStatsDataBean resetTrade(boolean deleteAll) throws Exception {
+		RunStatsDataBean runStatsData = null;
+		runStatsData = trade.resetTrade(deleteAll);
+		return runStatsData;
+	}
+}
\ No newline at end of file

Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeConfig.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeConfig.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeConfig.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,828 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader;
+
+import java.util.Random;
+import java.util.ArrayList;
+import java.math.BigDecimal;
+
+import org.apache.geronimo.samples.daytrader.soap.*;
+import org.apache.geronimo.samples.daytrader.util.*;
+
+
+/**
+ * TradeConfig is a JavaBean holding all configuration and runtime parameters for the Trade application
+ * TradeConfig sets runtime parameters such as the RunTimeMode (EJB, JDBC, EJB_ALT)
+ *
+ */
+
+public class TradeConfig {
+
+	/* Trade Runtime Configuration Parameters */
+
+	/* Trade Runtime Mode parameters */
+	public static String[] runTimeModeNames = { "EJB", "Direct" };
+	public static final int EJB = 0;
+	public static final int DIRECT = 1;
+	public static int runTimeMode = EJB;
+
+	public static String[] orderProcessingModeNames =
+		{ "Synchronous", "Asynchronous_1-Phase", "Asynchronous_2-Phase" };
+	public static final int SYNCH = 0;
+	public static final int ASYNCH = 1;
+	public static final int ASYNCH_2PHASE = 2;
+	public static int orderProcessingMode = SYNCH;
+
+	public static String[] accessModeNames = { "Standard", "WebServices" };
+	public static final int STANDARD = 0;
+	public static final int WEBSERVICES = 1;
+	private static int accessMode = STANDARD;
+
+	/* Trade Scenario Workload parameters */
+	public static String[] workloadMixNames = { "Standard", "High-Volume", };
+	public final static int SCENARIOMIX_STANDARD = 0;
+	public final static int SCENARIOMIX_HIGHVOLUME = 1;
+	public static int workloadMix = SCENARIOMIX_STANDARD;
+
+	/* Trade Web Interface parameters */
+	public static String[] webInterfaceNames = { "JSP", "JSP-Images" };
+	public static final int JSP = 0;
+	public static final int JSP_Images = 1;
+	public static int webInterface = JSP;
+
+	/* Trade Caching Type parameters */
+	public static String[] cachingTypeNames = { "DistributedMap", "Command Caching", "No Caching" };
+	public static final int DISTRIBUTEDMAP = 0;
+	public static final int COMMAND_CACHING = 1;
+	public static final int NO_CACHING = 2;
+	public static int cachingType = NO_CACHING;
+	
+	/* Trade Database Scaling parameters*/
+	private static int MAX_USERS = 500;
+	private static int MAX_QUOTES = 1000;
+
+	/* Trade Database specific paramters */
+	public static String JDBC_UID = null;
+	public static String JDBC_PWD = null;
+	public static String DS_NAME = "java:comp/env/jdbc/TradeDataSource";
+
+	/*Trade SOAP specific parameters */
+	private static String SoapURL =
+		"http://localhost/trade/services/TradeWSServices?wsdl";
+
+	/*Trade XA Datasource specific parameters */
+	public static boolean JDBCDriverNeedsGlobalTransation = false;
+
+	/* Trade Config Miscellaneous itmes */
+	public static String DATASOURCE = "java:comp/env/jdbc/TradeDataSource";
+	public static int KEYBLOCKSIZE = 1000;
+	public static int QUOTES_PER_PAGE = 10;
+	public static boolean RND_USER = true;
+	//public static int		RND_SEED = 0;
+	private static int MAX_HOLDINGS = 10;
+	private static int count = 0;
+	private static Object userID_count_semaphore = new Object();
+	private static int userID_count = 0;
+	private static String hostName = null;
+	private static Random r0 = new Random(System.currentTimeMillis());
+	//private static Random r1 = new Random(RND_SEED);
+	private static Random randomNumberGenerator = r0;
+	public static final String newUserPrefix = "ru:";
+	public static final int verifyPercent = 5;
+	private static boolean trace = false;
+	private static boolean actionTrace = false;
+	private static boolean updateQuotePrices = true;
+	private static int primIterations = 1;
+
+	/*
+	 * Penny stocks is a problem where the random price change factor gets a stock
+	 * down to $.01.  In this case trade jumpstarts the price back to $6.00 to
+	 * keep the math interesting.
+	 */
+	public static BigDecimal PENNY_STOCK_PRICE;
+	public static BigDecimal PENNY_STOCK_RECOVERY_MIRACLE_MULTIPLIER;
+	static {
+		PENNY_STOCK_PRICE = new BigDecimal(0.01);
+		PENNY_STOCK_PRICE =
+			PENNY_STOCK_PRICE.setScale(2, BigDecimal.ROUND_HALF_UP);
+		PENNY_STOCK_RECOVERY_MIRACLE_MULTIPLIER = new BigDecimal(600.0);
+		PENNY_STOCK_RECOVERY_MIRACLE_MULTIPLIER.setScale(
+			2,
+			BigDecimal.ROUND_HALF_UP);
+	}
+
+	/* Trade Scenario actions mixes. Each of the array rows represents a specific Trade Scenario Mix. 
+	   The columns give the percentages for each action in the column header. Note: "login" is always 0. 
+	   logout represents both login and logout (because each logout operation will cause a new login when
+	   the user context attempts the next action.
+	 */
+	/* Trade Scenario Workload parameters */
+	public final static int HOME_OP = 0;
+	public final static int QUOTE_OP = 1;
+	public final static int LOGIN_OP = 2;
+	public final static int LOGOUT_OP = 3;
+	public final static int REGISTER_OP = 4;
+	public final static int ACCOUNT_OP = 5;
+	public final static int PORTFOLIO_OP = 6;
+	public final static int BUY_OP = 7;
+	public final static int SELL_OP = 8;
+	public final static int UPDATEACCOUNT_OP = 9;
+
+	private static int scenarioMixes[][] = {
+		//	h	q	l	o	r	a	p	b	s	u
+		{ 20, 40, 0, 4, 2, 10, 12, 4, 4, 4 }, //STANDARD
+		{
+			20, 40, 0, 4, 2, 7, 7, 7, 7, 6 }, //High Volume
+	};
+	private static char actions[] =
+		{ 'h', 'q', 'l', 'o', 'r', 'a', 'p', 'b', 's', 'u' };
+	private static int sellDeficit = 0;
+	//Tracks the number of buys over sell when a users portfolio is empty
+	// Used to maintain the correct ratio of buys/sells
+
+	/* JSP pages for all Trade Actions */
+
+	public final static int WELCOME_PAGE = 0;
+	public final static int REGISTER_PAGE = 1;
+	public final static int PORTFOLIO_PAGE = 2;
+	public final static int QUOTE_PAGE = 3;
+	public final static int HOME_PAGE = 4;
+	public final static int ACCOUNT_PAGE = 5;
+	public final static int ORDER_PAGE = 6;
+	public final static int CONFIG_PAGE = 7;
+	public final static int STATS_PAGE = 8;
+
+	//FUTURE Add XML/XSL View
+	public static String webUI[][] =
+		{
+			{
+				"/welcome.jsp",
+				"/register.jsp",
+				"/portfolio.jsp",
+				"/quote.jsp",
+				"/tradehome.jsp",
+				"/account.jsp",
+				"/order.jsp",
+				"/config.jsp",
+				"/runStats.jsp" },
+		//JSP Interface
+		{
+			"/welcomeImg.jsp",
+				"/registerImg.jsp",
+				"/portfolioImg.jsp",
+				"/quoteImg.jsp",
+				"/tradehomeImg.jsp",
+				"/accountImg.jsp",
+				"/orderImg.jsp",
+				"/config.jsp",
+				"/runStats.jsp" },
+		//JSP Interface	
+	};
+
+	// These are the property settings the VAJ access beans look for.	
+	private static final String NAMESERVICE_TYPE_PROPERTY =
+		"java.naming.factory.initial";
+	private static final String NAMESERVICE_PROVIDER_URL_PROPERTY =
+		"java.naming.provider.url";
+
+	// FUTURE:
+	// If a "trade2.properties" property file is supplied, reset the default values 
+	// to match those specified in the file. This provides a persistent runtime 
+	// property mechanism during server startup
+
+	/**
+	 * Return the hostname for this system
+	 * Creation date: (2/16/2000 9:02:25 PM)
+	 */
+
+	private static String getHostname() {
+		try {
+			if (hostName == null) {
+				hostName = java.net.InetAddress.getLocalHost().getHostName();
+				//Strip of fully qualifed domain if necessary
+				try {
+					hostName = hostName.substring(0, hostName.indexOf('.'));
+				} catch (Exception e) {
+				}
+			}
+		} catch (Exception e) {
+			Log.error(
+				"Exception getting local host name using 'localhost' - ",
+				e);
+			hostName = "localhost";
+		}
+		return hostName;
+	}
+
+	/**
+	 * Return a Trade UI Web page based on the current configuration
+	 * This may return a JSP page or a Servlet page 
+	 * Creation date: (3/14/2000 9:08:34 PM)
+	 */
+
+	public static String getPage(int pageNumber) {
+		return webUI[webInterface][pageNumber];
+	}
+
+	/**
+	 * Return the list of run time mode names
+	 * Creation date: (3/8/2000 5:58:34 PM)
+	 * @return java.lang.String[]
+	 */
+	public static java.lang.String[] getRunTimeModeNames() {
+		return runTimeModeNames;
+	}
+
+	private static int scenarioCount = 0;
+
+	/**
+	 * Return a Trade Scenario Operation based on the setting of the current mix (TradeScenarioMix)
+	 * Creation date: (2/10/2000 9:08:34 PM)
+	 */
+
+	public static char getScenarioAction(boolean newUser) {
+		int r = rndInt(100); //0 to 99 = 100
+		int i = 0;
+		int sum = scenarioMixes[workloadMix][i];
+		while (sum <= r) {
+			i++;
+			sum += scenarioMixes[workloadMix][i];
+		}
+
+		incrementScenarioCount();
+
+		/* In TradeScenarioServlet, if a sell action is selected, but the users portfolio is empty,
+		 * a buy is executed instead and sellDefecit is incremented. This allows the number of buy/sell
+		 * operations to stay in sync w/ the given Trade mix.
+		 */
+
+		if ((!newUser) && (actions[i] == 'b')) {
+			synchronized (TradeConfig.class) {
+				if (sellDeficit > 0) {
+					sellDeficit--;
+					return 's';
+					//Special case for TradeScenarioServlet to note this is a buy switched to a sell to fix sellDeficit
+				}
+			}
+		}
+
+		return actions[i];
+	}
+
+	public static String getUserID() {
+		String userID;
+		if (RND_USER) {
+			userID = rndUserID();
+		} else {
+			userID = nextUserID();
+		}
+		return userID;
+	}
+	private static final BigDecimal orderFee = new BigDecimal("24.95");
+	private static final BigDecimal cashFee = new BigDecimal("0.0");
+	public static BigDecimal getOrderFee(String orderType) {
+		if ((orderType.compareToIgnoreCase("BUY") == 0)
+			|| (orderType.compareToIgnoreCase("SELL") == 0))
+			return orderFee;
+
+		return cashFee;
+
+	}
+
+	/**
+	 * Increment the sell deficit counter
+	 * Creation date: (6/21/2000 11:33:45 AM)
+	 */
+	public synchronized static void incrementSellDeficit() {
+		sellDeficit++;
+	}
+
+	public static String nextUserID() {
+		String userID;
+		synchronized (userID_count_semaphore) {
+			userID = "uid:" + userID_count;
+			userID_count++;
+			if (userID_count % MAX_USERS == 0) {
+				userID_count = 0;
+			}
+		}
+		return userID;
+	}
+	public static double random() {
+		return randomNumberGenerator.nextDouble();
+	}
+	public static String rndAddress() {
+		return rndInt(1000) + " Oak St.";
+	}
+	public static String rndBalance() {
+		//Give all new users a cool mill in which to trade
+		return "1000000";
+	}
+	public static String rndCreditCard() {
+		return rndInt(100)
+			+ "-"
+			+ rndInt(1000)
+			+ "-"
+			+ rndInt(1000)
+			+ "-"
+			+ rndInt(1000);
+	}
+	public static String rndEmail(String userID) {
+		return userID + "@" + rndInt(100) + ".com";
+	}
+	public static String rndFullName() {
+		return "first:" + rndInt(1000) + " last:" + rndInt(5000);
+	}
+	public static int rndInt(int i) {
+		return (new Float(random() * i)).intValue();
+	}
+	public static float rndFloat(int i) {
+		return (new Float(random() * i)).floatValue();
+	}
+	public static BigDecimal rndBigDecimal(float f) {
+		return (new BigDecimal(random() * f)).setScale(
+			2,
+			BigDecimal.ROUND_HALF_UP);
+	}
+
+	public static boolean rndBoolean() {
+		return randomNumberGenerator.nextBoolean();
+	}
+
+	/**
+	 * Returns a new Trade user
+	 * Creation date: (2/16/2000 8:50:35 PM)
+	 */
+	public synchronized static String rndNewUserID() {
+
+		return newUserPrefix
+			+ getHostname()
+			+ System.currentTimeMillis()
+			+ count++;
+	}
+
+	public static float rndPrice() {
+		return ((new Integer(rndInt(200))).floatValue()) + 1.0f;
+	}
+	private final static BigDecimal ONE = new BigDecimal(1.0);
+	public static BigDecimal getRandomPriceChangeFactor() {
+		//stocks are equally likely to go up or down
+		double percentGain = rndFloat(1) + 0.5;
+		// change factor is between +/- 50%
+		BigDecimal percentGainBD =
+			(new BigDecimal(percentGain)).setScale(2, BigDecimal.ROUND_HALF_UP);
+		if (percentGainBD.doubleValue() <= 0.0)
+			percentGainBD = ONE;
+
+		return percentGainBD;
+	}
+
+	public static float rndQuantity() {
+		return ((new Integer(rndInt(200))).floatValue()) + 1.0f;
+	}
+
+	public static String rndSymbol() {
+		return "s:" + rndInt(MAX_QUOTES - 1);
+	}
+	public static String rndSymbols() {
+
+		String symbols = "";
+		int num_symbols = rndInt(QUOTES_PER_PAGE);
+
+		for (int i = 0; i <= num_symbols; i++) {
+			symbols += "s:" + rndInt(MAX_QUOTES - 1);
+			if (i < num_symbols)
+				symbols += ",";
+		}
+		return symbols;
+	}
+
+	public static String rndUserID() {
+		String nextUser = getNextUserIDFromDeck();
+		if (Log.doTrace())
+			Log.trace("TradeConfig:rndUserID -- new trader = " + nextUser);
+
+		return nextUser;
+	}
+
+	private static synchronized String getNextUserIDFromDeck() {
+		int numUsers = getMAX_USERS();
+		if (deck == null) {
+			deck = new ArrayList(numUsers);
+			for (int i = 0; i < numUsers; i++)
+				deck.add(i, new Integer(i));
+			java.util.Collections.shuffle(deck, r0);
+		}
+		if (card >= numUsers)
+			card = 0;
+		return "uid:" + deck.get(card++);
+
+	}
+
+	//Trade implements a card deck approach to selecting 
+	// users for trading with tradescenarioservlet
+	private static ArrayList deck = null;
+	private static int card = 0;
+
+	/**
+	 * Set the list of run time mode names
+	 * Creation date: (3/8/2000 5:58:34 PM)
+	 * @param newRunTimeModeNames java.lang.String[]
+	 */
+	public static void setRunTimeModeNames(
+		java.lang.String[] newRunTimeModeNames) {
+		runTimeModeNames = newRunTimeModeNames;
+	}
+	/**
+	 * This is a convenience method for servlets to set Trade configuration parameters
+	 * from servlet initialization parameters. The servlet provides the init param and its
+	 * value as strings. This method then parses the parameter, converts the value to the
+	 * correct type and sets the corresponding TradeConfig parameter to the converted value
+	 * 
+	 */
+	public static void setConfigParam(String parm, String value) {
+		Log.log("TradeConfig setting parameter: " + parm + "=" + value);
+		// Compare the parm value to valid TradeConfig parameters that can be set
+		// by servlet initialization
+
+		// First check the proposed new parm and value - if empty or null ignore it
+		if (parm == null)
+			return;
+		parm = parm.trim();
+		if (parm.length() <= 0)
+			return;
+		if (value == null)
+			return;
+		value = value.trim();
+
+		if (parm.equalsIgnoreCase("runTimeMode")) {
+			try {
+				for (int i = 0; i < runTimeModeNames.length; i++) {
+					if (value.equalsIgnoreCase(runTimeModeNames[i])) {
+						runTimeMode = i;
+						break;
+					}
+				}
+			} catch (Exception e) {
+				//>>rjm
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "trying to set runtimemode to "
+						+ value
+						+ "reverting to current value: "
+						+ runTimeModeNames[runTimeMode],
+					e);
+			} // If the value is bad, simply revert to current
+		} else if (parm.equalsIgnoreCase("orderProcessingMode")) {
+			try {
+				for (int i = 0; i < orderProcessingModeNames.length; i++) {
+					if (value.equalsIgnoreCase(orderProcessingModeNames[i])) {
+						orderProcessingMode = i;
+						break;
+					}
+				}
+			} catch (Exception e) {
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "trying to set orderProcessingMode to "
+						+ value
+						+ "reverting to current value: "
+						+ orderProcessingModeNames[orderProcessingMode],
+					e);
+			} // If the value is bad, simply revert to current
+		} else if (parm.equalsIgnoreCase("accessMode")) {		
+			try {
+				for (int i = 0; i < accessModeNames.length; i++) {
+					if (value.equalsIgnoreCase(accessModeNames[i])) {
+						accessMode = i;
+						break;
+					}
+				}
+			}
+			catch (Exception e) {
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "trying to set accessMode to "
+						+ value
+						+ "reverting to current value: "
+						+ accessModeNames[accessMode],
+					e);
+			}
+		} else if (parm.equalsIgnoreCase("webServicesEndpoint")) {
+			try {
+				setSoapURL(value);
+			} catch (Exception e) {
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "Setting web services endpoint",
+					e);
+			} //On error, revert to saved		
+		} else if (parm.equalsIgnoreCase("workloadMix")) {
+			try {
+				for (int i = 0; i < workloadMixNames.length; i++) {
+					if (value.equalsIgnoreCase(workloadMixNames[i])) {
+						workloadMix = i;
+						break;
+					}
+				}
+			} catch (Exception e) {
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "trying to set workloadMix to "
+						+ value
+						+ "reverting to current value: "
+						+ workloadMixNames[workloadMix],
+					e);
+			} // If the value is bad, simply revert to current		
+		} else if (parm.equalsIgnoreCase("WebInterface")) {
+			try {
+				for (int i = 0; i < webInterfaceNames.length; i++) {
+					if (value.equalsIgnoreCase(webInterfaceNames[i])) {
+						webInterface = i;
+						break;
+					}
+				}
+			} catch (Exception e) {
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "trying to set WebInterface to "
+						+ value
+						+ "reverting to current value: "
+						+ webInterfaceNames[webInterface],
+					e);
+
+			} // If the value is bad, simply revert to current
+		} else if (parm.equalsIgnoreCase("CachingType")) {
+			try {
+				for (int i = 0; i < cachingTypeNames.length; i++) {
+					if (value.equalsIgnoreCase(cachingTypeNames[i])) {
+						cachingType = i;
+						break;
+					}
+				}
+			} catch (Exception e) {
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "trying to set CachingType to "
+						+ value
+						+ "reverting to current value: "
+						+ cachingTypeNames[cachingType],
+					e);
+			} // If the value is bad, simply revert to current
+		} else if (parm.equalsIgnoreCase("maxUsers")) {
+			try {
+				MAX_USERS = Integer.parseInt(value);
+			} catch (Exception e) {
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "Setting maxusers, error parsing string to int:"
+						+ value
+						+ "revering to current value: "
+						+ MAX_USERS,
+					e);
+			} //On error, revert to saved		
+		} else if (parm.equalsIgnoreCase("maxQuotes")) {
+			try {
+				MAX_QUOTES = Integer.parseInt(value);
+			} catch (Exception e) {
+				//>>rjm
+				Log.error(
+					"TradeConfig.setConfigParm(...) minor exception caught"
+						+ "Setting max_quotes, error parsing string to int "
+						+ value
+						+ "reverting to current value: "
+						+ MAX_QUOTES,
+					e);
+				//<<rjm
+			} //On error, revert to saved		
+		} else if (parm.equalsIgnoreCase("primIterations")) {
+			try {
+				primIterations = Integer.parseInt(value);
+			} catch (Exception e) {
+				Log.error(
+					"TradeConfig.setConfigParm(..): minor exception caught"
+						+ "Setting primIterations, error parsing string to int:"
+						+ value
+						+ "revering to current value: "
+						+ primIterations,
+					e);
+			} //On error, revert to saved
+		}		
+	}
+
+	/**
+	 * Gets the orderProcessingModeNames
+	 * @return Returns a String[]
+	 */
+	public static String[] getOrderProcessingModeNames() {
+		return orderProcessingModeNames;
+	}
+
+	/**
+	 * Gets the workloadMixNames
+	 * @return Returns a String[]
+	 */
+	public static String[] getWorkloadMixNames() {
+		return workloadMixNames;
+	}
+
+	/**
+	 * Gets the webInterfaceNames
+	 * @return Returns a String[]
+	 */
+	public static String[] getWebInterfaceNames() {
+		return webInterfaceNames;
+	}
+
+	/**
+	 * Gets the webInterfaceNames
+	 * @return Returns a String[]
+	 */
+	public static String[] getCachingTypeNames() {
+		return cachingTypeNames;
+	}
+
+	/**
+	 * Gets the scenarioMixes
+	 * @return Returns a int[][]
+	 */
+	public static int[][] getScenarioMixes() {
+		return scenarioMixes;
+	}
+
+	/**
+	 * Gets the trace
+	 * @return Returns a boolean
+	 */
+	public static boolean getTrace() {
+		return trace;
+	}
+	/**
+	 * Sets the trace
+	 * @param trace The trace to set
+	 */
+	public static void setTrace(boolean traceValue) {
+		trace = traceValue;
+	}
+
+	/**
+	 * Gets the mAX_USERS.
+	 * @return Returns a int
+	 */
+	public static int getMAX_USERS() {
+		return MAX_USERS;
+	}
+
+	/**
+	 * Sets the mAX_USERS.
+	 * @param mAX_USERS The mAX_USERS to set
+	 */
+	public static void setMAX_USERS(int mAX_USERS) {
+		MAX_USERS = mAX_USERS;
+		deck = null; // reset the card deck for selecting users
+	}
+
+	/**
+	 * Gets the mAX_QUOTES.
+	 * @return Returns a int
+	 */
+	public static int getMAX_QUOTES() {
+		return MAX_QUOTES;
+	}
+
+	/**
+	 * Sets the mAX_QUOTES.
+	 * @param mAX_QUOTES The mAX_QUOTES to set
+	 */
+	public static void setMAX_QUOTES(int mAX_QUOTES) {
+		MAX_QUOTES = mAX_QUOTES;
+	}
+
+	/**
+	 * Gets the mAX_HOLDINGS.
+	 * @return Returns a int
+	 */
+	public static int getMAX_HOLDINGS() {
+		return MAX_HOLDINGS;
+	}
+
+	/**
+	 * Sets the mAX_HOLDINGS.
+	 * @param mAX_HOLDINGS The mAX_HOLDINGS to set
+	 */
+	public static void setMAX_HOLDINGS(int mAX_HOLDINGS) {
+		MAX_HOLDINGS = mAX_HOLDINGS;
+	}
+
+	/**
+	 * Gets the actionTrace.
+	 * @return Returns a boolean
+	 */
+	public static boolean getActionTrace() {
+		return actionTrace;
+	}
+
+	/**
+	 * Sets the actionTrace.
+	 * @param actionTrace The actionTrace to set
+	 */
+	public static void setActionTrace(boolean actionTrace) {
+		TradeConfig.actionTrace = actionTrace;
+	}
+
+	/**
+	 * Gets the scenarioCount.
+	 * @return Returns a int
+	 */
+	public static int getScenarioCount() {
+		return scenarioCount;
+	}
+
+	/**
+	 * Sets the scenarioCount.
+	 * @param scenarioCount The scenarioCount to set
+	 */
+	public static void setScenarioCount(int scenarioCount) {
+		TradeConfig.scenarioCount = scenarioCount;
+	}
+
+	public static synchronized void incrementScenarioCount() {
+		scenarioCount++;
+	}
+
+	/**
+	 * Gets the jdbc driver needs global transaction
+	 * Some XA Drivers require a global transaction to be started
+	 * for all SQL calls.  To work around this, set this to true
+	 * to cause the direct mode to start a user transaction.
+	 * @return Returns a boolean
+	 */
+	public static boolean getJDBCDriverNeedsGlobalTransation() {
+		return JDBCDriverNeedsGlobalTransation;
+	}
+
+	/**
+	 * Sets the jdbc driver needs global transaction
+	 * @param JDBCDriverNeedsGlobalTransationVal the value
+	 */
+	public static void setJDBCDriverNeedsGlobalTransation(boolean JDBCDriverNeedsGlobalTransationVal) {
+		JDBCDriverNeedsGlobalTransation = JDBCDriverNeedsGlobalTransationVal;
+	}
+
+	/**
+	 * Gets the updateQuotePrices.
+	 * @return Returns a boolean
+	 */
+	public static boolean getUpdateQuotePrices() {
+		return updateQuotePrices;
+	}
+
+	/**
+	 * Sets the updateQuotePrices.
+	 * @param updateQuotePrices The updateQuotePrices to set
+	 */
+	public static void setUpdateQuotePrices(boolean updateQuotePrices) {
+		TradeConfig.updateQuotePrices = updateQuotePrices;
+	}
+	
+	public static String getSoapURL() {
+		return SoapURL;
+	}
+	
+	public static void setSoapURL(String value) {
+		SoapURL = value;
+//		TradeWebSoapProxy.updateServicePort();
+	}
+	
+	public static int getAccessMode() {
+		return accessMode;
+	}
+	
+	public static void setAccessMode(int value) {
+		accessMode = value;
+//		TradeWebSoapProxy.updateServicePort();
+	}
+
+	public static int getPrimIterations() {
+		return primIterations;
+	}
+	
+	public static void setPrimIterations(int iter) {
+		primIterations = iter;
+	}	
+}

Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeServices.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeServices.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeServices.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeServices.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,275 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader;
+
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.math.BigDecimal;
+import java.util.Collection;
+
+/**
+  * 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 {@link Trade} providing an EJB implementation of these
+  * business methods and also by {@link TradeDirect} providing a JDBC implementation.
+  *
+  * @see Trade
+  * @see TradeDirect
+  *
+  */ 
+public interface TradeServices extends Remote {
+
+   /**
+	 * 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
+	 *
+	 * @return A snapshot of the current market summary
+	 */
+	public MarketSummaryDataBean getMarketSummary() 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
+	 *
+	 * @param userID the customer requesting the stock purchase
+	 * @param symbol the symbol of the stock being purchased
+	 * @param quantity the quantity of shares to purchase	 
+	 * @return OrderDataBean providing the status of the newly created buy order
+	 */
+
+
+	public OrderDataBean buy(String userID, String symbol, double quantity, 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.
+	 *
+	 * @param userID the customer requesting the sell
+ 	 * @param holdingID the users holding to be sold
+	 * @return OrderDataBean providing the status of the newly created sell order
+	 */
+	public OrderDataBean sell(String userID, Integer holdingID, int orderProcessingMode) 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
+	 *
+	 * @param orderID the Order being queued for processing
+	 * @return OrderDataBean providing the status of the completed order
+	 */
+	public void queueOrder(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
+	 *
+	 * @param orderID the Order to complete
+	 * @return OrderDataBean providing the status of the completed order
+	 */
+	public OrderDataBean completeOrder(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
+	 *
+	 * @param orderID the Order to complete
+	 * @return OrderDataBean providing the status of the completed order
+	 */
+	public void cancelOrder(Integer orderID, boolean twoPhase) throws Exception, RemoteException;
+
+
+   /**
+	 * Signify an order has been completed for the given userID
+	 * 
+	 * @param userID the user for which an order has completed
+	 * @param orderID the order which has completed
+	 * 
+	 */
+	public void orderCompleted(String userID, Integer orderID) throws Exception, RemoteException;
+	
+
+   /**
+	 * Get the collection of all orders for a given account
+	 *
+	 * @param userID the customer account to retrieve orders for
+	 * @return Collection OrderDataBeans providing detailed order information
+	 */
+	public Collection getOrders(String userID) throws Exception, RemoteException;
+
   /**
+	 * Get the collection of completed orders for a given account that need to be alerted to the user
+	 *
+	 * @param userID the customer account to retrieve orders for
+	 * @return Collection OrderDataBeans providing detailed order information
+	 */
+	public Collection getClosedOrders(String userID) throws Exception, RemoteException;
+
+
+	/**
+	 * Given a market symbol, price, and details, create and return a new {@link QuoteDataBean}
+	 *
+	 * @param symbol the symbol of the stock
+	 * @param price the current stock price
+	 * @param details a short description of the stock or company
+	 * @return a new QuoteDataBean or null if Quote could not be created
+	 */
+	public QuoteDataBean createQuote(String symbol, String companyName, BigDecimal price) throws Exception, RemoteException;
+
+   /**
+	 * Return a {@link QuoteDataBean} describing a current quote for the given stock symbol
+	 *
+	 * @param symbol the stock symbol to retrieve the current Quote
+	 * @return the QuoteDataBean
+	 */
+	public QuoteDataBean getQuote(String symbol) throws Exception, RemoteException;
+
+   /**
+	 * Return a {@link java.util.Collection} of {@link QuoteDataBean} 
+	 * describing all current quotes
+	 * @return A collection of  QuoteDataBean
+	 */
+	public Collection getAllQuotes() throws Exception, RemoteException;
+
+   /**
+	 * Update the stock quote price and volume for the specified stock symbol
+	 *
+	 * @param symbol for stock quote to update
+	 * @param price the updated quote price
+	 * @return the QuoteDataBean describing the stock
+	 */
+	public QuoteDataBean updateQuotePriceVolume(String symbol, BigDecimal newPrice, double sharesTraded) throws Exception, RemoteException;
+
+		
+   /**
+	 * Return the portfolio of stock holdings for the specified customer
+	 * as a collection of HoldingDataBeans
+	 *
+	 * @param userID the customer requesting the portfolio	 
+	 * @return Collection of the users portfolio of stock holdings
+	 */
+	public Collection getHoldings(String userID) throws Exception, RemoteException;
+
+   /**
+	 * Return a specific user stock holding identifed by the holdingID
+	 *
+	 * @param holdingID the holdingID to return	 
+	 * @return a HoldingDataBean describing the holding
+	 */
+	public HoldingDataBean getHolding(Integer holdingID) throws Exception, RemoteException;
+
+	/**
+	 * Return an AccountDataBean object for userID describing the account
+	 *
+	 * @param userID the account userID to lookup
+	 * @return User account data in AccountDataBean
+	 */	
+   public AccountDataBean getAccountData(String userID) 
+   		throws javax.ejb.FinderException, Exception;                              
+
+	/**
+	 * Return an AccountProfileDataBean for userID providing the users profile
+	 *
+	 * @param userID the account userID to lookup
+	 * @param User account profile data in AccountProfileDataBean
+	 */
+   public AccountProfileDataBean getAccountProfileData(String userID) throws Exception, RemoteException;                              
+
+	/**
+	 * Update userID's account profile information using the provided AccountProfileDataBean object
+	 *
+	 * @param userID the account userID to lookup
+	 * @param User account profile data in AccountProfileDataBean
+	 */
+   public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) throws Exception, RemoteException;                              
+
+
+	/**
+	 * Attempt to authenticate and login a user with the given password
+	 *
+	 * @param userID the customer to login
+	 * @param password the password entered by the customer for authentication
+	 * @return User account data in AccountDataBean
+	 */
+   public AccountDataBean login(String userID, String password) throws Exception, RemoteException;                              
+
+	/**
+	 * Logout the given user
+	 *
+	 * @param userID the customer to logout 
+	 * @return the login status
+	 */
+
+   public void logout(String userID) throws Exception, RemoteException; 
+                                            
+	/**
+	 * Register a new Trade customer.
+	 * Create a new user profile, user registry entry, account with initial balance,
+	 * and empty portfolio.
+	 *
+	 * @param userID the new customer to register
+	 * @param password the customers password
+	 * @param fullname the customers fullname
+	 * @param address  the customers street address
+	 * @param email    the customers email address
+	 * @param creditcard the customers creditcard number
+	 * @param initialBalance the amount to charge to the customers credit to open the account and set the initial balance
+	 * @return the userID if successful, null otherwise
+	 */
+	public AccountDataBean register(String userID,
+								  String password,
+								  String fullname,
+								  String address,
+								  String email,
+								  String creditcard,
+								  BigDecimal openBalance) 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
+	 */
+    public RunStatsDataBean resetTrade(boolean deleteAll) throws Exception, RemoteException;
+}   
+

Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeWSAction.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeWSAction.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeWSAction.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeWSAction.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,124 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader;
+
+import java.math.*;
+import java.rmi.RemoteException;
+
+/**
+ * @author aspyker
+ *
+ * This is a TradeAction wrapper to handle web service handling
+ * of collections.  Instead this class uses typed arrays.
+ */
+public class TradeWSAction {
+	TradeAction trade;
+	
+	public TradeWSAction() {
+		trade = new TradeAction();
+	}
+
+	public MarketSummaryDataBeanWS getMarketSummary() throws Exception, RemoteException {
+		org.apache.geronimo.samples.daytrader.MarketSummaryDataBean marketSummary = trade.getMarketSummary();
+		return MarketSummaryDataBeanWS.convertBean(marketSummary);
+	}
+	
+	public OrderDataBean buy(String userID, String symbol, double quantity, int orderProcessingMode) throws Exception, RemoteException {
+		return trade.buy(userID, symbol, quantity, orderProcessingMode);
+	}
+	
+	public OrderDataBean sell(String userID, Integer holdingID, int orderProcessingMode) throws Exception, RemoteException {
+		return trade.sell(userID, holdingID, orderProcessingMode);
+	}
+
+	public void queueOrder(Integer orderID, boolean twoPhase) throws Exception, RemoteException {
+		trade.queueOrder(orderID, twoPhase);
+	}
+	
+	public OrderDataBean completeOrder(Integer orderID, boolean twoPhase) throws Exception, RemoteException {
+		return trade.completeOrder(orderID, twoPhase);
+	}
+
+	public void cancelOrder(Integer orderID, boolean twoPhase) throws Exception, RemoteException {
+		trade.cancelOrder(orderID, twoPhase);
+	}
+	
+	public void orderCompleted(String userID, Integer orderID) throws Exception, RemoteException {
+		trade.orderCompleted(userID, orderID);
+	}
+	
+	public OrderDataBean[] getOrders(String userID) throws Exception, RemoteException {
+		return (OrderDataBean[])((trade.getOrders(userID)).toArray(new OrderDataBean[0]));
+	}
+	
+	public OrderDataBean[] getClosedOrders(String userID) throws Exception, RemoteException {
+		return (OrderDataBean[])((trade.getClosedOrders(userID)).toArray(new OrderDataBean[0]));
+	}
+	
+	public QuoteDataBean createQuote(String symbol, String companyName, BigDecimal price) throws Exception, RemoteException {
+		return trade.createQuote(symbol, companyName, price);
+	}
+	
+	public QuoteDataBean getQuote(String symbol) throws Exception, RemoteException {
+		return trade.getQuote(symbol);
+	}
+	
+	public QuoteDataBean[] getAllQuotes() throws Exception, RemoteException {
+		return (QuoteDataBean[])((trade.getAllQuotes()).toArray(new QuoteDataBean[0]));
+	}
+	
+	public QuoteDataBean updateQuotePriceVolume(String symbol, BigDecimal newPrice, double sharesTraded) throws Exception, RemoteException {
+		return trade.updateQuotePriceVolume(symbol, newPrice, sharesTraded);
+	}
+	
+	public HoldingDataBean[] getHoldings(String userID) throws Exception, RemoteException {
+		return (HoldingDataBean[])((trade.getHoldings(userID)).toArray(new HoldingDataBean[0]));
+	}
+	
+	public HoldingDataBean getHolding(Integer holdingID) throws Exception, RemoteException {
+		return trade.getHolding(holdingID);
+	}
+	
+	public AccountDataBean getAccountData(String userID) throws Exception, RemoteException {
+		return trade.getAccountData(userID);
+	}
+	
+	public AccountProfileDataBean getAccountProfileData(String userID) throws Exception, RemoteException {
+		return trade.getAccountProfileData(userID);
+	}
+	
+	public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) throws Exception, RemoteException {
+		return trade.updateAccountProfile(profileData);
+	}
+	
+	public AccountDataBean login(String userID, String password) throws Exception, RemoteException {
+		return trade.login(userID, password);
+	}
+	
+	public void logout(String userID) throws Exception, RemoteException {
+		trade.logout(userID);
+	}
+	
+	public AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditcard, BigDecimal openBalance) throws Exception, RemoteException {
+		return trade.register(userID, password, fullname, address, email, creditcard, openBalance);
+	}
+	
+	public RunStatsDataBean resetTrade(boolean deleteAll) throws Exception, RemoteException {
+		return trade.resetTrade(deleteAll);
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeWSServices.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeWSServices.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeWSServices.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/TradeWSServices.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,43 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader;
+
+public interface TradeWSServices extends java.rmi.Remote {
+    public org.apache.geronimo.samples.daytrader.MarketSummaryDataBeanWS getMarketSummary() throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.OrderDataBean buy(java.lang.String userID, java.lang.String symbol, double quantity, int orderProcessingMode) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.OrderDataBean sell(java.lang.String userID, java.lang.Integer holdingID, int orderProcessingMode) throws java.rmi.RemoteException;
+    public void queueOrder(java.lang.Integer orderID, boolean twoPhase) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.OrderDataBean completeOrder(java.lang.Integer orderID, boolean twoPhase) throws java.rmi.RemoteException;
+    public void cancelOrder(java.lang.Integer orderID, boolean twoPhase) throws java.rmi.RemoteException;
+    public void orderCompleted(java.lang.String userID, java.lang.Integer orderID) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.OrderDataBean[] getOrders(java.lang.String userID) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.OrderDataBean[] getClosedOrders(java.lang.String userID) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.QuoteDataBean createQuote(java.lang.String symbol, java.lang.String companyName, java.math.BigDecimal price) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.QuoteDataBean getQuote(java.lang.String symbol) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.QuoteDataBean[] getAllQuotes() throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.QuoteDataBean updateQuotePriceVolume(java.lang.String symbol, java.math.BigDecimal newPrice, double sharesTraded) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.HoldingDataBean[] getHoldings(java.lang.String userID) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.HoldingDataBean getHolding(java.lang.Integer holdingID) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.AccountDataBean getAccountData(java.lang.String userID) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.AccountProfileDataBean getAccountProfileData(java.lang.String userID) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.AccountProfileDataBean updateAccountProfile(org.apache.geronimo.samples.daytrader.AccountProfileDataBean profileData) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.AccountDataBean login(java.lang.String userID, java.lang.String password) throws java.rmi.RemoteException;
+    public void logout(java.lang.String userID) throws java.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.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.rmi.RemoteException;
+    public org.apache.geronimo.samples.daytrader.RunStatsDataBean resetTrade(boolean deleteAll) throws java.rmi.RemoteException;
+}

Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/direct/KeySequenceDirect.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/direct/KeySequenceDirect.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/direct/KeySequenceDirect.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/direct/KeySequenceDirect.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,119 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.direct;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.HashMap;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import org.apache.geronimo.samples.daytrader.util.*;
+
+import org.apache.geronimo.samples.daytrader.*;
+
+public class KeySequenceDirect {
+
+	private static HashMap keyMap = new HashMap();
+
+    public static synchronized Integer getNextID(Connection conn, String keyName, boolean inGlobalTxn)
+	throws Exception
+    {
+		Integer nextID = null;
+		// First verify we have allocated a block of keys 
+		// for this key name
+		// Then verify the allocated block has not been depleted
+		// allocate a new block if necessary
+		if ( keyMap.containsKey(keyName) == false)
+			allocNewBlock(conn, keyName, inGlobalTxn);
+		Collection block = 	(Collection) keyMap.get(keyName);
+		
+		Iterator ids = block.iterator();
+		if ( ids.hasNext() == false )
+			ids = allocNewBlock(conn, keyName, inGlobalTxn).iterator();
+		//get and return a new unique key
+		nextID = (Integer) ids.next();
+
+		if (Log.doTrace()) Log.trace("KeySequenceDirect:getNextID - return new PK ID for Entity type: " + keyName + " ID=" + nextID);
+		return nextID;
+	}
+
+	private static Collection allocNewBlock(Connection conn, String keyName, boolean inGlobalTxn)  
+	throws Exception
+	{
+		try 
+		{
+			if (inGlobalTxn == false) conn.commit();  // commit any pending txns
+			PreparedStatement stmt = conn.prepareStatement(getKeyForUpdateSQL);
+			stmt.setString(1, keyName);
+			ResultSet rs = stmt.executeQuery();
+			if (!rs.next()) 
+			{
+				// No keys found for this name - create a new one
+				PreparedStatement stmt2 = conn.prepareStatement(createKeySQL);
+				int keyVal = 0;
+				stmt2.setString(1, keyName);
+				stmt2.setInt(2, keyVal);				
+				int rowCount = stmt2.executeUpdate();
+				stmt2.close();
+				stmt.close();
+				stmt = conn.prepareStatement(getKeyForUpdateSQL);				
+				stmt.setString(1, keyName);				
+				rs = stmt.executeQuery();
+				rs.next();		
+			}
+			
+			int keyVal = rs.getInt("keyval");
+			
+			stmt.close();
+			
+			stmt = conn.prepareStatement(updateKeyValueSQL);
+			stmt.setInt(1, keyVal+TradeConfig.KEYBLOCKSIZE);
+			stmt.setString(2, keyName);			
+			int rowCount = stmt.executeUpdate();
+			stmt.close();
+
+			Collection block = new KeyBlock(keyVal, keyVal+TradeConfig.KEYBLOCKSIZE-1);
+			keyMap.put(keyName, block);
+			if (inGlobalTxn == false) conn.commit();
+			return block;			
+		}
+		catch (Exception e)
+		{
+			String error = "KeySequenceDirect:allocNewBlock - failure to allocate new block of keys for Entity type: "+ keyName;
+			Log.error(e, error);
+			throw new Exception(error + e.toString());
+		}
+	}
+	
+	private static final String getKeyForUpdateSQL  = 
+		"select * from keygenejb kg where kg.keyname = ?  for update";
+	
+	private static final String createKeySQL =
+		"insert into keygenejb " +
+		"( keyname, keyval ) " +
+		"VALUES (  ?  ,  ? )";
+		
+	private static final String updateKeyValueSQL = 
+		"update keygenejb set keyval = ? " +
+		"where keyname = ?";
+		
+}
+



Mime
View raw message