incubator-stonehenge-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bende...@apache.org
Subject svn commit: r811675 [8/9] - in /incubator/stonehenge/trunk: ./ stocktrader/metro/ stocktrader/metro/business_service/ stocktrader/metro/business_service/etc/ stocktrader/metro/business_service/src/ stocktrader/metro/business_service/src/org/ stocktrade...
Date Sat, 05 Sep 2009 16:41:19 GMT
Added: incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/ConfigServiceBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/ConfigServiceBean.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/ConfigServiceBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/ConfigServiceBean.java Sat Sep  5 16: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("METRO_CLIENT", selectedBS, selectedOPS)) {
+            return "success";
+        }
+        return "failure";
+    }
+
+}

Added: incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/HoldingInfo.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/HoldingInfo.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/HoldingInfo.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/HoldingInfo.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/LoginBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/LoginBean.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/LoginBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/LoginBean.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/PortfolioBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/PortfolioBean.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/PortfolioBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/PortfolioBean.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/QuoteBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/QuoteBean.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/QuoteBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/QuoteBean.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/RegisterBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/RegisterBean.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/RegisterBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/RegisterBean.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/TradeBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/TradeBean.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/TradeBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/TradeBean.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/UserBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/UserBean.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/UserBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/bean/UserBean.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/filter/LoginFilter.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/filter/LoginFilter.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/filter/LoginFilter.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/filter/LoginFilter.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceClient.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceClient.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceClient.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceConfig.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceConfig.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceConfig.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/BusinessServiceConfig.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/ConfigServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/ConfigServiceClient.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/ConfigServiceClient.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/ConfigServiceClient.java Sat Sep  5 16: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("METRO_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/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/CookieManager.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/CookieManager.java?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/CookieManager.java (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/src/org/apache/stonehenge/stocktrader/service/CookieManager.java Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/currency.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/currency.xhtml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/currency.xhtml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/currency.xhtml Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/price.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/price.xhtml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/price.xhtml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/price.xhtml Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/stonehenge.taglib.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/stonehenge.taglib.xml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/stonehenge.taglib.xml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/facelets/tags/stonehenge.taglib.xml Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/web/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/faces-config.xml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/faces-config.xml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/faces-config.xml Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/web/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/web.xml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/web.xml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/WEB-INF/web.xml Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/web/account.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/account.xhtml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/account.xhtml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/account.xhtml Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/web/alertInfo.jsf
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/alertInfo.jsf?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/alertInfo.jsf (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/alertInfo.jsf Sat Sep  5 16: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/trunk/stocktrader/metro/trader_client/web/configService.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/configService.xhtml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/configService.xhtml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/configService.xhtml Sat Sep  5 16: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

Added: incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/confirmation.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/confirmation.xhtml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/confirmation.xhtml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/confirmation.xhtml Sat Sep  5 16:41:14 2009
@@ -0,0 +1,49 @@
+<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"
+	xmlns:s="http://stonehenge.apache.com/jsf">
+<body>
+<ui:composition template="/template.xhtml">
+	<ui:define name="title">
+		Trade
+    </ui:define>
+	<ui:define name="body">
+		<div id="confirm">
+		<h2>Trade Confirmation</h2>
+		<div class="confirm-content"><c:if
+			test="#{tradeBean.type=='Buy'}">
+			<h:outputFormat
+				value="You have requested to buy shares of {0} which is currently
+		trading at {1}.">
+				<f:param value="#{tradeBean.symbol}" />
+				<f:param value="#{tradeBean.price}" />
+			</h:outputFormat>
+		</c:if> <c:if test="#{tradeBean.type=='Sell'}">
+			<h:outputFormat
+				value="You have requested to sell all or part of your holding {0}. This holding has a total of {2} shares of stock {0}. Please indicate how many share to sell.">
+				<f:param value="#{tradeBean.symbol}" />
+				<f:param value="#{tradeBean.price}" />
+				<f:param value="#{tradeBean.quantity}" />
+			</h:outputFormat>
+		</c:if> <br />
+		<br />
+		<h:form>
+			<h:outputText value="Number of Shares:" />
+			<h:inputText id="quantity" value="#{tradeBean.quantity}" size="10" />
+			<c:if test="#{tradeBean.type=='Buy'}">
+				<h:commandButton value="Buy" action="#{tradeBean.buy}" />
+				<h:commandButton value="Cancel" action="#{tradeBean.cancelBuy}"/>
+			</c:if>
+			<c:if test="#{tradeBean.type=='Sell'}">
+				<h:commandButton value="Sell" action="#{tradeBean.sell}" />
+				<h:commandButton value="Cancel" action="#{tradeBean.cancelSell}"/>
+			</c:if>
+		</h:form></div>
+		</div>
+		<ui:include src="getQuote.jsf" />
+	</ui:define>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/css/style.css
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/css/style.css?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/css/style.css (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/css/style.css Sat Sep  5 16:41:14 2009
@@ -0,0 +1,392 @@
+/*
+ * 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.
+ */
+body {
+background-image: url(../images/bg.gif);
+background-repeat: repeat-x;
+background-position: left top;
+background-attachment: scroll;
+font-size: 11px;
+font-family: Verdana, Arial, Helvetica, san-serif;
+padding: 0px;
+margin: 0px;
+}
+
+p { }
+
+h3 {
+margin-top:5px;
+font-size: 16px;
+font-weight: normal;
+color:  #711D1E;
+}
+
+td { }
+
+a:link { 
+color: #D17270;
+text-decoration: none;
+}
+
+a:visited {
+
+}
+
+a:hover {
+text-decoration: underline;
+}
+
+a:active { }
+
+input {
+border-left: solid 1px #999;
+border-bottom: solid 1px #333;
+border-right: solid 1px #333;
+border-top: solid 1px #999;
+margin-right: 7px;
+}
+input.button {
+background-image: url(../images/button-bg.gif);
+background-repeat: repeat-x;
+background-position: left top;
+background-attachment: scroll;
+border-left: solid 1px #C0372D;
+border-bottom: solid 2px  #C0472D;
+border-right: solid 2px #C0572D;
+border-top: solid 1px #C0672D;
+height: 22px;
+font-weight: bold;
+padding-left: 10px;
+padding-right: 10px;
+cursor: pointer;
+}  
+td {
+vertical-align: top;
+}
+
+div#content {
+width: 902px;
+margin: auto;
+margin-top: 15px;
+}
+div#header {
+background-image: url(../images/header-bg.gif);
+background-repeat: no-repeat;
+background-position: left top;
+background-attachment: scroll;
+background-color: #fff;
+height: 57px;
+}
+div#header div.logo {
+float: left;
+margin-top: 0px;
+margin-left: 20px;
+}
+div#header div.powered {
+float: right;
+margin-top: 10px;
+margin-right: 20px;
+}
+div#header-links {
+border-left: solid 2px #d17270;
+border-right: solid 2px #d17270;
+height: 35px;
+padding-left: 70px;
+padding-right: 20px;
+padding-top: 0px;
+background-image: url(../images/header-links-bg.gif);
+background-repeat: no-repeat;
+background-position: left top;
+background-attachment: scroll;
+}
+div#header-links table {
+height: 30px;
+
+}
+div#header-links table td {
+}
+div#header-links table td a {
+display: block;
+text-decoration: none;
+color: #fff;
+padding-left: 15px;
+padding-right: 15px;
+padding-top: 7px;
+background-image: url(../images/header-link-bg.gif);
+background-repeat: repeat-x;
+background-position: left top;
+background-attachment: scroll;
+height: 23px;
+font-size: 12px;
+font-weight: bold;
+}
+div#header-links table td a:hover {
+background-image: url(../images/header-link-bg-hover.gif);
+background-repeat: repeat-x;
+background-position: left top;
+background-attachment: scroll;
+}
+div#middle {
+background-image: url(../images/middle-bg.gif);
+background-repeat: repeat-y;
+background-position: left top;
+background-attachment: scroll;
+background-color: #fff;
+min-height: 300px;
+padding-left: 40px;
+padding-right: 40px;
+padding-top: 20px;
+padding-bottom: 20px;
+}
+div#middle div.main-title {
+border-bottom: solid 1px #d17270;
+text-align: right;
+vertical-align: bottom;
+height: 30px;
+margin-bottom: 20px;
+}
+div#middle div.main-title h1{
+margin-top: 0px;
+padding-top: 0px;
+font-size: 22px;
+color: #711D1E;
+float: left;
+}
+div#middle div.main-title span.time {
+}
+div.left {
+width: 400px;
+}
+div.right {
+border: solid 1px #d17270;
+margin-left: 40px;
+width: 373px;
+}
+div.right p {
+padding-left: 10px;
+padding-right: 10px;
+}
+div.right h3{
+margin: 0px;
+background-color: #d17270;
+color: #fff;
+padding: 5px;
+font-size: 12px;
+}
+
+div.login {
+text-align: center;
+}
+div.login table {
+margin: auto;
+font-size: 12px;
+}
+div.login p.new-user {
+font-size: 12px;
+font-weight: bold;
+}
+div.quotes {
+text-align: center;
+width: auto;
+margin: auto;
+}
+div#middle table.normal {
+margin-bottom: 20px;
+}
+div#middle table.normal tr{
+text-align: left;
+font-size: 12px;
+}
+div#middle table.normal tr th {
+font-size: 12px;
+border-bottom: solid 1px #333;
+border-left: 0px;
+border-right: 0px;
+border-top: 0px;
+padding-bottom: 3px;
+color: #d17270;
+}
+div#middle table.normal tr td.left {
+text-align: right;
+color: #d17270;
+padding-top: 3px;
+vertical-align: top;
+}
+
+table.table-inner {
+border: solid 1px #999;
+width: 100%;
+}
+table.table-inner tr td,th{
+border: solid 1px #333;
+padding: 5px;
+}
+table.table-inner tr th {
+background-color: #999;
+color: #fff;
+}
+table.table-inner tbody tr td {
+background-color: #ccc;
+text-align: right;
+}
+
+table.table-outer {
+border: solid 0px #333;
+width: auto;
+}
+table.table-outer tr td,th{
+	border: solid 1px #fff;
+	padding: 5px;
+}
+table.table-outer thead tr th {
+background-color: #999;
+border: solid 1px #fff;
+color: #fff;
+padding: 3px;
+}
+table.table-outer tbody tr td {
+background-color: #ededed;
+text-align: center;
+}
+table.table-outer tbody tr td.special {
+background-color: #ccc;
+font-weight: bold;
+text-align: left;
+}
+table.table-outer tbody tr td.currency {
+text-align: right;
+}
+table.table-outer tbody tr.total td{
+background-color: #BCBEC0;
+font-weight: bold;
+text-align: right;
+}
+span.price {
+color: #711d1e;
+}
+span.price-gain {
+color: #711d1e;
+background-image: url(../images/green-arrow.gif);
+background-repeat: no-repeat;
+background-position: right top;
+background-attachment: scroll;
+padding-right: 17px;
+}
+span.price-loss {
+color: #C0272D;
+background-image: url(../images/red-arrow.gif);
+background-repeat: no-repeat;
+background-position: right bottom;
+background-attachment: scroll;
+padding-right: 17px;
+}
+table.profile {
+border: solid 1px #711d1e;
+width: 100%;
+margin-top: 15px;
+background-color: #ededed;
+}
+table.profile tr td,th{
+padding: 2px;
+}
+table.profile thead tr th {
+color: #711d1e;
+border-bottom: solid 1px #711d1e;
+font-size: 12px;
+padding: 5px;
+}
+table.profile tbody tr td {
+background-color: #ededed;
+text-align: right;
+}
+table.profile tbody tr td.button {
+text-align: center;
+padding: 7px;
+}
+table.profile-content {
+width: auto;
+margin-bottom: 10px;
+} 
+table.profile-content tbody tr td {
+padding: 5px;
+border: solid 1px #999;
+}
+table.profile-content tbody tr td.left {
+color: #D17270;
+}
+table.glossary {
+width: 80%;
+background-color: #ccc;
+}
+table.glossary thead tr th {
+background-color: #666;
+color: #fff;
+border: 0px;
+padding: 5px;
+}
+table.glossary tbody tr td {
+background-color: #fff;
+padding: 5px;
+}
+table.glossary td.left {
+font-weight: bold;
+}
+div#confirm {
+margin-top: 7%;
+margin-bottom: 7%;
+width: 60%;
+margin-left: auto;
+margin-right: auto;
+}
+div#confirm h2 {
+color: #711D1E;
+text-align: center;
+font-size: 18px;
+}
+div#confirm div.confirm-content {
+background-color: #F89C8F;
+border-top: solid 1px #CF6A67;
+border-left: solid 1px #CF6A67;
+border-right: solid 2px #CF6A67;
+border-bottom: solid 2px #CF6A67;
+padding-top: 10px;
+padding-bottom: 20px;
+padding-left: 20px;
+padding-right: 20px;
+text-align: center;
+}
+div.bottom {
+margin-top: 10px;
+border-top: solid 1px #711d1e;
+padding-top: 10px;
+padding-bottom: 0px;
+text-align: center;
+vertical-align: middle;
+}
+div#footer {
+background-image: url(../images/footer-bg.gif);
+background-repeat: no-repeat;
+background-position: left top;
+background-attachment: scroll;
+background-color: #fff;
+height: 30px;
+padding-top: 25px;
+padding-left: 20px;
+color: #711D1E;
+}
+a img {
+	border: none;
+}

Added: incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/getQuote.jsf
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/getQuote.jsf?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/getQuote.jsf (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/getQuote.jsf Sat Sep  5 16:41:14 2009
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html xmlns:ui="http://java.sun.com/jsf/facelets">
+<body>
+<ui:composition>
+	<div class="bottom">
+	<form action="quotes.faces" method="post"><input type="text"
+		value="" name="SYMBOLS" id="" size="25" /><input type="submit"
+		name="GETQUOTE" value="Get Quote" class="button" /></form>
+	</div>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/glossary.xhtml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/glossary.xhtml?rev=811675&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/glossary.xhtml (added)
+++ incubator/stonehenge/trunk/stocktrader/metro/trader_client/web/glossary.xhtml Sat Sep  5 16:41:14 2009
@@ -0,0 +1,172 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:c="http://java.sun.com/jsp/jstl/core"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:ui="http://java.sun.com/jsf/facelets">
+<body>
+<ui:composition template="/template.xhtml">
+	<ui:define name="title">
+		Glossary
+    </ui:define>
+	<ui:define name="body">
+        <table align="center" class="glossary">
+            <thead>
+            <tr>
+                <th>Term</th>
+                <th>Description</th>
+            </tr>
+            </thead>
+            <tbody>
+            <tr>
+                <td class="left">Account ID</td>
+                <td>A unique Integer based key. Each user is assigned an account ID at account creation time.</td>
+            </tr>
+            <tr>
+                <td class="left">Account Created</td>
+                <td>The time and date the users account was first created.</td>
+            </tr>
+            <tr>
+                <td class="left">Cash Balance</td>
+                <td>The current cash balance in the users account. This does not include current stock holdings.</td>
+            </tr>
+            <td class="left">Company</td>
+            <td>The full company name for an individual stock.</td>
+            <tr>
+                <td class="left">Current Gain/Loss</td>
+                <td>The total gain or loss of this account, computed by substracting the current sum of cash/holdings
+                    minus the opening account balance.
+                </td>
+            </tr>
+            <td class="left">Current Price</td>
+            <td>The current trading price for a given stock symbol.</td>
+            <tr>
+                <td class="left">Gain/Loss</td>
+                <td>The current gain or loss of an individual stock holding, computed as (current market value - holding
+                    basis).
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Last Login</td>
+                <td>The date and time this user last logged in to Trade.</td>
+            </tr>
+            <tr>
+                <td class="left">Market Value</td>
+                <td>The current total value of a stock holding, computed as (quantity * current price).</td>
+            </tr>
+            <tr>
+                <td class="left">Number of Holdings</td>
+                <td>The total number of stocks currently owned by this account.</td>
+            </tr>
+            <tr>
+                <td class="left">Open Price</td>
+                <td>The price of a given stock at the open of the trading session.</td>
+            </tr>
+            <tr>
+                <td class="left">Order ID</td>
+                <td>A unique Integer based key. Each order is assigned an order ID at order creation time.</td>
+            </tr>
+            <tr>
+                <td class="left">Opening Balance</td>
+                <td>The initial cash balance in this account when it was opened.</td>
+            </tr>
+            <tr>
+                <td class="left">Order Status</td>
+                <td>orders are opened, processed, closed and completed. Order status shows the current stat for this
+                    order.
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Price Range</td>
+                <td>The low and high prices for this stock during the current trading session</td>
+            </tr>
+            <tr>
+                <td class="left">Purchase Date</td>
+                <td>The date and time the a stock was purchased.</td>
+            </tr>
+            <tr>
+                <td class="left">Purchase Price</td>
+                <td>The price used when purchasing the stock.</td>
+            </tr>
+            <tr>
+                <td class="left">Purchase Basis</td>
+                <td>The total cost to purchase this holding. This is computed as (quantity * purchase price).</td>
+            </tr>
+            <tr>
+                <td class="left">Quantity</td>
+                <td>The number of stock shares in the order or user holding.</td>
+            </tr>
+            <tr>
+                <td class="left">Session Created</td>
+                <td>An HTTP session is created for each user at during login. Session created shows the time and day
+                    when the session was created.
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Sum of Cash/Holdings</td>
+                <td>The total current value of this account. This is the sum of the cash balance along with the value of
+                    current stock holdings.
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Symbol</td>
+                <td>The symbol for a Trade stock.</td>
+            </tr>
+            <tr>
+                <td class="left">Total Logins</td>
+                <td>The total number of logins performed by this user.</td>
+            </tr>
+            <tr>
+                <td class="left">Total Logouts</td>
+                <td>The total number of logouts performed by this user.</td>
+            </tr>
+            <tr>
+                <td class="left">Total of Holdings</td>
+                <td>The current total value of all stock holdings in this account given the current valuation of each
+                    stock held.
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Top gainers</td>
+                <td>The list of stocks (matching LIKE CLAUSE 's:1__%' per WebSphere Trade 6.1 behavior) gaining the most
+                    in price during the current trading session.
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Top Losers</td>
+                <td>The list of stocks (matching LIKE CLAUSE 's:1__%' per WebSphere Trade 6.1 behavior) falling the most
+                    in price during the current trading session.
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Trader Stock Index (TSIA)</td>
+                <td>A computed index of the top 20 stocks (matching LIKE CLAUSE 's:1__%' per WebSphere Trade 6.1
+                    behavior) in Trade.
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Trading Volume</td>
+                <td>The total number of shares traded for stocks (matching LIKE CLAUSE 's:1__%' per WebSphere Trade 6.1
+                    behavior) during this trading session.
+                </td>
+            </tr>
+            <tr>
+                <td class="left">Txn Fee</td>
+                <td>The fee charged by the brokerage to process this order.</td>
+            </tr>
+            <tr>
+                <td class="left">Type</td>
+                <td>The order type (buy or sell).</td>
+            </tr>
+            <tr>
+                <td class="left">User ID</td>
+                <td>The unique user ID for the account chosen by the user at account registration.</td>
+            </tr>
+            <tr>
+                <td class="left">Volume</td>
+                <td>The total number of shares traded for this stock.</td>
+            </tr>
+            </tbody>
+        </table>
+        </ui:define>
+        </ui:composition>
+</body>
+</html>
\ No newline at end of file



Mime
View raw message