incubator-stonehenge-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bende...@apache.org
Subject svn commit: r801507 [7/8] - in /incubator/stonehenge/contrib/stocktrader/metro: ./ business_service/ business_service/config/ business_service/etc/ business_service/etc/order_processor/ business_service/lib/ business_service/src/ business_service/src/o...
Date Thu, 06 Aug 2009 03:41:20 GMT
Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/service/OrderProcessorImpl.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/service/OrderProcessorImpl.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/service/OrderProcessorImpl.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/service/OrderProcessorImpl.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.stonehenge.stocktrader.service;
+
+import org.tempuri.OrderProcessorService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stonehenge.stocktrader.CustomOrderBean;
+import org.apache.stonehenge.stocktrader.util.OrderProcessorUtility;
+import org.apache.stonehenge.stocktrader.dal.DAOException;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+import traderorderhost.trade.SubmitOrder;
+import traderorderhost.trade.IsOnline;
+import com.ibm.websphere.samples.trade.OrderDataBean;
+
+@WebService(endpointInterface = "org.tempuri.OrderProcessorService")
+public class OrderProcessorImpl implements OrderProcessorService {
+    private static final Log logger = LogFactory
+			.getLog(OrderProcessorImpl.class);
+	// OrderProcessManager is the controller for managing order processing.
+	private final OrderProcessManager orderProcessManager = new OrderProcessManager();
+
+    public void submitOrder(@WebParam(name = "SubmitOrder", targetNamespace = "http://Trade.TraderOrderHost", partName =
+            "parameters") SubmitOrder submitOrder) {
+        OrderDataBean order = submitOrder.getOrder();
+		CustomOrderBean orderData = new CustomOrderBean(order);
+		try {
+			processOrder(orderData);
+		} catch (DAOException e) {
+			logger.error("", e);
+		}
+    }
+
+    public void isOnline(@WebParam(name = "isOnline", targetNamespace = "http://Trade.TraderOrderHost", partName =
+            "parameters") IsOnline parameters) {
+        logger.debug("OrderProcessorImpl.isOnline(IsOnlines)");
+    }
+
+    private void processOrder(CustomOrderBean queueOrder) throws DAOException {
+		// 2 seconds delay to ensure that MSFT-BL has committed new order
+		// entries to the database which will happen when it gets HTTP 202
+		// accepted header
+		OrderProcessorUtility.pauseForTwoSeconds();
+		orderProcessManager.processAndCompleteOrder(queueOrder);
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/util/OrderProcessorUtility.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/util/OrderProcessorUtility.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/util/OrderProcessorUtility.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/util/OrderProcessorUtility.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.stonehenge.stocktrader.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A class which contains utility functions for order processing.
+ */
+public class OrderProcessorUtility {
+	private static final Log logger = LogFactory
+			.getLog(OrderProcessorUtility.class);
+	
+	public static void pauseForTwoSeconds() {
+		logger.debug("OrderProcessorImpl.sleepForTwoSec()");
+		try {
+			Thread.sleep(2 * 1000);
+		} catch (InterruptedException e) {
+			if (logger.isDebugEnabled()) {
+				logger.debug("Unable to sleep for 2 sec", e);
+			}
+		}
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/util/StockTraderUtility.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/util/StockTraderUtility.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/util/StockTraderUtility.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/apache/stonehenge/stocktrader/util/StockTraderUtility.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.stonehenge.stocktrader.util;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.util.Calendar;
+import java.util.Random;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class StockTraderUtility {
+	
+	public static final String TRADE_ORDER_SERVICE_PROPERTY_FILE = "TradeServiceConfig.properties";
+	public static final String TRADE_ORDER_SERVICE_SECURITY_FILE = "security-policy.xml";
+	public static final String MSSQL_DB_PROPERRTIES_FILE = "mssql-db.properties";
+    public static final String DB_PROPERRTIES_FILE = "db.properties";
+	public static final String ORDER_TYPE_BUY = "buy";
+	public static final String ORDER_TYPE_SELL = "sell";
+	public static final String ORDER_TYPE_SELL_ENHANCED = "sellEnhanced";
+	public static final String ORDER_STATUS_CLOSED = "closed";
+	public static final String ORDER_STATUS_OPEN = "open";
+
+	public static final int MAX_QUERY_TOP_ORDERS = 5;
+	public static final int MAX_QUERY_ORDERS = 5;
+
+	public static final BigDecimal PENNY_STOCK_P = BigDecimal.valueOf(0.1);
+	public static final BigDecimal JUNK_STOCK_MIRACLE_MULTIPLIER = BigDecimal
+			.valueOf(500);
+	public static final BigDecimal STOCK_P_HIGH_BAR = BigDecimal.valueOf(1000);
+	public static final BigDecimal STOCK_P_HIGH_BAR_CRASH = BigDecimal
+			.valueOf(0.05);
+	public static final BigDecimal STOCK_CHANGE_MAX_PERCENT = BigDecimal
+			.valueOf(5);
+	public static final BigDecimal BUY_FEE = BigDecimal.valueOf(15.95);
+	public static final BigDecimal SELL_FEE = BigDecimal.valueOf(25.95);
+
+	private static final Log logger = LogFactory
+			.getLog(StockTraderUtility.class);
+
+	public static BigDecimal getRandomPriceChangeFactor(BigDecimal currentPrice) {
+		if (currentPrice.compareTo(PENNY_STOCK_P) == -1
+				|| currentPrice.compareTo(PENNY_STOCK_P) == 0) {
+			return JUNK_STOCK_MIRACLE_MULTIPLIER;
+		} else if (currentPrice.compareTo(STOCK_P_HIGH_BAR) == 1
+				|| currentPrice.compareTo(STOCK_P_HIGH_BAR) == 0) {
+			return STOCK_P_HIGH_BAR_CRASH;
+		}
+
+		BigDecimal factor = BigDecimal.valueOf(0);
+		Random rand = new Random();
+		int y = rand.nextInt(STOCK_CHANGE_MAX_PERCENT.subtract(BigDecimal.ONE)
+				.intValue());
+		y = y + 1;
+		int x = rand.nextInt();
+
+		if (x % 2 == 0) {
+			factor = BigDecimal.ONE.subtract((BigDecimal.valueOf(y))
+					.divide(BigDecimal.valueOf(100)));// / 100m;
+		} else
+			factor = BigDecimal.ONE.add(BigDecimal.ONE.add(BigDecimal
+					.valueOf(y).divide(BigDecimal.valueOf(100))));
+		return factor;
+	}
+
+	public static Date convertToSqlDate(Calendar calendar) {
+		return new Date(calendar.getTimeInMillis());
+	}
+
+	public static Calendar convertToCalendar(Date date) {
+		Calendar calendar = Calendar.getInstance();
+		calendar.setTimeInMillis(date.getTime());
+		return calendar;
+	}
+
+	public static BigDecimal getOrderFee(String orderType) {
+		if (StockTraderUtility.ORDER_TYPE_BUY.equals(orderType)
+				|| StockTraderUtility.ORDER_TYPE_SELL.equals(orderType)) {
+			return BUY_FEE;
+		} else {
+			return SELL_FEE;
+		}
+	}
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/resources/conf/TradeServiceConfig.properties
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/resources/conf/TradeServiceConfig.properties?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/resources/conf/TradeServiceConfig.properties (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/resources/conf/TradeServiceConfig.properties Thu Aug  6 03:41:14 2009
@@ -0,0 +1 @@
+org.apache.stonehenge.stocktrader.TradeConfigService.url=http://localhost:8090/config_service/ConfigService
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/resources/conf/db.properties
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/resources/conf/db.properties?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/resources/conf/db.properties (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/resources/conf/db.properties Thu Aug  6 03:41:14 2009
@@ -0,0 +1,16 @@
+org.apache.stonehenge.stocktrader.database.host=localhost
+org.apache.stonehenge.stocktrader.database.port=1433
+org.apache.stonehenge.stocktrader.database.db=stocktraderdb
+org.apache.stonehenge.stocktrader.database.user=trade
+org.apache.stonehenge.stocktrader.database.password=yyy
+org.apache.stonehenge.stocktrader.database.type=mssql
+
+
+
+#mysql
+#org.apache.stonehenge.stocktrader.database.port=3306
+#org.apache.stonehenge.stocktrader.database.type=mysql
+
+#mssql
+#org.apache.stonehenge.stocktrader.database.port=1433
+#org.apache.stonehenge.stocktrader.database.type=mssql
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/build.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/build.xml?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/build.xml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/build.xml Thu Aug  6 03:41:14 2009
@@ -0,0 +1,103 @@
+<project basedir="." default="war" name="trader_client">
+    <import file="../etc/as.xml"/>
+    
+    <property name="src.dir" value="${basedir}/src"/>
+    <property name="build.home" value="${basedir}/build"/>
+    <property name="build.classes.home" value="${build.home}/classes"/>
+    <property name="build.war.home" value="${build.home}/war"/>
+
+    <property name="lib.home" value="${basedir}/../lib"/>
+    <property name="lib.metro.home" value="${lib.home}/metro"/>
+    <property name="war.name" value="${ant.project.name}.war"/>
+    <property name="war.file" value="${build.war.home}/${war.name}"/>
+
+
+    <path id="all.classpath">
+        <fileset dir="${lib.home}">
+            <include name="**/*.jar"/>
+        </fileset>
+    </path>
+
+    <path id="metro.classpath">
+        <pathelement location="${java.home}/../lib/tools.jar"/>
+        <fileset dir="${lib.metro.home}">
+            <include name="*.jar"/>
+        </fileset>
+    </path>
+
+    <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
+        <classpath refid="metro.classpath"/>
+    </taskdef>
+
+    <target name="clean">
+        <delete dir="${build.home}" includeEmptyDirs="true"/>
+    </target>
+
+    <target name="setup" depends="clean">
+        <mkdir dir="${build.home}"/>
+        <mkdir dir="${build.classes.home}"/>
+        <mkdir dir="${build.war.home}"/>
+    </target>
+
+    <target name="generate-bs-client" depends="setup">
+        <wsimport
+                debug="${debug}"
+                verbose="${verbose}"
+                keep="${keep}"
+                destdir="${build.classes.home}"
+                wsdl="${business.service.wsdl}"
+                extension="true">
+            <binding dir="${business.service.binding.dir}" includes="${business.service.binding}"/>
+            <xjcarg value="-extension"/>
+        </wsimport>
+    </target>
+
+    <target name="generate-cs-client" depends="setup">
+        <wsimport
+                debug="${debug}"
+                verbose="${verbose}"
+                keep="${keep}"
+                destdir="${build.classes.home}"
+                wsdl="${config.service.wsdl}"
+                extension="true">
+            <binding dir="${config.service.binding.dir}" includes="${config.service.binding}"/>
+            <xjcarg value="-extension"/>
+        </wsimport>
+    </target>
+
+    <target name="build" depends="generate-bs-client,generate-cs-client">
+        <copy todir="${build.classes.home}">
+            <fileset dir="../resources/conf" includes="*.properties"/>
+        </copy>
+        <javac fork="true" srcdir="${src.dir}" destdir="${build.classes.home}">
+            <classpath refid="all.classpath"/>
+        </javac>
+    </target>
+
+    <target name="war" depends="build">
+        <war warfile="${war.file}" webxml="web/WEB-INF/web.xml">
+            <webinf dir="${basedir}/web/WEB-INF">
+                <include name="faces-config.xml"/>
+                <include name="sun-web.xml"/>
+                <include name="facelets/**/*"/>
+            </webinf>
+            <zipfileset dir="${basedir}/web" includes="*.jsp"/>
+            <zipfileset dir="${basedir}/web" includes="*.xhtml"/>
+            <zipfileset dir="${basedir}/web" includes="*.jsf"/>
+            <zipfileset dir="${basedir}/web/css" prefix="css"/>
+            <zipfileset dir="${basedir}/web/images" prefix="images"/>
+            <classes dir="${build.classes.home}"/>
+            <lib dir="${lib.home}/facelets"/>
+        </war>
+    </target>
+
+    <target name="deploy" depends="war">
+        <copy file="${war.file}" todir="${deploy.dir}"/>
+    </target>
+
+    <target name="undeploy">
+        <delete file="${deploy.dir}/${war.name}"/>
+    </target>
+
+    <target name="redeploy" depends="undeploy, deploy"/>
+</project>

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/AccountBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/AccountBean.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/AccountBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/AccountBean.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,61 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import java.util.List;
+
+import org.tempuri.ITradeServices;
+
+import com.ibm.websphere.samples.trade.AccountDataBean;
+import com.ibm.websphere.samples.trade.AccountProfileDataBean;
+import com.ibm.websphere.samples.trade.GetAccountData;
+import com.ibm.websphere.samples.trade.GetAccountProfileData;
+import com.ibm.websphere.samples.trade.GetOrders;
+import com.ibm.websphere.samples.trade.OrderDataBean;
+import com.ibm.websphere.samples.trade.UpdateAccountProfile;
+
+public class AccountBean {
+	private List<OrderDataBean> ordersReturn;
+	private AccountDataBean userAccountDataReturn;
+	private static final String DATE_TIME_FORMAT = "MM/dd/yyyy hh:mm:ss a";
+	private String currentUser;
+	private ITradeServices businessService;
+	private AccountSummary accountSummary;
+
+	public void setBusinessService(ITradeServices businessService) {
+		this.businessService = businessService;
+	}
+
+	public void setCurrentUser(String currentUser) {
+		this.currentUser = currentUser;
+	}
+
+	public AccountSummary getAccountSummary() {
+		if (accountSummary == null) {
+			accountSummary = new AccountSummary(getOrdersReturn());
+		}
+		return accountSummary;
+	}
+
+	public AccountDataBean getUserAccountDataReturn() {
+		if (userAccountDataReturn == null) {
+			GetAccountData accountData = new GetAccountData();
+			accountData.setUserID(currentUser);
+			userAccountDataReturn = businessService.getAccountData(accountData)
+					.getGetAccountDataReturn();
+		}
+		return userAccountDataReturn;
+	}
+
+	public List<OrderDataBean> getOrdersReturn() {
+		if (ordersReturn == null) {
+			GetOrders param = new GetOrders();
+			param.setUserID(currentUser);
+			ordersReturn = businessService.getOrders(param)
+					.getGetOrdersReturn().getOrderDataBean();
+		}
+		return ordersReturn;
+	}
+
+	public String getDateFormat() {
+		return DATE_TIME_FORMAT;
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/AccountSummary.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/AccountSummary.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/AccountSummary.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/AccountSummary.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,46 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import java.util.List;
+
+import com.ibm.websphere.samples.trade.OrderDataBean;
+
+public class AccountSummary {
+	private static final String ORDER_TYPE_BUY = "buy";
+	private static final String ORDER_TYPE_SELL = "sell";
+	private double buys;
+	private double sells;
+	private double tax;
+
+	public AccountSummary(List<OrderDataBean> orders) {
+		for (OrderDataBean order : orders) {
+			if (order.getOrderType().equals(ORDER_TYPE_BUY)) {
+				buys = buys
+						+ (order.getPrice().doubleValue()
+								* order.getQuantity().doubleValue() + order
+								.getOrderFee().doubleValue());
+			} else if (order.getOrderType().equals(ORDER_TYPE_SELL)) {
+				sells = sells
+						+ (order.getPrice().doubleValue()
+								* order.getQuantity().doubleValue() - order
+								.getOrderFee().doubleValue());
+			}
+			tax = tax + order.getOrderFee().doubleValue();
+		}
+	}
+	public double getTotalBuys() {
+		return buys;
+	}
+
+	public double getTotalSells() {
+		return sells;
+	}
+
+	public double getTotalTax() {
+		return tax;
+	}
+
+	public double getTotalImpact() {
+		return sells - buys - tax;
+	}
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/ConfigServiceBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/ConfigServiceBean.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/ConfigServiceBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/ConfigServiceBean.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,66 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import org.apache.stonehenge.stocktrader.service.ConfigServiceClient;
+import org.datacontract.schemas._2004._07.trade.ServiceLocation;
+
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class ConfigServiceBean {
+
+    private ConfigServiceClient configServiceClient;
+
+    private String selectedBS;
+    private String selectedOPS;
+
+    public ConfigServiceBean() {
+        configServiceClient = ConfigServiceClient.getInstance();
+        selectedBS = configServiceClient.getSelectedBS();
+        selectedOPS = configServiceClient.getSelectedOPS();
+    }
+
+    public String getSelectedBS() {
+        return selectedBS;
+    }
+
+    public String getSelectedOPS() {
+        return selectedOPS;
+    }
+
+    public void setSelectedBS(String selectedBS) {
+        this.selectedBS = selectedBS;
+    }
+
+    public void setSelectedOPS(String selectedOPS) {
+        this.selectedOPS = selectedOPS;
+    }
+
+    public Collection getBsNames() {
+        Collection bs = new ArrayList();
+        List<ServiceLocation> bsServiceLocationList = configServiceClient.getBSLocations();
+        for (ServiceLocation location : bsServiceLocationList) {
+            SelectItem selectItem = new SelectItem(location.getServiceName(), location.getServiceName());
+            bs.add(selectItem);
+        }
+        return bs;
+    }
+
+    public Collection getOpsNames() {
+        Collection ops = new ArrayList();
+        List<ServiceLocation> opsServiceLocationList = configServiceClient.getOPSLocations();
+        for (ServiceLocation location : opsServiceLocationList) {
+            ops.add(new SelectItem(location.getServiceName(), location.getServiceName()));
+        }
+        return ops;
+    }
+
+    public String setBSAndOPS() {
+        if (configServiceClient.setConfig("JAVA_CLIENT", selectedBS, selectedOPS)) {
+            return "success";
+        }
+        return "failure";
+    }
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/HoldingInfo.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/HoldingInfo.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/HoldingInfo.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/HoldingInfo.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,76 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.tempuri.ITradeServices;
+
+import com.ibm.websphere.samples.trade.GetHoldings;
+import com.ibm.websphere.samples.trade.GetQuote;
+import com.ibm.websphere.samples.trade.GetQuoteResponse;
+import com.ibm.websphere.samples.trade.HoldingDataBean;
+
+public class HoldingInfo {
+
+	private double totalHoldings;
+	private int noOfHoldings;
+	private double purchaseBasis;
+	private HashMap<String, Double> quoteInfo = new HashMap<String, Double>();
+	private final ITradeServices businessService;
+	private final String currentUser;
+	private Collection<HoldingDataBean> holdingsReturn;
+
+	public HoldingInfo(ITradeServices businessService, String currentUser) {
+		this.businessService = businessService;
+		this.currentUser = currentUser;
+		holdingsReturn = getHoldings();
+		noOfHoldings = holdingsReturn.size();
+		for (HoldingDataBean bean : holdingsReturn) {
+			double quoteInfoOfHold = getQuoteInfo(bean.getQuoteID());
+			totalHoldings = totalHoldings + quoteInfoOfHold
+					* bean.getQuantity();
+			purchaseBasis = purchaseBasis + bean.getQuantity().doubleValue()
+					* bean.getPurchasePrice().doubleValue();
+			quoteInfo.put(bean.getQuoteID(), quoteInfoOfHold);
+		}
+	}
+
+	private List<HoldingDataBean> getHoldings() {
+		GetHoldings holdingsParameter = new GetHoldings();
+		holdingsParameter.setUserID(currentUser);
+		return businessService.getHoldings(holdingsParameter)
+				.getGetHoldingsReturn().getHoldingDataBean();
+	}
+
+	private double getQuoteInfo(String quoteID) {
+		GetQuote quoteParameter = new GetQuote();
+		quoteParameter.setSymbol(quoteID);
+		GetQuoteResponse quotes = businessService.getQuote(quoteParameter);
+		return quotes.getGetQuoteReturn().getPrice().doubleValue();
+	}
+
+	public double getTotalHoldings() {
+		return totalHoldings;
+	}
+
+	public double getPurchaseBasis() {
+		return purchaseBasis;
+	}
+
+	public double getGain() {
+		return totalHoldings - purchaseBasis;
+	}
+
+	public int getNoOfHoldings() {
+		return noOfHoldings;
+	}
+
+	public Map getQuoteInfo() {
+		return quoteInfo;
+	}
+	public Collection<HoldingDataBean> getHoldingsReturn() {
+		return holdingsReturn;
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/LoginBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/LoginBean.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/LoginBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/LoginBean.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,67 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import org.apache.stonehenge.stocktrader.service.BusinessServiceClient;
+import org.apache.stonehenge.stocktrader.service.CookieManager;
+import org.tempuri.ITradeServices;
+
+import com.ibm.websphere.samples.trade.Login;
+import com.ibm.websphere.samples.trade.LoginResponse;
+import com.ibm.websphere.samples.trade.Logout;
+
+public class LoginBean {
+    private static final CookieManager cookieManager = new CookieManager();
+
+    private String username;
+    private String password;
+
+    public LoginBean() {
+        String user = cookieManager.getCurrentUser();
+        if (user != null) {
+            logout(user);
+            cookieManager.deleteUserCookie();
+        }
+    }
+
+    private void logout(String username) {
+        ITradeServices service = BusinessServiceClient.getInstance().getBusinessService();
+        Logout logoutParam = new Logout();
+        logoutParam.setUserID(username);
+        service.logout(logoutParam);
+    }
+    
+    public String getUsername() {
+    	return cookieManager.getCurrentUser();
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String login() {
+        if (loginBusinessService(this.username, this.password)) {
+            cookieManager.writeUserCookie(this.username);
+            return "success";
+        } else {
+            this.username = "";
+            this.password = "";
+            return "faliure";
+        }
+    }
+
+    private boolean loginBusinessService(String username, String password) {
+        ITradeServices service = BusinessServiceClient.getInstance().getBusinessService();
+        Login loginParam = new Login();
+        loginParam.setUserID(username);
+        loginParam.setPassword(password);
+        LoginResponse response = service.login(loginParam);
+        return response.getLoginReturn() != null;
+    }
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/PortfolioBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/PortfolioBean.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/PortfolioBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/PortfolioBean.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,40 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.plaf.ListUI;
+
+import org.apache.stonehenge.stocktrader.service.BusinessServiceClient;
+import org.apache.stonehenge.stocktrader.service.CookieManager;
+import org.tempuri.ITradeServices;
+
+import com.ibm.websphere.samples.trade.GetClosedOrders;
+import com.ibm.websphere.samples.trade.GetHoldings;
+import com.ibm.websphere.samples.trade.HoldingDataBean;
+import com.ibm.websphere.samples.trade.OrderDataBean;
+
+public class PortfolioBean {
+	private ITradeServices businessService;
+	private String currentUser;
+	private List<OrderDataBean> closedOrdersReturn;
+	public void setBusinessService(ITradeServices businessService) {
+		this.businessService = businessService;
+	}
+
+	public void setCurrentUser(String currentUser) {
+		this.currentUser = currentUser;
+	}
+
+	public List<OrderDataBean> getClosedOrdersReturn()
+	{
+		if (closedOrdersReturn == null || closedOrdersReturn.size() == 0) {
+			GetClosedOrders closedOrders = new GetClosedOrders();
+			closedOrders.setUserID(currentUser);
+			closedOrdersReturn = businessService.getClosedOrders(closedOrders)
+					.getGetClosedOrdersReturn().getOrderDataBean();
+		}
+		return closedOrdersReturn;
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/QuoteBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/QuoteBean.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/QuoteBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/QuoteBean.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,57 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.tempuri.ITradeServices;
+
+import com.ibm.websphere.samples.trade.GetQuote;
+import com.ibm.websphere.samples.trade.QuoteDataBean;
+
+public class QuoteBean {
+
+	private ITradeServices businessService;
+
+	public void setBusinessService(ITradeServices businessService) {
+		this.businessService = businessService;
+	}
+
+	public List<QuoteDataBean> getQuoteBeanReturns() {
+		FacesContext facesContext = FacesContext.getCurrentInstance();
+		HttpServletRequest request = (HttpServletRequest) facesContext
+				.getExternalContext().getRequest();
+
+		request.getParameterMap();
+		String symbol = request.getParameter("SYMBOLS");
+		if (symbol == null) {
+			return getDefaultQuotes();
+		}
+		return getQunote(symbol);
+	}
+
+	private List<QuoteDataBean> getDefaultQuotes() {
+		List<QuoteDataBean> quoteBeanReturns = new ArrayList<QuoteDataBean>();
+		for (int i = 0; i < 5; i++) {
+			quoteBeanReturns.add(getQunote("s:" + i).get(0));
+		}
+		return quoteBeanReturns;
+	}
+
+	private List<QuoteDataBean> getQunote(String symbols) {
+		String[] symbolArray = symbols.split(";");
+		GetQuote quote = new GetQuote();
+		List<QuoteDataBean> quoteBeanReturns = new ArrayList<QuoteDataBean>();
+		for (String symbol : symbolArray) {
+			quote.setSymbol(symbol);
+			QuoteDataBean getQuoteReturn = businessService.getQuote(quote)
+					.getGetQuoteReturn();
+			if (getQuoteReturn != null) {
+				quoteBeanReturns.add(getQuoteReturn);
+			}
+		}
+		return quoteBeanReturns;
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/RegisterBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/RegisterBean.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/RegisterBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/RegisterBean.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,166 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import java.math.BigDecimal;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.tempuri.ITradeServices;
+
+import com.ibm.websphere.samples.trade.AccountProfileDataBean;
+import com.ibm.websphere.samples.trade.GetAccountProfileData;
+import com.ibm.websphere.samples.trade.Register;
+import com.ibm.websphere.samples.trade.UpdateAccountProfile;
+
+public class RegisterBean {
+	private String userId;
+	private BigDecimal openBalance;
+	private String fullName;
+	private String email;
+	private String address;
+	private String password;
+	private String creditCard;
+	private String confPassword;
+	private ITradeServices businessService;
+	private String currentUser;
+
+	public void setBusinessService(ITradeServices businessService) {
+		this.businessService = businessService;
+	}	
+
+	public void setCurrentUser(String currentUser) {
+		this.currentUser = currentUser;
+	}
+	
+	@javax.annotation.PostConstruct
+	public void initialize(){
+		if(currentUser != null){
+			AccountProfileDataBean userAccount = getUserAccountProfileDataReturn();
+			userId = userAccount.getUserID();
+			email = userAccount.getEmail();
+			fullName = userAccount.getFullName();
+			address = userAccount.getAddress();
+			password = userAccount.getPassword();
+			confPassword = userAccount.getPassword();
+			creditCard = userAccount.getCreditCard();
+		}
+	}
+	
+	public AccountProfileDataBean getUserAccountProfileDataReturn() {
+			GetAccountProfileData profileData = new GetAccountProfileData();
+			profileData.setUserID(currentUser);
+			return businessService.getAccountProfileData(profileData).getGetAccountProfileDataReturn();
+	}
+
+	public BigDecimal getOpenBalance() {
+		return openBalance;
+	}
+
+	public void setOpenBalance(BigDecimal openBalance) {
+		this.openBalance = openBalance;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+
+	public String getFullName() {
+		return fullName;
+	}
+
+	public void setFullName(String fullname) {
+		this.fullName = fullname;
+	}
+
+	public String getEmail() {
+		return email;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public String getCreditCard() {
+		return creditCard;
+	}
+
+	public void setCreditCard(String creditcard) {
+		this.creditCard = creditcard;
+	}
+
+	public String getConfPassword() {
+		return confPassword;
+	}
+
+	public void setConfPassword(String confpassword) {
+		this.confPassword = confpassword;
+	}
+
+	public ITradeServices getBusinessService() {
+		return businessService;
+	}
+
+	public String getUserId() {
+		return userId;
+	}
+
+	public void setUserId(String userId) {
+		this.userId = userId;
+	}
+	
+	public String register() {
+		Register register = new Register();
+		register.setAddress(address);
+		register.setCreditcard(creditCard);
+		register.setEmail(email);
+		register.setFullname(fullName);
+		register.setOpenBalance(openBalance);
+		register.setPassword(password);
+		register.setUserID(userId);
+		businessService.register(register);
+		return "success";
+	}
+
+	public void passwordValidate(FacesContext context, UIComponent component,
+			Object value) {
+		HttpServletRequest request = (HttpServletRequest) context
+				.getExternalContext().getRequest();
+		request.getParameterMap();
+		String password = request.getParameter("AccountProfile:Password");
+		String confirmPassword = (String) value;
+		if (!password.equals(confirmPassword)) {
+			FacesMessage message = new FacesMessage();
+			message.setSeverity(FacesMessage.SEVERITY_ERROR);
+			message.setSummary("Passwords Don't Match!");
+			message.setDetail("Passwords Don't Match!");
+			context.addMessage("AccountProfile:Confirm Password :", message);
+		}
+	}
+	public void updateProfile()
+	{
+		UpdateAccountProfile profile = new UpdateAccountProfile();
+		AccountProfileDataBean profileToBeUpdated = new AccountProfileDataBean();
+		profileToBeUpdated.setAddress(address);
+		profileToBeUpdated.setUserID(userId);
+		profileToBeUpdated.setEmail(email);
+		profileToBeUpdated.setPassword(password);
+		profileToBeUpdated.setFullName(fullName);
+		profileToBeUpdated.setCreditCard(creditCard);
+		profile.setProfileData(profileToBeUpdated);
+		businessService.updateAccountProfile(profile);
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/TradeBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/TradeBean.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/TradeBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/TradeBean.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,131 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.tempuri.ITradeServices;
+
+import com.ibm.websphere.samples.trade.Buy;
+import com.ibm.websphere.samples.trade.OrderDataBean;
+import com.ibm.websphere.samples.trade.Sell;
+import com.ibm.websphere.samples.trade.SellEnhanced;
+
+public class TradeBean {
+	private String symbol;
+	private double quantity;
+	private double price;
+	private String type;
+	private Integer holdingId;
+	private OrderDataBean orderReturn;
+	private ITradeServices businessService;
+	private String currentUser;
+	
+	public void setBusinessService(ITradeServices businessService) {
+		this.businessService = businessService;
+	}
+
+	public void setCurrentUser(String currentUser) {
+		this.currentUser = currentUser;
+	}
+
+	public OrderDataBean getOrderReturn() {
+		return orderReturn;
+	}
+
+	public void setOrderReturn(OrderDataBean orderReturn) {
+		this.orderReturn = orderReturn;
+	}
+
+	public Integer getHoldingId() {
+		return holdingId;
+	}
+
+	public void setHoldingId(Integer holdingId) {
+		this.holdingId = holdingId;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getSymbol() {
+		return symbol;
+	}
+
+	public void setSymbol(String symbol) {
+		this.symbol = symbol;
+	}
+
+	public double getPrice() {
+		return price;
+	}
+
+	public void setPrice(double price) {
+		this.price = price;
+	}
+
+	public double getQuantity() {
+		return quantity;
+	}
+
+	public void setQuantity(double quantity) {
+		this.quantity = quantity;
+	}
+
+	public String submitToConfirm() {
+		FacesContext facesContext = FacesContext.getCurrentInstance();
+		HttpServletRequest request = (HttpServletRequest) facesContext
+				.getExternalContext().getRequest();
+
+		request.getParameterMap();
+		type = request.getParameter("type");
+		symbol = request.getParameter("symbol");
+		quantity = Double.parseDouble(request.getParameter("quantity"));
+		if (type.equals("Buy")) {
+			price = Double.parseDouble(request.getParameter("price"));
+		}
+
+		if (type.equals("Sell")) {
+			holdingId = Integer.parseInt(request.getParameter("holdingId"));
+		}
+		return "success";
+	}
+
+	public String buy() {
+		Buy buyParam = new Buy();
+        buyParam.setOrderProcessingMode(1);
+		buyParam.setUserID(currentUser);
+		buyParam.setQuantity(quantity);
+		buyParam.setSymbol(symbol);
+		try {
+			orderReturn = businessService.buy(buyParam).getBuyReturn();
+		} catch (Exception e) {
+			return "failure";
+		}
+		return "success";
+	}
+
+	public String sell() {
+		SellEnhanced sellParam = new SellEnhanced();
+        sellParam.setQuantity(quantity);
+		sellParam.setHoldingID(holdingId);
+		sellParam.setUserID(currentUser);
+		try {
+			orderReturn = businessService.sellEnhanced(sellParam).getSellEnhancedReturn();
+		} catch (Exception e) {
+			return "failure";
+		}
+		return "success";
+	}
+	
+	public String cancelBuy(){
+		return "success";
+	}
+	public String cancelSell(){
+		return "success";
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/UserBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/UserBean.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/UserBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/UserBean.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,129 @@
+package org.apache.stonehenge.stocktrader.bean;
+
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+import org.tempuri.ITradeServices;
+
+import com.ibm.websphere.samples.trade.AccountDataBean;
+import com.ibm.websphere.samples.trade.GetAccountData;
+import com.ibm.websphere.samples.trade.GetMarketSummary;
+import com.ibm.websphere.samples.trade.MarketSummaryDataBeanWS;
+import com.ibm.websphere.samples.trade.QuoteDataBean;
+
+public class UserBean {
+	private static final String DATE_TIME_FORMAT = "MM/dd/yyyy hh:mm:ss a";
+	private static final DateFormat formater = new SimpleDateFormat(
+			DATE_TIME_FORMAT); // 05/21/2008 04:01:00 PM
+	private static final DecimalFormat percentFormater = new DecimalFormat(
+			"0.00%");
+	private static final DecimalFormat roundFormater = new DecimalFormat("0.00");
+	private AccountDataBean account;
+	private MarketSummaryDataBeanWS marketSummary;
+	private ITradeServices businessService;
+	private String currentUser;
+	private HoldingInfo holdingInfo;
+
+	public void setBusinessService(ITradeServices businessService) {
+		this.businessService = businessService;
+	}
+
+	public void setCurrentUser(String currentUser) {
+		this.currentUser = currentUser;
+	}
+
+	private AccountDataBean getAccount() {
+		if (account == null) {
+			GetAccountData accountParameter = new GetAccountData();
+			accountParameter.setUserID(currentUser);
+			account = businessService.getAccountData(accountParameter)
+					.getGetAccountDataReturn();
+		}
+		return account;
+	}
+
+	public HoldingInfo getHoldingInfo(){
+		holdingInfo = new HoldingInfo(businessService, currentUser);			
+		return holdingInfo;
+	}
+
+	public double getSumOfCashHolding() {
+		return getAccount().getBalance().doubleValue() + holdingInfo.getTotalHoldings();
+	}
+
+	public String getCurrentUserName() {
+		return currentUser;
+	}
+
+	public String getCreationDate() {
+		return formater.format(getAccount().getCreationDate().getTime());
+	}
+
+	public String getLastLoginDate() {
+		return formater.format(getAccount().getLastLogin().getTime());
+	}
+
+	public Integer getAccountID() {
+		return getAccount().getAccountID();
+	}
+
+	public Integer getLoginCount() {
+		return getAccount().getLoginCount();
+	}
+
+	public BigDecimal getBalance() {
+		return getAccount().getBalance();
+	}
+
+	public BigDecimal getOpenBalance() {
+		return getAccount().getOpenBalance();
+	}
+
+	public String getCurrentGainString() {
+		Double currentGain = getCurrentGain();
+		if (currentGain >= 0) {
+			return currentGain.toString();
+		}
+		return "(" + Math.abs(currentGain) + ")";
+	}
+
+	public double getCurrentGain() {
+		return getAccount().getBalance().doubleValue() + holdingInfo.getTotalHoldings()
+				- getAccount().getOpenBalance().doubleValue();
+	}
+
+	public BigDecimal getGainPercent() {
+		return BigDecimal.valueOf(getCurrentGain()).divide(getOpenBalance());
+	}
+
+	public String getGainPercentString() {
+		return percentFormater.format(getGainPercent());
+	}
+
+	private MarketSummaryDataBeanWS getMarketSummary() {
+		if(marketSummary == null ){
+			marketSummary = businessService.getMarketSummary(new GetMarketSummary())
+			.getGetMarketSummaryReturn();
+		}
+		return marketSummary;
+	}
+
+	public String getTradeStockIndex() {
+		return roundFormater.format(getMarketSummary().getTSIA());
+	}
+
+	public String getVolume() {
+		return getMarketSummary().getVolume().toString();
+	}
+
+	public List<QuoteDataBean> getTopGainers() {
+		return getMarketSummary().getTopGainers().getQuoteDataBean();
+	}
+
+	public List<QuoteDataBean> getTopLosers() {
+		return getMarketSummary().getTopLosers().getQuoteDataBean();
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/filter/LoginFilter.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/filter/LoginFilter.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/filter/LoginFilter.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/filter/LoginFilter.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,32 @@
+package org.apache.stonehenge.stocktrader.filter;
+
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.stonehenge.stocktrader.service.CookieManager;
+
+public class LoginFilter implements Filter {
+    private static CookieManager cookieManager = new CookieManager();
+
+    public void init(FilterConfig filterConfig) throws ServletException {
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+        String user = cookieManager.getCurrentUser((HttpServletRequest)request);
+        if (user != null) {
+            chain.doFilter(request, response);
+        } else {
+            ((HttpServletResponse)response).sendRedirect("login.jsf");
+        }
+    }
+
+    public void destroy() {
+    }
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceClient.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceClient.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceClient.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,46 @@
+package org.apache.stonehenge.stocktrader.service;
+
+import org.tempuri.ITradeServices;
+import org.tempuri.TradeServiceWsas;
+
+import javax.xml.ws.BindingProvider;
+
+import com.ibm.websphere.samples.trade.Login;
+import com.ibm.websphere.samples.trade.LoginResponse;
+
+public final class BusinessServiceClient {
+    private static BusinessServiceClient self = null;
+    private static ConfigServiceClient configServiceClient = null;
+    private static ITradeServices tradeServices = null;
+
+    public BusinessServiceClient() {
+        configServiceClient = ConfigServiceClient.getInstance();
+        TradeServiceWsas service = new TradeServiceWsas();
+        tradeServices = service.getBasicHttpBindingITradeServices();
+    }
+
+    public static BusinessServiceClient getInstance() {
+        if (self == null) {
+            self = new BusinessServiceClient();
+        }
+        return self;
+    }
+
+    public ITradeServices getBusinessService() {
+        BusinessServiceConfig config = configServiceClient.getConfig();
+        ((BindingProvider) tradeServices).getRequestContext()
+                .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, config.getEndpointURL());
+        return tradeServices;
+    }
+
+    public static void main(String[] args) {
+        BusinessServiceClient businessServiceClient = BusinessServiceClient.getInstance();
+        ITradeServices service = businessServiceClient.getBusinessService();
+        Login loginParam = new Login();
+        loginParam.setUserID("uid:0");
+        loginParam.setPassword("xxx");
+        LoginResponse response = service.login(loginParam);
+        assert response.getLoginReturn() != null;
+        System.out.println("connect successfully!!!");
+    }
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceConfig.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceConfig.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceConfig.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceConfig.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,19 @@
+package org.apache.stonehenge.stocktrader.service;
+
+import org.tempuri.ConfigServiceService;
+
+import java.util.Properties;
+import java.io.InputStream;
+import java.io.IOException;
+
+public class BusinessServiceConfig {
+    private String endpointURL;
+
+    public String getEndpointURL() {
+        return endpointURL;
+    }
+
+    public void setEndpointURL(String endpointURL) {
+        this.endpointURL = endpointURL;
+    }
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/ConfigServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/ConfigServiceClient.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/ConfigServiceClient.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/ConfigServiceClient.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,115 @@
+package org.apache.stonehenge.stocktrader.service;
+
+import org.datacontract.schemas._2004._07.trade.*;
+import org.tempuri.ConfigService;
+import org.tempuri.ConfigServiceService;
+import traderconfighost.trade.*;
+
+import javax.xml.ws.BindingProvider;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Properties;
+
+public final class ConfigServiceClient {
+
+    private static final String CONFIG_SERVICE_PROPERTY_FILE = "TradeServiceConfig.properties";
+    private static final String CONFIG_SERVICE_URL = "org.apache.stonehenge.stocktrader.TradeConfigService.url";
+
+    private static Properties prop = new Properties();
+
+    private static ConfigServiceService service;
+
+    private static ConfigServiceClient configServiceClient;
+
+    static {
+        ClassLoader cl = ConfigServiceClient.class.getClassLoader();
+        InputStream is = cl.getResourceAsStream(CONFIG_SERVICE_PROPERTY_FILE);
+        try {
+            prop.load(is);
+        } catch (IOException e) {
+        }
+    }
+
+    private ConfigServiceClient() {
+        ConfigService configService = new ConfigService();
+        service = configService.getBasicHttpBindingConfigServiceService();
+        ((BindingProvider) service).getRequestContext()
+                .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, prop.getProperty(CONFIG_SERVICE_URL));
+
+    }
+
+    public static ConfigServiceClient getInstance() {
+        if (configServiceClient == null) {
+            configServiceClient = new ConfigServiceClient();
+        }
+        return configServiceClient;
+    }
+
+    public List<ServiceLocation> getBSLocations() {
+        return service.getBSLocations(new GetBSLocations()).getGetBSLocationsResult().getServiceLocation();
+    }
+
+    public BusinessServiceConfig getConfig() {
+        ClientConfigResponse response = getClientConfigResponse();
+
+        BusinessServiceConfig config = new BusinessServiceConfig();
+        config.setEndpointURL(response.getBS());
+        return config;
+    }
+
+    private ClientConfigResponse getClientConfigResponse() {
+        GetClientConfig getClientConfig = new GetClientConfig();
+        ClientConfigRequest configRequest = new ClientConfigRequest();
+        configRequest.setClientName("JAVA_CLIENT");
+        getClientConfig.setClient(configRequest);
+        GetClientConfigResponse clientConfigResponse = service.getClientConfig(getClientConfig);
+        ClientConfigResponse response = clientConfigResponse.getGetClientConfigResult();
+        return response;
+    }
+
+    public boolean setConfig(String client, String bs, String ops) {
+        try {
+            SetClientToBS setClientToBs = new SetClientToBS();
+            ClientToBS clientToBS = new ClientToBS();
+            clientToBS.setBs(bs);
+            clientToBS.setClient(client);
+            setClientToBs.setClientConfig(clientToBS);
+            service.setClientToBS(setClientToBs);
+
+            SetBSToOPS setBsToOps = new SetBSToOPS();
+            BSToOPS bsToOps = new BSToOPS();
+            bsToOps.setBs(bs);
+            bsToOps.setOps(ops);
+            setBsToOps.setBsConfig(bsToOps);
+            service.setBSToOPS(setBsToOps);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+        return true;
+    }
+
+    public String getSelectedOPS() {
+        GetBSConfig getBSConfig = new GetBSConfig();
+        BSConfigRequest bsConfigRequest = new BSConfigRequest();
+        bsConfigRequest.setBSName(getClientConfigResponse().getBSName());
+        getBSConfig.setBs(bsConfigRequest);
+        return service.getBSConfig(getBSConfig).getGetBSConfigResult().getOPSName();
+    }
+
+    public String getSelectedBS() {
+        ClientConfigResponse response = getClientConfigResponse();
+        return response.getBSName();
+    }
+
+    public List<ServiceLocation> getOPSLocations() {
+        return service.getOPSLocations(new GetOPSLocations()).getGetOPSLocationsResult().getServiceLocation();
+    }
+
+    public static void main(String[] args) {
+        ConfigServiceClient configServiceClient = ConfigServiceClient.getInstance();
+        assert configServiceClient.getBSLocations().size() == 3;
+        System.out.println("connect successfully!!");
+    }
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/CookieManager.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/CookieManager.java?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/CookieManager.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/CookieManager.java Thu Aug  6 03:41:14 2009
@@ -0,0 +1,68 @@
+package org.apache.stonehenge.stocktrader.service;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+public class CookieManager {
+
+    private static final String COOKIE_USERNAME = "username";
+    private static final int MAX_AGE = 3600;
+
+    public static CookieManager getInstance(){
+    	return new CookieManager();
+    }
+    
+    public String getCurrentUser() {
+        return getCurrentUser(getRequest());
+    }
+
+    public String getCurrentUser(HttpServletRequest request) {
+        final Cookie requestCookie = getRequestCookie(request, COOKIE_USERNAME);
+        if (requestCookie != null) {
+            return requestCookie.getValue();
+        }
+
+        return null;
+    }
+
+    public void writeUserCookie(String username) {
+        Cookie cookie = new Cookie(COOKIE_USERNAME, username);
+        cookie.setMaxAge(MAX_AGE);
+        cookie.setVersion(1);
+        getResponse().addCookie(cookie);
+    }
+
+    public void deleteUserCookie() {
+        Cookie cookie = getRequestCookie(getRequest(), COOKIE_USERNAME);
+		if (cookie != null) {
+		    cookie.setMaxAge(0);
+		    getResponse().addCookie(cookie);
+		}
+    }
+
+    private Cookie getRequestCookie(HttpServletRequest request, String name) {
+        Cookie[] cookies = request.getCookies();
+        if (cookies == null) {
+            return null;
+        }
+
+        for (Cookie cookie : cookies) {
+            if (name.equals(cookie.getName())) {
+                return cookie;
+            }
+        }
+        return null;
+    }
+    
+    private HttpServletRequest getRequest() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        return (HttpServletRequest) facesContext.getExternalContext().getRequest();
+    }
+
+    private HttpServletResponse getResponse() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        return (HttpServletResponse) facesContext.getExternalContext().getResponse();
+    }
+}
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/currency.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/currency.xhtml?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/currency.xhtml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/currency.xhtml Thu Aug  6 03:41:14 2009
@@ -0,0 +1,11 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+<ui:composition>
+	<h:outputText value="#{value}">
+		<f:convertNumber currencySymbol="$" type="currency"
+			maxFractionDigits="2" minFractionDigits="2" groupingUsed="false" />
+	</h:outputText>
+</ui:composition>
+</html>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/price.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/price.xhtml?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/price.xhtml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/price.xhtml Thu Aug  6 03:41:14 2009
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:c="http://java.sun.com/jstl/core">
+<ui:composition>
+	<h:outputText  value="#{displayValue == null ? value : displayValue}" styleClass="#{ (value == 0) ? null : (value > 0 ? 'price-gain' : 'price-loss')}">
+	<f:convertNumber currencySymbol="$" type="currency"
+			maxFractionDigits="2" minFractionDigits="2" groupingUsed="false"  />
+	</h:outputText>
+</ui:composition>
+</html>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/stonehenge.taglib.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/stonehenge.taglib.xml?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/stonehenge.taglib.xml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/stonehenge.taglib.xml Thu Aug  6 03:41:14 2009
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE facelet-taglib PUBLIC
+  "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
+  "facelet-taglib_1_0.dtd">
+<facelet-taglib>
+      <namespace>http://stonehenge.apache.com/jsf</namespace>
+	<tag>
+		<tag-name>price</tag-name>
+		<source>price.xhtml</source>
+	</tag>
+	
+	<tag>
+		<tag-name>currency</tag-name>
+		<source>currency.xhtml</source>
+	</tag>
+</facelet-taglib>

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/faces-config.xml?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/faces-config.xml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/faces-config.xml Thu Aug  6 03:41:14 2009
@@ -0,0 +1,196 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+              version="1.2"> 
+  <application>
+    <view-handler>
+      com.sun.facelets.FaceletViewHandler
+    </view-handler>    
+  </application> 
+     
+    <navigation-rule>
+        <from-view-id>/login.xhtml</from-view-id>
+        <navigation-case>
+            <from-outcome>success</from-outcome>
+            <to-view-id>/home.xhtml</to-view-id>
+            <redirect/>
+        </navigation-case>
+        <navigation-case>
+            <from-outcome>failure</from-outcome>
+            <to-view-id>/login.xhtml</to-view-id>
+        </navigation-case>
+    </navigation-rule>
+    
+    <navigation-rule>
+        <from-view-id>/quotes.xhtml</from-view-id>
+        <navigation-case>
+            <from-outcome>success</from-outcome>
+            <to-view-id>/confirmation.xhtml</to-view-id>
+        </navigation-case>
+    </navigation-rule>
+    
+    <navigation-rule>
+        <from-view-id>/portfolio.xhtml</from-view-id>
+        <navigation-case>
+            <from-outcome>success</from-outcome>
+            <to-view-id>/confirmation.xhtml</to-view-id>
+        </navigation-case>
+    </navigation-rule>
+    
+     <navigation-rule>
+        <from-view-id>/register.xhtml</from-view-id>
+        <navigation-case>
+            <from-outcome>success</from-outcome>
+            <to-view-id>/registerSuccess.xhtml</to-view-id>
+        </navigation-case>
+    </navigation-rule>
+
+    <navigation-rule>
+        <from-view-id>/configService.xhtml</from-view-id>
+        <navigation-case>
+            <from-outcome>success</from-outcome>
+            <to-view-id>/login.xhtml</to-view-id>
+            <redirect/>
+        </navigation-case>
+    </navigation-rule>
+    
+    <navigation-rule>
+        <from-view-id>/confirmation.xhtml</from-view-id>
+        <navigation-case>        	
+        	<from-action>#{tradeBean.buy}</from-action> 
+            <from-outcome>success</from-outcome>
+            <to-view-id>/newOrder.xhtml</to-view-id>
+        </navigation-case>
+		<navigation-case>
+			<from-action>#{tradeBean.buy}</from-action> 
+            <from-outcome>failure</from-outcome>
+            <to-view-id>/login.xhtml</to-view-id>
+        </navigation-case>
+        <navigation-case>        	
+        	<from-action>#{tradeBean.sell}</from-action> 
+            <from-outcome>success</from-outcome>
+            <to-view-id>/newOrder.xhtml</to-view-id>
+        </navigation-case>
+		<navigation-case>
+			<from-action>#{tradeBean.sell}</from-action> 
+            <from-outcome>failure</from-outcome>
+            <to-view-id>/login.xhtml</to-view-id>
+        </navigation-case>
+        <navigation-case>    
+        	<from-action>#{tradeBean.cancelBuy}</from-action> 
+        	<from-outcome>success</from-outcome> 
+            <to-view-id>/quotes.xhtml</to-view-id> 
+        </navigation-case>
+        <navigation-case>    
+        	<from-action>#{tradeBean.cancelSell}</from-action> 
+        	<from-outcome>success</from-outcome> 
+            <to-view-id>/portfolio.xhtml</to-view-id> 
+        </navigation-case>
+    </navigation-rule>
+    
+	<managed-bean>
+        <managed-bean-name>cookieManager</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.service.CookieManager</managed-bean-class>
+        <managed-bean-scope>application</managed-bean-scope>
+    </managed-bean>
+    
+    <managed-bean>
+        <managed-bean-name>businessServiceClient</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.service.BusinessServiceClient</managed-bean-class>
+        <managed-bean-scope>application</managed-bean-scope>
+    </managed-bean>
+    
+    <managed-bean>
+        <managed-bean-name>loginBean</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.bean.LoginBean</managed-bean-class>
+        <managed-bean-scope>request</managed-bean-scope>
+    </managed-bean>
+
+    <managed-bean>
+        <managed-bean-name>configServiceBean</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.bean.ConfigServiceBean</managed-bean-class>
+        <managed-bean-scope>session</managed-bean-scope>
+    </managed-bean>
+    
+	<managed-bean>
+        <managed-bean-name>userBean</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.bean.UserBean</managed-bean-class>
+        <managed-bean-scope>session</managed-bean-scope>
+         <managed-property>
+        	<property-name>businessService</property-name>
+        	<value>#{businessServiceClient.businessService}</value>
+        </managed-property>
+        <managed-property>
+        	<property-name>currentUser</property-name>
+        	<value>#{cookieManager.currentUser}</value>
+        </managed-property>
+    </managed-bean>
+
+	<managed-bean>
+        <managed-bean-name>accountBean</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.bean.AccountBean</managed-bean-class>
+        <managed-bean-scope>session</managed-bean-scope>
+        <managed-property>
+        	<property-name>businessService</property-name>
+        	<value>#{businessServiceClient.businessService}</value>
+        </managed-property>
+        <managed-property>
+        	<property-name>currentUser</property-name>
+        	<value>#{cookieManager.currentUser}</value>
+        </managed-property>
+    </managed-bean> 
+    
+    <managed-bean>
+        <managed-bean-name>portfolioBean</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.bean.PortfolioBean</managed-bean-class>
+        <managed-bean-scope>request</managed-bean-scope>
+        <managed-property>
+        	<property-name>businessService</property-name>
+        	<value>#{businessServiceClient.businessService}</value>
+        </managed-property>
+        <managed-property>
+        	<property-name>currentUser</property-name>
+        	<value>#{cookieManager.currentUser}</value>
+        </managed-property>
+    </managed-bean>  
+    
+    <managed-bean>
+        <managed-bean-name>quoteBean</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.bean.QuoteBean</managed-bean-class>
+        <managed-bean-scope>session</managed-bean-scope>
+        <managed-property>
+        	<property-name>businessService</property-name>
+        	<value>#{businessServiceClient.businessService}</value>
+        </managed-property>
+    </managed-bean> 
+    
+    <managed-bean>
+        <managed-bean-name>registerBean</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.bean.RegisterBean</managed-bean-class>
+        <managed-bean-scope>request</managed-bean-scope>
+        <managed-property>
+        	<property-name>businessService</property-name>
+        	<value>#{businessServiceClient.businessService}</value>
+        </managed-property>
+        <managed-property>
+        	<property-name>currentUser</property-name>
+        	<value>#{cookieManager.currentUser}</value>
+        </managed-property>
+    </managed-bean>     
+    
+    
+    <managed-bean>
+        <managed-bean-name>tradeBean</managed-bean-name>
+        <managed-bean-class>org.apache.stonehenge.stocktrader.bean.TradeBean</managed-bean-class>
+        <managed-bean-scope>session</managed-bean-scope>
+        <managed-property>
+        	<property-name>businessService</property-name>
+        	<value>#{businessServiceClient.businessService}</value>
+        </managed-property>
+        <managed-property>
+        	<property-name>currentUser</property-name>
+        	<value>#{cookieManager.currentUser}</value>
+        </managed-property>
+    </managed-bean> 
+</faces-config>

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/web.xml?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/web.xml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/WEB-INF/web.xml Thu Aug  6 03:41:14 2009
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+  <!-- Use Documents Saved as *.xhtml -->	
+  <context-param>
+    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+    <param-value>.xhtml</param-value>
+  </context-param>
+  
+  <!-- Special Debug Output for Development -->
+  <context-param>
+    <param-name>facelets.DEVELOPMENT</param-name>
+    <param-value>true</param-value>
+  </context-param>
+	  
+  <!-- Optional JSF-RI Parameters to Help Debug -->
+  <context-param>
+    <param-name>com.sun.faces.validateXml</param-name>
+    <param-value>true</param-value>
+  </context-param>
+  <context-param>
+    <param-name>com.sun.faces.verifyObjects</param-name>
+    <param-value>true</param-value>
+  </context-param>
+    
+  <context-param>
+	<param-name>facelets.LIBRARIES</param-name>
+	<param-value>
+		/WEB-INF/facelets/tags/stonehenge.taglib.xml
+	</param-value>
+  </context-param>
+  
+  <filter>
+    <filter-name>Login Filter</filter-name>
+    <filter-class>org.apache.stonehenge.stocktrader.filter.LoginFilter</filter-class>
+  </filter>
+  <filter-mapping>
+    <filter-name>Login Filter</filter-name>
+    <url-pattern>*.faces</url-pattern>
+    <dispatcher>REQUEST</dispatcher>
+  </filter-mapping>
+  
+  <servlet>
+    <servlet-name>Faces Servlet</servlet-name>
+    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  
+  <servlet-mapping>
+    <servlet-name>Faces Servlet</servlet-name>
+    <url-pattern>/faces/*</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+    <servlet-name>Faces Servlet</servlet-name>
+    <url-pattern>*.faces</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+    <servlet-name>Faces Servlet</servlet-name>
+    <url-pattern>*.jsf</url-pattern>
+  </servlet-mapping>
+  
+  <welcome-file-list>
+    <welcome-file>faces/welcome.xhtml</welcome-file>
+  </welcome-file-list>
+  
+</web-app>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/account.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/account.xhtml?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/account.xhtml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/account.xhtml Thu Aug  6 03:41:14 2009
@@ -0,0 +1,256 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:c="http://java.sun.com/jstl/core"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:s="http://stonehenge.apache.com/jsf">
+<body>
+<ui:composition template="/template.xhtml">
+	<ui:define name="title">
+		Account Information
+    </ui:define>
+	<ui:define name="body">
+		<c:if test="#{!empty portfolioBean.closedOrdersReturn}">
+			<ui:include src="alertInfo.jsf" />
+		</c:if>
+		<div align="center">
+		<h:dataTable styleClass="table-outer"
+			cellspacing="0" value="#{accountBean.accountSummary}"
+			var="accountSummary">
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Subtotal Buys" />
+				</f:facet>
+				<h:outputText class="currency">
+					<s:currency value="#{accountSummary.totalBuys}" />
+				</h:outputText>
+			</h:column>
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Subtotal Sells" />
+				</f:facet>
+				<h:outputText class="currency">
+					<s:currency value="#{accountSummary.totalSells}" />
+				</h:outputText>
+			</h:column>
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Subtotal Fees" />
+				</f:facet>
+				<h:outputText class="currency">
+					<s:currency value="#{accountSummary.totalTax}" />
+				</h:outputText>
+			</h:column>
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Net Impact Cash Balance" />
+				</f:facet>
+				<h:outputText class="currency">
+					<s:price value="#{accountSummary.totalImpact}" />
+				</h:outputText>
+			</h:column>
+		</h:dataTable>
+		</div>
+		<div>
+		<p><b>Total Orders Shown</b></p>
+		</div>
+		
+		<h:dataTable styleClass="table-outer"
+			cellspacing="0"
+			value="#{accountBean.ordersReturn}"
+			columnClasses=",,,,currency,,,currency,currency,currency"
+			var="order">
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Order ID" />
+				</f:facet>
+				<h:outputText>
+					<h:outputText value="#{order.orderID}" />
+				</h:outputText>
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Order Status" />
+				</f:facet>
+				<h:outputText>
+					<h:outputText value="#{order.orderStatus}" />
+				</h:outputText>
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Creation Date" />
+				</f:facet>
+				<h:outputText>
+					<h:outputText value="#{order.openDate.time}">
+						<f:convertDateTime pattern="#{accountBean.dateFormat}" />
+					</h:outputText>
+				</h:outputText>
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Completion Date" />
+				</f:facet>
+				<h:outputText>
+					<h:outputText value="#{order.completionDate.time}">
+						<f:convertDateTime pattern="#{accountBean.dateFormat}" />
+					</h:outputText>
+				</h:outputText>
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Txn Fee" />
+				</f:facet>
+				<h:outputText class="currency">
+					<s:currency value="#{order.orderFee}" />
+				</h:outputText>
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Type" />
+				</f:facet>
+				<h:outputText value="#{order.orderType}" />
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Symbol" />
+				</f:facet>
+				<form action="quotes.faces" method="post">
+					<input type="hidden" name="SYMBOLS" value="#{order.symbol}" />
+					<input type="submit" name="GETQUOTE" value="#{order.symbol}" />
+				</form>
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Quantity" />
+				</f:facet>
+				<h:outputText class="currency" value="#{order.quantity}" />
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Price" />
+				</f:facet>
+				<h:outputText class="currency">
+					<s:currency value="#{order.price}" />
+				</h:outputText>
+			</h:column>
+			
+			<h:column>
+				<f:facet name="header">
+					<h:outputText value="Total" />
+				</f:facet>
+				<h:outputText class="currency">
+					<s:currency value="#{order.quantity*order.price+order.orderFee}" />
+				</h:outputText>
+			</h:column>
+						
+		</h:dataTable>
+		
+		<form>
+		<table class="profile" cellspacing="0" width="100%">
+			<thead>
+				<tr>
+					<th><h:outputText
+						value="Update Account Profile: #{userBean.currentUserName}" /></th>
+				</tr>
+			</thead>
+			<tbody>
+			<h:messages style="color: red" align="center" />
+				<tr>
+					<td><h:form id="AccountProfile">
+						<table cellspacing="0" align="center">
+							<tr>
+								<td>Full Name:</td>
+								<td><h:inputText id="FULLNAME" 
+									value="#{registerBean.fullName}" required="true"
+									size="25" /></td>
+								<td>Email Address:</td>
+								<td><h:inputText id="EMAILADDRESS" 
+									value="#{registerBean.email}"  required="true"
+									size="25" /></td>
+							</tr>
+							<tr>
+								<td>Address:</td>
+								<td><h:inputText id="ADDRESS" 
+									value="#{registerBean.address}" required="true"
+									 size="25" /></td>
+								<td>Password:</td>
+								<td><h:inputSecret id="Password"
+									value="#{registerBean.password}" required="true"
+									 size="25" /></td>
+							</tr>
+							<tr>
+								<td>Credit Card:</td>
+								<td><h:inputText id="CREDITCARD" 
+									value="#{registerBean.creditCard}" required="true"
+									 size="25" /></td>
+								<td>Confirm Password:</td>
+								<td><h:inputSecret id="ConPASSWORD" validator="#{registerBean.passwordValidate}" required="true"
+									value="#{registerBean.confPassword}"
+									 size="25" /></td>
+							</tr>
+							<tr>
+								<td colspan="4" class="button"><h:commandButton
+									action="#{registerBean.updateProfile}" id="UPDATEUSERPROFILE"
+									value="Update" class="button" /></td>
+							</tr>
+						</table>
+					</h:form>
+
+					<table align="center" class="profile-content" cellspacing="0">
+						<tbody>
+							<tr>
+								<td class="left">Account ID:</td>
+								<td><h:outputText
+									value="#{accountBean.userAccountDataReturn.accountID}" /></td>
+								<td class="left">Account Created</td>
+								<td><h:outputText
+									value="#{accountBean.userAccountDataReturn.creationDate.time}">
+									<f:convertDateTime pattern="#{accountBean.dateFormat}" />
+								</h:outputText></td>
+							</tr>
+							<tr>
+								<td class="left">User ID:</td>
+								<td><h:outputText
+									value="#{accountBean.userAccountDataReturn.profileID}" /></td>
+								<td class="left">Last Login:</td>
+								<td><h:outputText
+									value="#{accountBean.userAccountDataReturn.lastLogin.time}">
+									<f:convertDateTime pattern="#{accountBean.dateFormat}" />
+								</h:outputText></td>
+							</tr>
+							<tr>
+								<td class="left">Opening Balance:</td>
+								<td><h:outputText
+									value="#{accountBean.userAccountDataReturn.openBalance}" /></td>
+								<td class="left">Total Logins:</td>
+								<td><h:outputText
+									value="#{accountBean.userAccountDataReturn.loginCount}" /></td>
+							</tr>
+							<tr>
+								<td class="left">Cash Balance:</td>
+								<td><s:price
+									value="#{accountBean.userAccountDataReturn.balance}" /></td>
+								<td class="left">Total Logouts:</td>
+								<td><h:outputText
+									value="#{accountBean.userAccountDataReturn.logoutCount}" /></td>
+							</tr>
+						</tbody>
+					</table>
+					</td>
+				</tr>
+			</tbody>
+		</table>
+		</form>
+		<ui:include src="getQuote.jsf" />
+	</ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/alertInfo.jsf
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/alertInfo.jsf?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/alertInfo.jsf (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/alertInfo.jsf Thu Aug  6 03:41:14 2009
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns:ui="http://java.sun.com/jsf/facelets"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns="http://www.w3.org/1999/xhtml">
+<body>
+<ui:composition>
+	<p style="color: red" align="center">Trade Alert: The following
+	orders have completed.</p>
+	<table class="table-outer" cellspacing="0" align="center">
+		<thead>
+			<tr>
+				<th>Order ID</th>
+				<th>Order Status</th>
+				<th>Creation Date</th>
+				<th>Completion Date</th>
+				<th>Txn Fee</th>
+				<th>Type</th>
+				<th>Symbol</th>
+				<th>Quantity</th>
+			</tr>
+		</thead>
+		<tbody>
+			<ui:repeat value="#{portfolioBean.closedOrdersReturn}"
+				var="closedOrder">
+				<tr>
+					<td><h:outputText value="#{closedOrder.orderID}" /></td>
+					<td><h:outputText value="#{closedOrder.orderStatus}" /></td>
+					<td><h:outputText value="#{closedOrder.openDate.time}">
+						<f:convertDateTime pattern="#{accountBean.dateFormat}" />
+					</h:outputText></td>
+					<td><h:outputText value="#{closedOrder.completionDate.time}">
+						<f:convertDateTime pattern="#{accountBean.dateFormat}" />
+					</h:outputText></td>
+					<td><h:outputText value="#{closedOrder.orderFee}" /></td>
+					<td><h:outputText value="#{closedOrder.orderType}" /></td>
+					<td><h:outputText value="#{closedOrder.symbol}" /></td>
+					<td><h:outputText value="#{closedOrder.quantity}" /></td>
+				</tr>
+			</ui:repeat>
+		</tbody>
+	</table>
+	<br/>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/configService.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/configService.xhtml?rev=801507&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/configService.xhtml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/trader_client/web/configService.xhtml Thu Aug  6 03:41:14 2009
@@ -0,0 +1,40 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:c="http://java.sun.com/jstl/core"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:s="http://stonehenge.apache.com/jsf">
+<body>
+<ui:composition template="/template.xhtml">
+    <ui:define name="title">
+        Configuration
+    </ui:define>
+    <ui:define name="body">
+       <br/>
+        <div class="login" style="text-align:left">
+        <h:form>
+            <h:panelGrid columns="2" cellspacing="5" width="320px">
+               <h:outputLabel for="bses" >
+                    <h:outputText value="Business Service"/>
+                </h:outputLabel>
+
+                <h:selectOneMenu id="bses" value="#{configServiceBean.selectedBS}" >
+                    <f:selectItems id="bs" value="#{configServiceBean.bsNames}"/>
+                </h:selectOneMenu>
+                <h:outputLabel for="opses" >
+                    <h:outputText value="Order Processing Service"/>
+                </h:outputLabel>
+
+                <h:selectOneMenu id="opses" value="#{configServiceBean.selectedOPS}">
+                    <f:selectItems id="op" value="#{configServiceBean.opsNames}"/>
+                </h:selectOneMenu>
+
+                <h:panelGroup/>
+                <h:commandButton title="Set" value="Set" action="#{configServiceBean.setBSAndOPS}"/>
+            </h:panelGrid>
+        </h:form>
+        </div>
+     </ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file



Mime
View raw message