geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viol...@apache.org
Subject svn commit: r1076572 [1/3] - in /geronimo/daytrader/trunk/javaee6/modules: core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/ web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/ web/src/main/java/org/apache/geronimo/daytrade...
Date Thu, 03 Mar 2011 10:01:52 GMT
Author: violalu
Date: Thu Mar  3 10:01:51 2011
New Revision: 1076572

URL: http://svn.apache.org/viewvc?rev=1076572&view=rev
Log:
DAYTRADER-91 add facelets features with file name of postfix .xhtml. meantime keep original jsp and servlet files for performance test script work out.

Added:
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/AccountDataJSF.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/HoldingData.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/MarketSummaryJSF.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderData.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderDataJSF.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/PortfolioJSF.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteData.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteDataJSF.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeAppJSF.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeConfigJSF.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/TradeAction.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/WEB-INF/faces-config.xml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/account.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/config.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/configure.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/contentHome.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/footer.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/header.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/index.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/order.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/portfolio.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/quote.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/register.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/tradehome.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/web_prmtv.xhtml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/welcome.xhtml
Modified:
    geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/KeySequenceDirect.java
    geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJDBCDirect.java
    geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJEEDirect.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/OrdersAlertFilter.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/TradeConfigServlet.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/TradeServletAction.java
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/WEB-INF/web.xml
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/displayQuote.jsp
    geronimo/daytrader/trunk/javaee6/modules/web/src/main/webapp/marketSummary.jsp

Modified: geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/KeySequenceDirect.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/KeySequenceDirect.java?rev=1076572&r1=1076571&r2=1076572&view=diff
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/KeySequenceDirect.java (original)
+++ geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/KeySequenceDirect.java Thu Mar  3 10:01:51 2011
@@ -26,7 +26,6 @@ import java.sql.ResultSet;
 
 import org.apache.geronimo.daytrader.javaee6.utils.*;
 
-import org.apache.geronimo.daytrader.*;
 
 public class KeySequenceDirect {
 

Modified: geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJDBCDirect.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJDBCDirect.java?rev=1076572&r1=1076571&r2=1076572&view=diff
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJDBCDirect.java (original)
+++ geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJDBCDirect.java Thu Mar  3 10:01:51 2011
@@ -412,8 +412,8 @@ public class TradeJDBCDirect implements 
         commit(conn);
 
         // signify this order for user userID is complete
-        TradeAction tradeAction = new TradeAction(this);
-        tradeAction.orderCompleted(userID, orderID);
+        /*TradeAction tradeAction = new TradeAction(this);
+        tradeAction.orderCompleted(userID, orderID);*/
 
         return orderData;
     }

Modified: geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJEEDirect.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJEEDirect.java?rev=1076572&r1=1076571&r2=1076572&view=diff
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJEEDirect.java (original)
+++ geronimo/daytrader/trunk/javaee6/modules/core/src/main/java/org/apache/geronimo/daytrader/javaee6/core/direct/TradeJEEDirect.java Thu Mar  3 10:01:51 2011
@@ -520,8 +520,9 @@ public class TradeJEEDirect implements T
         commit(conn);
 
         // signify this order for user userID is complete
-        TradeAction tradeAction = new TradeAction(this);
-        tradeAction.orderCompleted(userID, orderID);
+        /*It's just log information. so remove this line
+         * TradeAction tradeAction = new TradeAction(this);
+        tradeAction.orderCompleted(userID, orderID);*/
 
         return orderData;
     }

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/AccountDataJSF.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/AccountDataJSF.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/AccountDataJSF.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/AccountDataJSF.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,279 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import java.math.BigDecimal;
+//import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+//import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.geronimo.daytrader.javaee6.core.direct.FinancialUtils;
+import org.apache.geronimo.daytrader.javaee6.entities.AccountDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.HoldingDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.OrderDataBean;
+
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
+
+@ManagedBean(name="accountdata")
+
+public class AccountDataJSF {    
+    private Date sessionCreationDate;
+    private Date currentTime;
+    private String profileID;    
+    private Integer accountID;
+    private Date creationDate;
+    private int loginCount;
+    private Date lastLogin;
+    private int logoutCount;
+    private BigDecimal balance;
+    private BigDecimal openBalance;    
+    private Integer numberHoldings;
+    private BigDecimal holdingsTotal;
+    private BigDecimal sumOfCashHoldings;
+    private BigDecimal gain;
+    private BigDecimal gainPercent;    
+    
+    private OrderData[] closedOrders;
+    private OrderData[] allOrders;
+    
+    public AccountDataJSF(){
+        home();
+    }
+    
+    public Date getSessionCreationDate() {
+        return sessionCreationDate;
+    }
+    
+    public void setSessionCreationDate(Date sessionCreationDate) {
+        this.sessionCreationDate = sessionCreationDate;
+    }
+    
+    public Date getCurrentTime() {
+        return currentTime;
+    }
+    
+    public void setCurrentTime(Date currentTime) {
+        this.currentTime = currentTime;
+    }
+    
+    public String getProfileID() {
+        return profileID;
+    }
+    
+    public void setProfileID(String profileID) {
+        this.profileID = profileID;
+    }
+    
+
+    public void setAccountID(Integer accountID) {
+        this.accountID = accountID;
+    }
+
+    public Integer getAccountID() {
+        return accountID;
+    }
+
+    public void setCreationDate(Date creationDate) {
+        this.creationDate = creationDate;
+    }
+
+    public Date getCreationDate() {
+        return creationDate;
+    }
+
+    public void setLoginCount(int loginCount) {
+        this.loginCount = loginCount;
+    }
+
+    public int getLoginCount() {
+        return loginCount;
+    }
+
+    public void setBalance(BigDecimal balance) {
+        this.balance = balance;
+    }
+
+    public BigDecimal getBalance() {
+        return balance;
+    }
+
+    public void setOpenBalance(BigDecimal openBalance) {
+        this.openBalance = openBalance;
+    }
+
+    public BigDecimal getOpenBalance() {
+        return openBalance;
+    }    
+
+    public void setHoldingsTotal(BigDecimal holdingsTotal) {
+        this.holdingsTotal = holdingsTotal;
+    }
+
+    public BigDecimal getHoldingsTotal() {
+        return holdingsTotal;
+    }
+
+    public void setSumOfCashHoldings(BigDecimal sumOfCashHoldings) {
+        this.sumOfCashHoldings = sumOfCashHoldings;
+    }
+
+    public BigDecimal getSumOfCashHoldings() {
+        return sumOfCashHoldings;
+    }
+
+    public void setGain(BigDecimal gain) {
+        this.gain = gain;
+    }
+
+    public BigDecimal getGain() {
+        return gain;
+    }
+
+    public void setGainPercent(BigDecimal gainPercent) {
+        this.gainPercent = gainPercent;
+    }
+
+    public BigDecimal getGainPercent() {
+        return gainPercent;
+    }
+
+    public void setNumberHoldings(Integer numberHoldings) {
+        this.numberHoldings = numberHoldings;
+    }
+
+    public Integer getNumberHoldings() {
+        return numberHoldings;
+    }
+    
+    public void home(){
+        TradeAction tAction = new TradeAction();
+        try {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);    
+        String userID = (String)session.getAttribute("uidBean");        
+        AccountDataBean accountData = tAction.getAccountData(userID);
+        Collection<HoldingDataBean> holdingDataBeans = tAction.getHoldings(userID);        
+        java.util.Collection closedOrders = tAction.getClosedOrders(userID);        
+        
+        if ( (closedOrders!=null) && (closedOrders.size() > 0) ) {
+            session.setAttribute("closedOrders", closedOrders);
+            OrderData[] orderjsfs = new OrderData[closedOrders.size()];
+            Iterator it = closedOrders.iterator();
+            int i = 0;
+            while (it.hasNext() )
+            {
+                OrderDataBean order = (OrderDataBean)it.next();
+                OrderData r = new OrderData(order.getOrderID(),order.getOrderStatus(), order.getOpenDate(), order.getCompletionDate(), order.getOrderFee(), order.getOrderType(), order.getQuantity(),order.getSymbol());
+                orderjsfs[i] = r;
+                i++;
+            }
+            setClosedOrders(orderjsfs);
+        }
+        
+        ArrayList orderDataBeans = (TradeConfig.getLongRun() ? new ArrayList() : (ArrayList) tAction.getOrders(userID));
+        if ( (orderDataBeans!=null) && (orderDataBeans.size() > 0) ) {
+            session.setAttribute("orderDataBeans", orderDataBeans);
+            OrderData[] orderjsfs = new OrderData[orderDataBeans.size()];
+            Iterator it = orderDataBeans.iterator();
+            int i = 0;
+            while (it.hasNext() )
+            {
+                OrderDataBean order = (OrderDataBean)it.next();
+                OrderData r = new OrderData(order.getOrderID(),order.getOrderStatus(), order.getOpenDate(), order.getCompletionDate(), order.getOrderFee(), order.getOrderType(), order.getQuantity(),order.getSymbol());
+                orderjsfs[i] = r;
+                i++;
+            }
+            setAllOrders(orderjsfs);
+        }
+        
+        setSessionCreationDate((Date)session.getAttribute("sessionCreationDate"));
+        setCurrentTime(new java.util.Date());
+        doAccountData(accountData, holdingDataBeans);        
+        
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    
+    /*public String quotes(){
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);
+        session.setAttribute("symbols", symbols);        
+        return "Quotes";
+    }*/
+    
+    private void doAccountData(AccountDataBean accountData, Collection<HoldingDataBean> holdingDataBeans){
+        setProfileID(accountData.getProfileID());
+        setAccountID(accountData.getAccountID());
+        setCreationDate(accountData.getCreationDate());
+        setLoginCount(accountData.getLoginCount());
+        setLogoutCount(accountData.getLogoutCount());
+        setLastLogin(accountData.getLastLogin());
+        setOpenBalance(accountData.getOpenBalance());
+        setBalance(accountData.getBalance());        
+        setNumberHoldings(holdingDataBeans.size());
+        setHoldingsTotal(FinancialUtils.computeHoldingsTotal(holdingDataBeans));
+        setSumOfCashHoldings(balance.add(holdingsTotal));
+        setGain(FinancialUtils.computeGain(sumOfCashHoldings, openBalance));
+        setGainPercent(FinancialUtils.computeGainPercent(sumOfCashHoldings, openBalance));
+        
+    }
+    
+    
+    public OrderData[] getClosedOrders(){
+        return closedOrders;        
+    }
+
+    public void setClosedOrders(OrderData[] closedOrders) {
+        this.closedOrders = closedOrders;
+    }
+
+    public void setLastLogin(Date lastLogin) {
+        this.lastLogin = lastLogin;
+    }
+
+    public Date getLastLogin() {
+        return lastLogin;
+    }
+
+    public void setLogoutCount(int logoutCount) {
+        this.logoutCount = logoutCount;
+    }
+
+    public int getLogoutCount() {
+        return logoutCount;
+    }
+
+    public void setAllOrders(OrderData[] allOrders) {
+        this.allOrders = allOrders;
+    }
+
+    public OrderData[] getAllOrders() {
+        return allOrders;
+    }
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/HoldingData.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/HoldingData.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/HoldingData.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/HoldingData.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,132 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.geronimo.daytrader.javaee6.entities.OrderDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
+
+@ManagedBean
+@SessionScoped
+public class HoldingData {
+    private Integer holdingID;
+    private double quantity;
+    private BigDecimal purchasePrice; 
+    private Date purchaseDate; 
+    private String quoteID; 
+    private BigDecimal price;
+    private BigDecimal basis;
+    private BigDecimal marketValue;
+    private BigDecimal gain;    
+
+    public void setHoldingID(Integer holdingID) {
+        this.holdingID = holdingID;
+    }
+
+    public Integer getHoldingID() {
+        return holdingID;
+    }
+
+    public void setQuantity(double quantity) {
+        this.quantity = quantity;
+    }
+
+    public double getQuantity() {
+        return quantity;
+    }
+
+    public void setPurchasePrice(BigDecimal purchasePrice) {
+        this.purchasePrice = purchasePrice;
+    }
+
+    public BigDecimal getPurchasePrice() {
+        return purchasePrice;
+    }
+
+    public void setPurchaseDate(Date purchaseDate) {
+        this.purchaseDate = purchaseDate;
+    }
+
+    public Date getPurchaseDate() {
+        return purchaseDate;
+    }
+
+    public void setQuoteID(String quoteID) {
+        this.quoteID = quoteID;
+    }
+
+    public String getQuoteID() {
+        return quoteID;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setBasis(BigDecimal basis) {
+        this.basis = basis;
+    }
+
+    public BigDecimal getBasis() {
+        return basis;
+    }
+
+    public void setMarketValue(BigDecimal marketValue) {
+        this.marketValue = marketValue;
+    }
+
+    public BigDecimal getMarketValue() {
+        return marketValue;
+    }
+
+    public void setGain(BigDecimal gain) {
+        this.gain = gain;
+    }
+
+    public BigDecimal getGain() {
+        return gain;
+    }
+
+    public void sell(){
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);    
+        String userID = (String)session.getAttribute("uidBean");    
+        TradeAction tAction = new TradeAction();
+        OrderDataBean orderData = null;
+        try {
+            orderData = tAction.sell(userID, holdingID, TradeConfig.orderProcessingMode);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        session.setAttribute("orderData", orderData);        
+    }    
+    
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/MarketSummaryJSF.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/MarketSummaryJSF.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/MarketSummaryJSF.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/MarketSummaryJSF.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,147 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import java.math.BigDecimal;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.faces.bean.ManagedBean;
+import org.apache.geronimo.daytrader.javaee6.core.beans.MarketSummaryDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.QuoteDataBean;
+
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
+
+@ManagedBean(name="marketdata")
+public class MarketSummaryJSF {    
+    private BigDecimal     TSIA; 
+    private BigDecimal     openTSIA; 
+    private double      volume;  
+    private QuoteData[]     topGainers; 
+    private QuoteData[]     topLosers;   
+    private Date            summaryDate; 
+   
+    //cache the gainPercent once computed for this bean
+    private BigDecimal  gainPercent = null;
+
+    public MarketSummaryJSF(){
+        getMarketSummary();
+    }
+    
+    public void getMarketSummary(){
+        TradeAction tAction = new TradeAction();
+        try {
+        /*FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);    
+        String userID = (String)session.getAttribute("uidBean");    */    
+        MarketSummaryDataBean marketSummaryData = tAction.getMarketSummary();
+        setSummaryDate(marketSummaryData.getSummaryDate());
+        setTSIA(marketSummaryData.getTSIA());
+        setVolume(marketSummaryData.getVolume());
+        setGainPercent(marketSummaryData.getGainPercent());
+        
+        Collection topGainers = marketSummaryData.getTopGainers();    
+        System.out.println("Top gainers" + topGainers.size());
+        Iterator gainers = topGainers.iterator();
+        int count=0;
+        QuoteData[] gainerjsfs = new QuoteData[6];
+        while (gainers.hasNext() && (count++ < 5))
+        {
+            QuoteDataBean quote = (QuoteDataBean) gainers.next();
+            QuoteData r = new QuoteData(quote.getPrice(), quote.getOpen(), quote.getSymbol());
+            gainerjsfs[count] = r;
+        }
+               
+        setTopGainers(gainerjsfs);
+        
+        Collection topLosers = marketSummaryData.getTopLosers();
+        System.out.println("Top losers" + topLosers.size());
+        
+        QuoteData[] loserjsfs = new QuoteData[6];
+        count = 0;
+        Iterator losers = topLosers.iterator();
+        while (losers.hasNext() && (count++ < 5))
+        {
+            QuoteDataBean quote = (QuoteDataBean) losers.next();
+            QuoteData r = new QuoteData(quote.getPrice(), quote.getOpen(), quote.getSymbol());
+            loserjsfs[count] = r;
+        }
+        setTopLosers(loserjsfs);
+        
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    public void setTSIA(BigDecimal tSIA) {
+        TSIA = tSIA;
+    }
+
+    public BigDecimal getTSIA() {
+        return TSIA;
+    }
+
+    public void setOpenTSIA(BigDecimal openTSIA) {
+        this.openTSIA = openTSIA;
+    }
+
+    public BigDecimal getOpenTSIA() {
+        return openTSIA;
+    }
+
+    public void setVolume(double volume) {
+        this.volume = volume;
+    }
+
+    public double getVolume() {
+        return volume;
+    }
+
+    public void setTopGainers(QuoteData[] topGainers) {
+        this.topGainers = topGainers;
+    }
+
+    public QuoteData[] getTopGainers() {
+        return topGainers;
+    }
+
+    public void setTopLosers(QuoteData[] topLosers) {
+        this.topLosers = topLosers;
+    }
+
+    public QuoteData[] getTopLosers() {
+        return topLosers;
+    }
+
+    public void setSummaryDate(Date summaryDate) {
+        this.summaryDate = summaryDate;
+    }
+
+    public Date getSummaryDate() {
+        return summaryDate;
+    }
+    
+    public void setGainPercent(BigDecimal gainPercent) {
+        this.gainPercent = gainPercent;
+    }
+
+    public BigDecimal getGainPercent() {
+        return gainPercent;
+    }
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderData.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderData.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderData.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderData.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,107 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class OrderData{
+    private Integer orderID;
+    private String orderStatus;
+    private Date openDate;
+    private Date completionDate;  
+    private BigDecimal orderFee; 
+    private String orderType;
+    private double quantity;
+    private String symbol;
+    private BigDecimal total;
+    private BigDecimal price;
+    
+    public OrderData(Integer orderID, String orderStatus, Date openDate, Date completeDate, BigDecimal orderFee, String orderType, double quantity, String symbol){
+        this.orderID = orderID;
+        this.completionDate = completeDate;
+        this.openDate = openDate;
+        this.orderFee = orderFee;
+        this.orderType = orderType;
+        this.orderStatus = orderStatus;
+        this.quantity = quantity;
+        this.symbol = symbol;        
+        
+    }
+    public void setOrderID(Integer orderID) {
+        this.orderID = orderID;
+    }
+    public Integer getOrderID() {
+        return orderID;
+    }
+    public void setOrderStatus(String orderStatus) {
+        this.orderStatus = orderStatus;
+    }
+    public String getOrderStatus() {
+        return orderStatus;
+    }
+    public void setOpenDate(Date openDate) {
+        this.openDate = openDate;
+    }
+    
+    public Date getOpenDate() {
+        return openDate;
+    }
+    public void setCompletionDate(Date completionDate) {
+        this.completionDate = completionDate;
+    }
+    public Date getCompletionDate() {
+        return completionDate;
+    }
+    public void setOrderFee(BigDecimal orderFee) {
+        this.orderFee = orderFee;
+    }
+    public BigDecimal getOrderFee() {
+        return orderFee;
+    }
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+    public String getOrderType() {
+        return orderType;
+    }
+    public void setQuantity(double quantity) {
+        this.quantity = quantity;
+    }
+    public double getQuantity() {
+        return quantity;
+    }
+    public void setSymbol(String symbol) {
+        this.symbol = symbol;
+    }
+    public String getSymbol() {
+        return symbol;
+    }
+    public void setTotal(BigDecimal total) {
+        this.total = total;
+    }
+    public BigDecimal getTotal() {
+        return total;
+    }
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+    public BigDecimal getPrice() {
+        return price;
+    }
+    
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderDataJSF.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderDataJSF.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderDataJSF.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/OrderDataJSF.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,108 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+
+import javax.faces.bean.ManagedBean;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.geronimo.daytrader.javaee6.core.direct.FinancialUtils;
+import org.apache.geronimo.daytrader.javaee6.entities.AccountDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.AccountProfileDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.HoldingDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.OrderDataBean;
+
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
+
+@ManagedBean(name="orderdata")
+public class OrderDataJSF {    
+    
+    private OrderData[] allOrders;
+    private int size;
+    private OrderData orderData;
+    
+    public OrderDataJSF(){
+        /*getAllOrder();
+        setSize(allOrders.length);*/
+        getOrder();
+    }
+    
+    public void getAllOrder(){
+        TradeAction tAction = new TradeAction();
+        try {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);    
+        String userID = (String)session.getAttribute("uidBean");        
+        AccountDataBean accountData = tAction.getAccountData(userID);
+        //AccountProfileDataBean accountProfileData = tAction .getAccountProfileData(userID); 
+        ArrayList orderDataBeans = (TradeConfig.getLongRun() ? new ArrayList() : (ArrayList) tAction.getOrders(userID));
+        OrderData[] orders = new OrderData[orderDataBeans.size()];
+        int count = 0;
+        for (Object order : orderDataBeans){
+            OrderData r = new OrderData(((OrderDataBean)order).getOrderID(),((OrderDataBean)order).getOrderStatus(), ((OrderDataBean)order).getOpenDate(), ((OrderDataBean)order).getCompletionDate(), ((OrderDataBean)order).getOrderFee(), ((OrderDataBean)order).getOrderType(),((OrderDataBean)order).getQuantity(), ((OrderDataBean)order).getSymbol());
+            r.setPrice(((OrderDataBean)order).getPrice());
+            r.setTotal(r.getPrice().multiply(new BigDecimal(r.getQuantity())));
+            orders[count] = r;
+            count ++;
+        }    
+        setAllOrders(orders);
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+    }
+    
+    public void getOrder(){
+        
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);    
+        OrderData order = (OrderData)session.getAttribute("orderData");
+        setOrderData(order);
+        
+    }
+    
+    public void setAllOrders(OrderData[] allOrders) {
+        this.allOrders = allOrders;
+    }
+
+    public OrderData[] getAllOrders() {
+        return allOrders;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public void setOrderData(OrderData orderData) {
+        this.orderData = orderData;
+    }
+
+    public OrderData getOrderData() {
+        return orderData;
+    }
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/PortfolioJSF.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/PortfolioJSF.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/PortfolioJSF.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/PortfolioJSF.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,199 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import java.math.BigDecimal;
+//import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+//import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.geronimo.daytrader.javaee6.core.direct.FinancialUtils;
+import org.apache.geronimo.daytrader.javaee6.entities.AccountDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.HoldingDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.OrderDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.QuoteDataBean;
+
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
+
+@ManagedBean(name="portfolio")
+public class PortfolioJSF {        
+    private BigDecimal balance;
+    private BigDecimal openBalance;    
+    private Integer numberHoldings;
+    private BigDecimal holdingsTotal;
+    private BigDecimal sumOfCashHoldings;
+    private BigDecimal totalGain = new BigDecimal(0.0);
+    private BigDecimal totalValue = new BigDecimal(0.0);
+    private BigDecimal totalBasis = new BigDecimal(0.0);
+    private BigDecimal totalGainPercent = new BigDecimal(0.0);    
+    private HoldingData[] holdingDatas;
+    
+    
+    public PortfolioJSF(){
+        getPortfolio();
+    }    
+   
+    public void setBalance(BigDecimal balance) {
+        this.balance = balance;
+    }
+
+    public BigDecimal getBalance() {
+        return balance;
+    }
+
+    public void setOpenBalance(BigDecimal openBalance) {
+        this.openBalance = openBalance;
+    }
+
+    public BigDecimal getOpenBalance() {
+        return openBalance;
+    }    
+
+    public void setHoldingsTotal(BigDecimal holdingsTotal) {
+        this.holdingsTotal = holdingsTotal;
+    }
+
+    public BigDecimal getHoldingsTotal() {
+        return holdingsTotal;
+    }
+
+    public void setSumOfCashHoldings(BigDecimal sumOfCashHoldings) {
+        this.sumOfCashHoldings = sumOfCashHoldings;
+    }
+
+    public BigDecimal getSumOfCashHoldings() {
+        return sumOfCashHoldings;
+    }
+
+    
+    public void setNumberHoldings(Integer numberHoldings) {
+        this.numberHoldings = numberHoldings;
+    }
+
+    public Integer getNumberHoldings() {
+        return numberHoldings;
+    }
+    
+    public void getPortfolio(){
+        TradeAction tAction = new TradeAction();
+        try {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);    
+        String userID = (String)session.getAttribute("uidBean");        
+        Collection quoteDataBeans = new ArrayList();
+        Collection holdingDataBeans = tAction.getHoldings(userID);
+        
+        numberHoldings = holdingDataBeans.size();
+        // Walk through the collection of user holdings and creating a list of quotes
+        if (holdingDataBeans.size() > 0) {
+            Iterator it = holdingDataBeans.iterator();  
+            holdingDatas = new HoldingData[holdingDataBeans.size()];
+            int count = 0;
+            while (it.hasNext()) {
+                HoldingDataBean holdingData = (HoldingDataBean) it.next();
+                QuoteDataBean quoteData = tAction.getQuote(holdingData.getQuoteID());               
+               
+                BigDecimal basis = holdingData.getPurchasePrice().multiply(new BigDecimal(holdingData.getQuantity()));
+                BigDecimal marketValue = quoteData.getPrice().multiply(new BigDecimal(holdingData.getQuantity()));
+                totalBasis = totalBasis.add(basis);    
+                totalValue = totalValue.add(marketValue);    
+                BigDecimal gain = marketValue.subtract(basis);
+                totalGain = totalGain.add(gain);
+                BigDecimal gainPercent = null;
+                if (basis.doubleValue() == 0.0)
+                {
+                    gainPercent = new BigDecimal(0.0);
+                    //Log.error("portfolio.jsp: Holding with zero basis. holdingID="+holdingData.getHoldingID() + " symbol=" + holdingData.getQuoteID() + " purchasePrice=" + holdingData.getPurchasePrice());
+                }
+                else {
+                    gainPercent = marketValue.divide(basis, BigDecimal.ROUND_HALF_UP).subtract(new BigDecimal(1.0)).multiply(new BigDecimal(100.0)); 
+                }
+                HoldingData h = new HoldingData();
+                h.setHoldingID(holdingData.getHoldingID());
+                h.setPurchaseDate(holdingData.getPurchaseDate());
+                h.setQuoteID(holdingData.getQuoteID());
+                h.setQuantity(holdingData.getQuantity());
+                h.setPurchasePrice(holdingData.getPurchasePrice());
+                h.setBasis(basis);
+                h.setGain(gain);
+                h.setMarketValue(marketValue);
+                h.setPrice(quoteData.getPrice());               
+                holdingDatas[count] = h;
+                count++;
+            }
+                setTotalGainPercent(FinancialUtils.computeGainPercent(totalValue, totalBasis));
+            
+        } else {
+            //results = results + ".  Your portfolio is empty.";
+        }
+            } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+            }
+        }    
+
+    public void setTotalGain(BigDecimal totalGain) {
+        this.totalGain = totalGain;
+    }
+
+    public BigDecimal getTotalGain() {
+        return totalGain;
+    }
+
+    public void setTotalValue(BigDecimal totalValue) {
+        this.totalValue = totalValue;
+    }
+
+    public BigDecimal getTotalValue() {
+        return totalValue;
+    }
+
+    public void setTotalBasis(BigDecimal totalBasis) {
+        this.totalBasis = totalBasis;
+    }
+
+    public BigDecimal getTotalBasis() {
+        return totalBasis;
+    }
+
+    public void setHoldingDatas(HoldingData[] holdingDatas) {
+        this.holdingDatas = holdingDatas;
+    }
+
+    public HoldingData[] getHoldingDatas() {
+        return holdingDatas;
+    }    
+
+    public void setTotalGainPercent(BigDecimal totalGainPercent) {
+        this.totalGainPercent = totalGainPercent;
+    }
+
+    public BigDecimal getTotalGainPercent() {
+        return totalGainPercent;
+    } 
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteData.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteData.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteData.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteData.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,130 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import java.math.BigDecimal;
+
+import org.apache.geronimo.daytrader.javaee6.core.direct.FinancialUtils;
+
+public class QuoteData {
+    private BigDecimal price;
+    private BigDecimal open;       
+    private String symbol;
+    private BigDecimal high;
+    private BigDecimal low;
+    private String companyName;
+    private double volume;
+    private double change;
+    private String range;
+    private BigDecimal gainPercent;
+    
+    public QuoteData(BigDecimal price, BigDecimal open, String symbol){
+        this.open = open;
+        this.price = price;
+        this.symbol = symbol;
+    }
+    
+    public QuoteData(BigDecimal price, BigDecimal open, String symbol, BigDecimal high, BigDecimal low, String companyName, Double volume, Double change){
+        this.open = open;
+        this.price = price;
+        this.symbol = symbol;
+        this.high = high;
+        this.low = low;
+        this.companyName = companyName;
+        this.volume = volume;
+        this.change = change;
+        this.range = high.toString() + "-" + low.toString();
+        this.gainPercent = FinancialUtils.computeGainPercent(price, open);
+    }
+    
+            
+    public void setSymbol(String symbol) {
+        this.symbol = symbol;
+    }
+    
+    public String getSymbol() {
+        return symbol;
+    }
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+    public BigDecimal getPrice() {
+        return price;
+    }
+    public void setOpen(BigDecimal open) {
+        this.open = open;
+    }
+    public BigDecimal getOpen() {
+        return open;
+    }
+
+    public void setHigh(BigDecimal high) {
+        this.high = high;
+    }
+
+    public BigDecimal getHigh() {
+        return high;
+    }
+
+    public void setLow(BigDecimal low) {
+        this.low = low;
+    }
+
+    public BigDecimal getLow() {
+        return low;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setVolume(double volume) {
+        this.volume = volume;
+    }
+
+    public double getVolume() {
+        return volume;
+    }
+
+    public void setChange(double change) {
+        this.change = change;
+    }
+
+    public double getChange() {
+        return change;
+    }
+
+    public void setRange(String range) {
+        this.range = range;
+    }
+
+    public String getRange() {
+        return range;
+    }
+
+    public void setGainPercent(BigDecimal gainPercent) {
+        this.gainPercent = gainPercent;
+    }
+
+    public BigDecimal getGainPercent() {
+        return gainPercent;
+    }
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteDataJSF.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteDataJSF.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteDataJSF.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/QuoteDataJSF.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,98 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import java.util.ArrayList;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.geronimo.daytrader.javaee6.entities.QuoteDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
+import org.apache.geronimo.daytrader.javaee6.web.Beans.QuoteData;
+
+@ManagedBean(name="quotedata")
+public class QuoteDataJSF {
+    private QuoteData[] quotes;
+    private String symbols = "s:0, s:1, s:2, s:3, s:4";
+    
+    public QuoteDataJSF(){
+        getAllQuotes();
+    }
+
+    public void setQuotes(QuoteData[] quotes) {
+        this.quotes = quotes;
+    }
+
+    public QuoteData[] getQuotes() {
+        return quotes;
+    }
+
+    public void getAllQuotes() {        
+        String symbols = "s:0,s:1,s:2,s:3,s:4";        
+        ArrayList quotes = new ArrayList();
+        java.util.StringTokenizer st = new java.util.StringTokenizer(symbols, " ,");
+        QuoteData[] quoteDatas = new QuoteData[6];
+        int count = 0;
+        while (st.hasMoreElements()) {
+            String symbol = st.nextToken();
+            TradeAction tAction = new TradeAction();            
+            try {
+                QuoteDataBean quoteData = tAction.getQuote(symbol);
+                quoteDatas[count] =  new QuoteData(quoteData.getOpen(), quoteData.getPrice(), quoteData.getSymbol(), quoteData.getHigh(), quoteData.getLow(), quoteData.getCompanyName(),quoteData.getVolume(), quoteData.getChange());
+                count ++;
+            } catch (Exception e) {
+                Log.error(e.toString());
+            }
+        }
+        setQuotes(quoteDatas);
+    }
+    
+    public String getQuotesBySymbols() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);
+        session.setAttribute("symbols", symbols);
+        
+        ArrayList quotes = new ArrayList();
+        java.util.StringTokenizer st = new java.util.StringTokenizer(symbols, " ,");
+        QuoteData[] quoteDatas = new QuoteData[6];
+        int count = 0;
+        while (st.hasMoreElements()) {
+            String symbol = st.nextToken();
+            TradeAction tAction = new TradeAction();            
+            try {
+                QuoteDataBean quoteData = tAction.getQuote(symbol);
+                quoteDatas[count] =  new QuoteData(quoteData.getOpen(), quoteData.getPrice(), quoteData.getSymbol(), quoteData.getHigh(), quoteData.getLow(), quoteData.getCompanyName(),quoteData.getVolume(), quoteData.getChange());
+                count ++;
+            } catch (Exception e) {
+                Log.error(e.toString());
+            }
+        }
+        setQuotes(quoteDatas);
+        return "quotes";
+    }
+
+    public void setSymbols(String symbols) {
+        this.symbols = symbols;
+    }
+
+    public String getSymbols() {
+        return symbols;
+    }
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeAppJSF.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeAppJSF.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeAppJSF.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeAppJSF.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,265 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import java.math.BigDecimal;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+//import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpSession;
+
+
+import org.apache.geronimo.daytrader.javaee6.entities.AccountDataBean;
+import org.apache.geronimo.daytrader.javaee6.entities.AccountProfileDataBean;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
+
+
+@ManagedBean(name="tradeapp")
+@SessionScoped
+public class TradeAppJSF {
+    private String userID = "uid:0";
+    private String password = "xxx";
+    private String cpassword;
+    private String results;
+    private String fullname;
+    private String address;
+    private String email;
+    private String ccn;
+    private String money;
+    
+    
+    public String getUserID() {
+        return userID;
+    }
+    
+    public void setUserID(String userID) {
+        this.userID = userID;
+    }
+    
+    public String getPassword() {
+        return password;
+    }
+    
+    public void setPassword(String password) {
+        this.password = password;
+    }
+    
+    public String getCpassword() {
+        return cpassword;
+    }
+    
+    public void setCpassword(String cpassword) {
+        this.cpassword = cpassword;
+    }
+    
+    public String getFullname() {
+        return fullname;
+    }
+    
+    public void setFullname(String fullname) {
+        this.fullname = fullname;
+    }
+    
+    public String getResults() {
+        return results;
+    }
+    
+    public void setResults(String results) {
+        this.results = results;
+    }
+    
+    public String getAddress() {
+        return address;
+    }
+    
+    public void setAddress(String address) {
+        this.address = address;
+    }
+    
+    public String getEmail() {
+        return email;
+    }
+    
+    public void setEmail(String email) {
+        this.email = email;
+    }
+    
+    public String getCcn() {
+        return ccn;
+    }
+    
+    public void setCcn(String ccn) {
+        this.ccn = ccn;
+    }
+    
+    public String getMoney() {
+        return money;
+    }
+    
+    public void setMoney(String money) {
+        this.money = money;
+    }
+    
+    
+    public String login(){
+        TradeAction tAction = new TradeAction();
+        try {
+            AccountDataBean accountData = tAction.login(userID, password);
+            AccountProfileDataBean accountProfileData = tAction.getAccountProfileData(userID);
+            if (accountData != null) {
+                //Go to tradehome.jsp
+                FacesContext facesContext = FacesContext.getCurrentInstance();
+                HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);
+                session.setAttribute("uidBean", userID);
+                session.setAttribute("sessionCreationDate", new java.util.Date());                          
+                setResults("Ready to Trade");
+                
+                //Get account profile information                
+                setAddress(accountProfileData.getAddress());
+                setCcn(accountProfileData.getCreditCard());
+                setEmail(accountProfileData.getEmail());
+                setFullname(accountProfileData.getFullName());
+                setCpassword(accountProfileData.getPassword());
+                return "Ready to Trade";
+            } else{
+                Log.log("TradeServletAction.doLogin(...)",   "Error finding account for user " + userID + "", "user entered a bad username or the database is not populated");
+                throw new NullPointerException("User does not exist or password is incorrect!");
+            }            
+        } catch (Exception se) {
+            //Go to welcome page
+            setResults("Could not find account");
+            return "welcome" ;
+        } 
+    }
+    
+    public String register(){
+        TradeAction tAction = new TradeAction();
+        // Validate user passwords match and are atleast 1 char in length
+        try{
+        if ((password.equals(cpassword)) && (password.length() >= 1)) {
+            AccountDataBean accountData = tAction.register(userID, password, fullname, address, email, ccn, new BigDecimal(money));
+            if (accountData == null) {
+                setResults("Registration operation failed;");
+                //Go to register page
+                return "Registration operation failed";
+                
+            } else {                
+                login();              
+                setResults("Registration operation succeeded;  Account " + accountData.getAccountID() + " has been created.");
+                return "Registration operation succeeded";
+            }
+        } else {
+            // Password validation failed
+            setResults("Registration operation failed, your passwords did not match");
+            //Go to register page
+            return "Registration operation failed";
+        }
+        }catch (Exception e) {
+            // log the exception with error page
+            Log.log("TradeServletAction.doRegister(...)" + " exception user =" + userID);
+                try {
+                    throw new Exception("TradeServletAction.doRegister(...)" + " exception user =" + userID, e);
+                } catch (Exception e1) {
+                    // TODO Auto-generated catch block
+                    e1.printStackTrace();
+                }
+            
+        }
+        return "Registration operation succeeded";
+    }
+    
+    public String updateProfile(){
+        TradeAction tAction = new TradeAction();
+        // First verify input data        
+        boolean doUpdate = true;
+        if (password.equals(cpassword) == false) {
+            results = "Update profile error: passwords do not match";
+            doUpdate = false;
+        } 
+        AccountProfileDataBean accountProfileData = new AccountProfileDataBean( userID, password, fullname, address, email, ccn);
+        try {
+            if (doUpdate) {
+                accountProfileData = tAction.updateAccountProfile(accountProfileData);
+                results = "Account profile update successful";
+            }
+
+        } catch (java.lang.IllegalArgumentException e) { // this is a user
+                                                            // error so I will
+            // forward them to another page rather than throw a 500
+           setResults("invalid argument, check userID is correct, and the database is populated" + userID);
+            Log.error(
+                            e,
+                            "TradeServletAction.doAccount(...)",
+                            "illegal argument, information should be in exception string",
+                            "treating this as a user error and forwarding on to a new page");
+        } catch (Exception e) {
+            // log the exception with error page
+           e.printStackTrace();
+        }
+        //Go to account.xhtml
+        return "Go to account";
+    }
+    
+    public String logout(){
+        TradeAction tAction = new TradeAction();
+        try {
+            tAction.logout(userID);
+            
+
+        } catch (java.lang.IllegalArgumentException e) { // this is a user
+                                                            // error so I will
+            // forward them to another page, at the end of the page.
+           setResults("illegal argument:" + e.getMessage());
+
+            // log the exception with an error level of 3 which means, handled
+            // exception but would invalidate a automation run
+            Log.error(
+                            e,
+                            "TradeServletAction.doLogout(...)",
+                            "illegal argument, information should be in exception string",
+                            "treating this as a user error and forwarding on to a new page");
+        } catch (Exception e) {
+            // log the exception and foward to a error page
+            Log.error(e, "TradeServletAction.doLogout(...):", "Error logging out" + userID, "fowarding to an error page");
+           
+        }
+        HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false);
+        if (session != null) {
+            session.invalidate();
+        }
+
+        /*Object o = session.getAttribute("TSS-RecreateSessionInLogout");
+        if (o != null && ((Boolean) o).equals(Boolean.TRUE)) {
+            // Recreate Session object before writing output to the response
+            // Once the response headers are written back to the client the
+            // opportunity
+            // to create a new session in this request may be lost
+            // This is to handle only the TradeScenarioServlet case
+            session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true);
+        }*/
+        //Go to welcome page
+        return "welcome";
+    }
+    
+}
+;
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeConfigJSF.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeConfigJSF.java?rev=1076572&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeConfigJSF.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/Beans/TradeConfigJSF.java Thu Mar  3 10:01:51 2011
@@ -0,0 +1,415 @@
+/**
+ *  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.geronimo.daytrader.javaee6.web.Beans;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.apache.geronimo.daytrader.javaee6.core.beans.RunStatsDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
+import org.apache.geronimo.daytrader.javaee6.web.TradeBuildDB;
+
+@ManagedBean(name = "tradeconfig")
+public class TradeConfigJSF {
+	private String runtimeMode = "Direct (JDBC)";
+	private String JPALayer = "OpenJPA";
+	private String orderProcessingMode = "Synchronous";
+	private int maxUsers = 500;
+	private int maxQuotes = 1000;
+	private int marketSummaryInterval = 20;
+	private String webInterface = "JSP";
+	private int primIterations = 1;
+	private String workloadMix = "Standard";
+	private boolean publishQuotePriceChange = false;
+	private boolean longRun = true;
+	private boolean actionTrace = false;
+	private boolean trace = false;
+	private String[] runtimeModeList = TradeConfig.runTimeModeNames;
+	private String[] JPALayerList = TradeConfig.jpaLayerNames;
+	private String[] orderProcessingModeList = TradeConfig.orderProcessingModeNames;
+	private String[] workloadMixNamesList = TradeConfig.workloadMixNames;
+	private String[] webInterfaceList = TradeConfig.webInterfaceNames;
+	private String result;
+
+	public void updateConfig() {		
+		String currentConfigStr = "\n\n########## Trade configuration update. Current config:\n\n";
+		String runTimeModeStr = this.runtimeMode;
+		if (runTimeModeStr != null) {
+			try {
+				for (int i = 0; i < runtimeModeList.length; i++) {
+				   if(runTimeModeStr.equals(runtimeModeList[i])){
+					   TradeConfig.setRunTimeMode(i);
+				   }
+				}
+			} catch (Exception e) {
+
+				Log.error(
+						e,
+						"TradeConfigJSF.updateConfig(..): minor exception caught",
+						"trying to set runtimemode to " + runTimeModeStr,
+						"reverting to current value");
+
+			} // If the value is bad, simply revert to current
+		}
+		currentConfigStr += "\t\tRunTimeMode:\t\t"
+				+ TradeConfig.runTimeModeNames[TradeConfig.getRunTimeMode()]
+				+ "\n";
+
+		/* Add JPA layer choice to avoid some ugly Hibernate bugs */
+		String jpaLayerStr = JPALayer;
+		if (jpaLayerStr != null) {
+			try {
+				for (int i = 0; i < JPALayerList.length; i++) {
+					   if(jpaLayerStr.equals(JPALayerList[i])){
+						   TradeConfig.jpaLayer = i;
+					   }
+					}
+					
+			} catch (Exception e) {
+				Log.error(e,
+						"TradeConfigJSF.updateConfig(..): minor exception caught",
+						"trying to set JPALayer to " + jpaLayerStr,
+						"reverting to current value");
+
+			} // If the value is bad, simply revert to current
+		}
+		currentConfigStr += "\t\tJPALayer:\t\t"
+				+ TradeConfig.jpaLayerNames[TradeConfig.jpaLayer] + "\n";
+
+		String orderProcessingModeStr = this.orderProcessingMode;
+		if (orderProcessingModeStr != null) {
+			try {
+				for (int i = 0; i < orderProcessingModeList.length; i++) {
+					   if(orderProcessingModeStr.equals(orderProcessingModeList[i])){
+						   TradeConfig.orderProcessingMode = i;
+					   }
+					}					
+			} catch (Exception e) {				
+				Log.error(
+						e,
+						"TradeConfigJSF.updateConfig(..): minor exception caught",
+						"trying to set orderProcessing to "
+								+ orderProcessingModeStr,
+						"reverting to current value");
+
+			} // If the value is bad, simply revert to current
+		}
+		currentConfigStr += "\t\tOrderProcessingMode:\t"
+				+ TradeConfig.orderProcessingModeNames[TradeConfig.orderProcessingMode]
+				+ "\n";
+
+		// String accessModeStr = req.getParameter("AcessMode");
+		String accessModeStr = "Standard";
+		if (accessModeStr != null) {
+			try {
+				TradeConfig.setAccessMode(0);
+			} catch (Exception e) {
+				// >>rjm
+				Log.error(
+						e,
+						"TradeConfigJSF.updateConfig(..): minor exception caught",
+						"trying to set orderProcessing to "
+								+ orderProcessingModeStr,
+						"reverting to current value");
+
+			} // If the value is bad, simply revert to current
+		}
+		currentConfigStr += "\t\tAcessMode:\t\t"
+				+ TradeConfig.accessModeNames[TradeConfig.getAccessMode()]
+				+ "\n";
+
+		String workloadMixStr = workloadMix;
+		if (workloadMixStr != null) {
+			try {
+				for (int i = 0; i < workloadMixNamesList.length; i++) {
+					   if(workloadMixStr.equals(workloadMixNamesList[i])){
+						   TradeConfig.workloadMix = i;
+					   }
+					}	
+					
+			} catch (Exception e) {
+				Log.error(
+						e,
+						"TradeConfigJSF.updateConfig(..): minor exception caught",
+						"trying to set workloadMix to " + workloadMixStr,
+						"reverting to current value");
+			} // If the value is bad, simply revert to current
+		}
+		currentConfigStr += "\t\tWorkload Mix:\t\t"
+				+ TradeConfig.workloadMixNames[TradeConfig.workloadMix] + "\n";
+
+		String webInterfaceStr = webInterface;
+		if (webInterfaceStr != null) {
+			try {
+				for (int i = 0; i < webInterfaceList.length; i++) {
+					   if(webInterfaceStr.equals(webInterfaceList[i])){
+						   TradeConfig.webInterface = i;
+					   }
+					}				
+			} catch (Exception e) {
+				Log.error(
+						e,
+						"TradeConfigJSF.updateConfig(..): minor exception caught",
+						"trying to set WebInterface to " + webInterfaceStr,
+						"reverting to current value");
+
+			} // If the value is bad, simply revert to current
+		}
+		currentConfigStr += "\t\tWeb Interface:\t\t"
+				+ TradeConfig.webInterfaceNames[TradeConfig.webInterface]
+				+ "\n";
+
+		TradeConfig.setMAX_USERS(maxUsers);			
+		TradeConfig.setMAX_QUOTES(maxQuotes);
+		
+		currentConfigStr += "\t\t#Trade  Users:\t\t"
+				+ TradeConfig.getMAX_USERS() + "\n";
+		currentConfigStr += "\t\t#Trade Quotes:\t\t"
+				+ TradeConfig.getMAX_QUOTES() + "\n";
+
+		
+		TradeConfig.setMarketSummaryInterval(marketSummaryInterval);
+		
+		currentConfigStr += "\t\tMarket Summary Interval:\t\t"
+				+ TradeConfig.getMarketSummaryInterval() + "\n";
+
+		TradeConfig.setPrimIterations(primIterations);
+
+		currentConfigStr += "\t\tPrimitive Iterations:\t\t"
+				+ TradeConfig.getPrimIterations() + "\n";
+
+		TradeConfig.setPublishQuotePriceChange(publishQuotePriceChange);
+		currentConfigStr += "\t\tTradeStreamer MDB Enabled:\t"
+				+ TradeConfig.getPublishQuotePriceChange() + "\n";
+
+		Log.setTrace(trace);
+		Log.setActionTrace(actionTrace);
+		TradeConfig.setLongRun(longRun);
+		currentConfigStr += "\t\tLong Run Enabled:\t\t"
+				+ TradeConfig.getLongRun() + "\n";
+
+		System.out.println(currentConfigStr);
+		setResult("DayTrader Configuration Updated");
+	}
+	
+	public String resetTrade(){
+		RunStatsDataBean runStatsData = new RunStatsDataBean();
+		TradeConfig currentConfig = new TradeConfig(); 
+		HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true);
+        try
+        {
+            runStatsData = new TradeAction().resetTrade(false); 
+            session.setAttribute("runStatsData", runStatsData);
+            session.setAttribute("tradeConfig", currentConfig);
+            result += "Trade Reset completed successfully";
+            
+            
+        }
+        catch (Exception e)
+        {
+            result += "Trade Reset Error  - see log for details";
+            session.setAttribute("result", result);
+            Log.error(e,     result);            
+        }
+        //Go to page stats
+        /*getServletConfig().getServletContext()
+                .getRequestDispatcher(TradeConfig.getPage(TradeConfig.STATS_PAGE))
+                .include(req, resp);    */ 
+        return "stats";
+	}
+	
+	public String buildDB(){
+		try {
+			new TradeBuildDB(new java.io.PrintWriter(System.out), null);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        result = "DayTrader Database Built - " + TradeConfig.getMAX_USERS() + "users created";
+        //Got to config.xhtml
+        return "config";
+        
+	}
+	
+	public String buildDBTables(){
+		try {
+			new TradeBuildDB(new java.io.PrintWriter(System.out), FacesContext.getCurrentInstance().getExternalContext().getRealPath("/"));
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		//Go to config.xhtml
+		return "config";
+	}
+
+	public void setRuntimeMode(String runtimeMode) {
+		this.runtimeMode = runtimeMode;
+	}
+
+	public String getRuntimeMode() {
+		return runtimeMode;
+	}
+
+	public void setJPALayer(String jPALayer) {
+		JPALayer = jPALayer;
+	}
+
+	public String getJPALayer() {
+		return JPALayer;
+	}
+
+	public void setOrderProcessingMode(String orderProcessingMode) {
+		this.orderProcessingMode = orderProcessingMode;
+	}
+
+	public String getOrderProcessingMode() {
+		return orderProcessingMode;
+	}
+
+	public void setMaxUsers(int maxUsers) {
+		this.maxUsers = maxUsers;
+	}
+
+	public int getMaxUsers() {
+		return maxUsers;
+	}
+
+	public void setmaxQuotes(int maxQuotes) {
+		this.maxQuotes = maxQuotes;
+	}
+
+	public int getMaxQuotes() {
+		return maxQuotes;
+	}
+
+	public void setMarketSummaryInterval(int marketSummaryInterval) {
+		this.marketSummaryInterval = marketSummaryInterval;
+	}
+
+	public int getMarketSummaryInterval() {
+		return marketSummaryInterval;
+	}
+
+	public void setPrimIterations(int primIterations) {
+		this.primIterations = primIterations;
+	}
+
+	public int getPrimIterations() {
+		return primIterations;
+	}
+
+	public void setWorkloadMix(String workloadMix) {
+		this.workloadMix = workloadMix;
+	}
+
+	public String getWorkloadMix() {
+		return workloadMix;
+	}
+
+	public void setPublishQuotePriceChange(boolean publishQuotePriceChange) {
+		this.publishQuotePriceChange = publishQuotePriceChange;
+	}
+
+	public boolean isPublishQuotePriceChange() {
+		return publishQuotePriceChange;
+	}
+
+	public void setLongRun(boolean longRun) {
+		this.longRun = longRun;
+	}
+
+	public boolean isLongRun() {
+		return longRun;
+	}
+
+	public void setTrace(boolean trace) {
+		this.trace = trace;
+	}
+
+	public boolean isTrace() {
+		return trace;
+	}
+
+	public void setRuntimeModeList(String[] runtimeModeList) {
+		this.runtimeModeList = runtimeModeList;
+	}
+
+	public String[] getRuntimeModeList() {
+		return runtimeModeList;
+	}
+
+	public void setJPALayerList(String[] jPALayerList) {
+		JPALayerList = jPALayerList;
+	}
+
+	public String[] getJPALayerList() {
+		return JPALayerList;
+	}
+
+	public void setOrderProcessingModeList(String[] orderProcessingModeList) {
+		this.orderProcessingModeList = orderProcessingModeList;
+	}
+
+	public String[] getOrderProcessingModeList() {
+		return orderProcessingModeList;
+	}
+
+	public void setWorkloadMixNamesList(String[] workloadMixNamesList) {
+		this.workloadMixNamesList = workloadMixNamesList;
+	}
+
+	public String[] getWorkloadMixNamesList() {
+		return workloadMixNamesList;
+	}
+
+	public void setWebInterface(String webInterface) {
+		this.webInterface = webInterface;
+	}
+
+	public String getWebInterface() {
+		return webInterface;
+	}
+
+	public void setWebInterfaceList(String[] webInterfaceList) {
+		this.webInterfaceList = webInterfaceList;
+	}
+
+	public String[] getWebInterfaceList() {
+		return webInterfaceList;
+	}
+
+	public void setActionTrace(boolean actionTrace) {
+		this.actionTrace = actionTrace;
+	}
+
+	public boolean isActionTrace() {
+		return actionTrace;
+	}
+
+	public void setResult(String result) {
+		this.result = result;
+	}
+
+	public String getResult() {
+		return result;
+	}
+
+}

Modified: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/OrdersAlertFilter.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/OrdersAlertFilter.java?rev=1076572&r1=1076571&r2=1076572&view=diff
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/OrdersAlertFilter.java (original)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/OrdersAlertFilter.java Thu Mar  3 10:01:51 2011
@@ -22,7 +22,7 @@ import javax.servlet.http.*;
 import javax.servlet.annotation.WebFilter;
 
 
-import org.apache.geronimo.daytrader.javaee6.core.direct.TradeAction;
+import org.apache.geronimo.daytrader.javaee6.web.TradeAction;
 import org.apache.geronimo.daytrader.javaee6.core.api.TradeServices;
 
 import org.apache.geronimo.daytrader.javaee6.utils.Log;



Mime
View raw message