geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viol...@apache.org
Subject svn commit: r1071543 [6/15] - in /geronimo/daytrader/trunk: ./ assemblies/javaee/ javaee6/ javaee6/assemblies/ javaee6/assemblies/daytrader-ear/ javaee6/assemblies/daytrader-ear/src/ javaee6/assemblies/daytrader-ear/src/main/ javaee6/assemblies/daytrad...
Date Thu, 17 Feb 2011 08:24:04 GMT
Added: geronimo/daytrader/trunk/javaee6/modules/entities/src/main/java/org/apache/geronimo/daytrader/javaee6/entities/OrderDataBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/entities/src/main/java/org/apache/geronimo/daytrader/javaee6/entities/OrderDataBean.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/entities/src/main/java/org/apache/geronimo/daytrader/javaee6/entities/OrderDataBean.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/entities/src/main/java/org/apache/geronimo/daytrader/javaee6/entities/OrderDataBean.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,386 @@
+/**
+ *  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.entities;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+import javax.validation.constraints.NotNull;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+@Entity(name="orderejb")
+@Table(name = "orderejb")
+@NamedQueries( {
+    @NamedQuery(name = "orderejb.findByOrderfee", query = "SELECT o FROM orderejb o WHERE o.orderFee = :orderfee"),
+    @NamedQuery(name = "orderejb.findByCompletiondate", query = "SELECT o FROM orderejb o WHERE o.completionDate = :completiondate"),
+    @NamedQuery(name = "orderejb.findByOrdertype", query = "SELECT o FROM orderejb o WHERE o.orderType = :ordertype"),
+    @NamedQuery(name = "orderejb.findByOrderstatus", query = "SELECT o FROM orderejb o WHERE o.orderStatus = :orderstatus"),
+    @NamedQuery(name = "orderejb.findByPrice", query = "SELECT o FROM orderejb o WHERE o.price = :price"),
+    @NamedQuery(name = "orderejb.findByQuantity", query = "SELECT o FROM orderejb o WHERE o.quantity = :quantity"),
+    @NamedQuery(name = "orderejb.findByOpendate", query = "SELECT o FROM orderejb o WHERE o.openDate = :opendate"),
+    @NamedQuery(name = "orderejb.findByOrderid", query = "SELECT o FROM orderejb o WHERE o.orderID = :orderid"),
+    @NamedQuery(name = "orderejb.findByAccountAccountid", query = "SELECT o FROM orderejb o WHERE o.account.accountID = :accountAccountid"),
+    @NamedQuery(name = "orderejb.findByQuoteSymbol", query = "SELECT o FROM orderejb o WHERE o.quote.symbol = :quoteSymbol"),
+    // Never used query related to FK constraint on holdingejb. the FK constraint will cause EJB3 runtime mode failure. So comment it.
+    //@NamedQuery(name = "orderejb.findByHoldingHoldingid", query = "SELECT o FROM orderejb o WHERE o.holding.holdingID = :holdingHoldingid"),
+    @NamedQuery(name = "orderejb.closedOrders", query = "SELECT o FROM orderejb o WHERE o.orderStatus = 'closed' AND o.account.profile.userID  = :userID"),
+    @NamedQuery(name = "orderejb.completeClosedOrders", query = "UPDATE orderejb o SET o.orderStatus = 'completed' WHERE o.orderStatus = 'closed' AND o.account.profile.userID  = :userID")
+})
+public class OrderDataBean implements Serializable
+{
+
+    @TableGenerator(
+            name="orderIdGen",
+            table="keygenejb",
+            pkColumnName="KEYNAME",
+            valueColumnName="KEYVAL",
+            pkColumnValue="order",
+            allocationSize=1000)
+    @Id
+    @GeneratedValue(strategy=GenerationType.TABLE, generator="orderIdGen")
+    @Column(name = "ORDERID", nullable = false)  
+    @NotNull
+    private Integer orderID;            /* orderID */
+    
+    @Column(name = "ORDERTYPE")
+    private String orderType;           /* orderType (buy, sell, etc.) */
+    
+    @Column(name = "ORDERSTATUS")
+    private String orderStatus;         /* orderStatus (open, processing, completed, closed, cancelled) */
+    
+    @Column(name = "OPENDATE")
+    @Temporal(TemporalType.TIMESTAMP)
+    private Date openDate;              /* openDate (when the order was entered) */
+    
+    @Column(name = "COMPLETIONDATE")
+    @Temporal(TemporalType.TIMESTAMP)
+    private Date completionDate;        /* completionDate */
+    
+    @Column(name = "QUANTITY", nullable = false)
+    @NotNull
+    private double quantity;            /* quantity */
+    
+    @Column(name = "PRICE")
+    private BigDecimal price;                /* price */
+    
+    @Column(name = "ORDERFEE")
+    private BigDecimal orderFee;            /* price */
+    
+    @ManyToOne(fetch=FetchType.LAZY)
+    @JoinColumn(name="ACCOUNT_ACCOUNTID")
+    private AccountDataBean account;
+    
+    @ManyToOne(fetch=FetchType.EAGER)
+    @JoinColumn(name="QUOTE_SYMBOL")
+    private QuoteDataBean quote;
+    
+    // Cause sell operation failed, see JIRA DAYTRADER-63 for details.
+    // rollback change for fullejb3 mode operation failures
+    // In JPA programming mode, the database schema cannot be created by JPA provider, 
+    // instead, user need to create db schema by self. And cannot enalbe foreign key constraint,
+    // Since the foreign key constraint is controled by code logic, not database logic.
+    @OneToOne(fetch=FetchType.LAZY)
+    @JoinColumn(name = "HOLDING_HOLDINGID")
+    // rollback change for fullejb3 mode operation failures
+    //@Transient    
+    private HoldingDataBean holding;
+
+//    @Version
+//    private Integer optLock;
+
+    /* Fields for relationship fields are not kept in the Data Bean */
+    @Transient
+    private String symbol;
+
+    public OrderDataBean() {        
+    }
+
+    public OrderDataBean(Integer orderID,
+                            String orderType,
+                            String orderStatus,
+                            Date openDate,
+                            Date completionDate,
+                            double quantity,
+                            BigDecimal price,
+                            BigDecimal orderFee,
+                            String symbol
+                            ) {
+        setOrderID(orderID);
+        setOrderType(orderType);
+        setOrderStatus(orderStatus);
+        setOpenDate(openDate);
+        setCompletionDate(completionDate);
+        setQuantity(quantity);
+        setPrice(price);
+        setOrderFee(orderFee);
+        setSymbol(symbol);
+    }
+    
+    public OrderDataBean(String orderType,
+            String orderStatus,
+            Date openDate,
+            Date completionDate,
+            double quantity,
+            BigDecimal price,
+            BigDecimal orderFee,
+            AccountDataBean account,
+            QuoteDataBean quote, HoldingDataBean holding) {
+        setOrderType(orderType);
+        setOrderStatus(orderStatus);
+        setOpenDate(openDate);
+        setCompletionDate(completionDate);
+        setQuantity(quantity);
+        setPrice(price);
+        setOrderFee(orderFee);
+        setAccount(account);
+        setQuote(quote);
+        setHolding(holding);
+    }
+
+    public static OrderDataBean getRandomInstance() {
+        return new OrderDataBean(
+            new Integer(TradeConfig.rndInt(100000)),
+            TradeConfig.rndBoolean() ? "buy" : "sell",
+            "open",
+            new java.util.Date(TradeConfig.rndInt(Integer.MAX_VALUE)),
+            new java.util.Date(TradeConfig.rndInt(Integer.MAX_VALUE)),
+            TradeConfig.rndQuantity(),
+            TradeConfig.rndBigDecimal(1000.0f),
+            TradeConfig.rndBigDecimal(1000.0f),
+            TradeConfig.rndSymbol()
+        );
+    }
+
+    public String toString()
+    {
+        return "Order " + getOrderID()
+                + "\n\t      orderType: " + getOrderType()
+                + "\n\t    orderStatus: " +    getOrderStatus()
+                + "\n\t       openDate: " +    getOpenDate()
+                + "\n\t completionDate: " +    getCompletionDate()
+                + "\n\t       quantity: " +    getQuantity()
+                + "\n\t          price: " +    getPrice()
+                + "\n\t       orderFee: " +    getOrderFee()
+                + "\n\t         symbol: " +    getSymbol()
+                ;
+    }
+    public String toHTML()
+    {
+        return "<BR>Order <B>" + getOrderID() + "</B>"
+                + "<LI>      orderType: " + getOrderType() + "</LI>"
+                + "<LI>    orderStatus: " +    getOrderStatus() + "</LI>"
+                + "<LI>       openDate: " +    getOpenDate() + "</LI>"
+                + "<LI> completionDate: " +    getCompletionDate() + "</LI>"
+                + "<LI>       quantity: " +    getQuantity() + "</LI>"
+                + "<LI>          price: " +    getPrice() + "</LI>"
+                + "<LI>       orderFee: " +    getOrderFee() + "</LI>"
+                + "<LI>         symbol: " +    getSymbol() + "</LI>"
+                ;
+    }
+
+    public void print()
+    {
+        Log.log( this.toString() );
+    }
+
+    public Integer getOrderID() {
+        return orderID;
+    }
+
+    public void setOrderID(Integer orderID) {
+        this.orderID = orderID;
+    }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
+
+    public String getOrderStatus() {
+        return orderStatus;
+    }
+
+    public void setOrderStatus(String orderStatus) {
+        this.orderStatus = orderStatus;
+    }
+
+    public Date getOpenDate() {
+        return openDate;
+    }
+
+    public void setOpenDate(Date openDate) {
+        this.openDate = openDate;
+    }
+
+    public Date getCompletionDate() {
+        return completionDate;
+    }
+
+    public void setCompletionDate(Date completionDate) {
+        this.completionDate = completionDate;
+    }
+
+    public double getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(double quantity) {
+        this.quantity = quantity;
+    }
+
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public BigDecimal getOrderFee() {
+        return orderFee;
+    }
+
+    public void setOrderFee(BigDecimal orderFee) {
+        this.orderFee = orderFee;
+    }
+
+    public String getSymbol() {
+        if (quote != null) {
+            return quote.getSymbol();
+        }
+        return symbol;
+    }
+
+    public void setSymbol(String symbol) {
+        this.symbol = symbol;
+    }
+
+    public AccountDataBean getAccount() {
+        return account;
+    }
+
+    public void setAccount(AccountDataBean account) {
+        this.account = account;
+    }
+
+    public QuoteDataBean getQuote() {
+        return quote;
+    }
+
+    public void setQuote(QuoteDataBean quote) {
+        this.quote = quote;
+    }
+
+    public HoldingDataBean getHolding() {
+        return holding;
+    }
+
+    public void setHolding(HoldingDataBean holding) {
+        this.holding = holding;
+    }
+
+    public boolean isBuy()
+    {
+        String orderType = getOrderType();
+        if ( orderType.compareToIgnoreCase("buy") == 0 )
+            return true;
+        return false;
+    }
+
+    public boolean isSell()
+    {
+        String orderType = getOrderType();
+        if ( orderType.compareToIgnoreCase("sell") == 0 )
+            return true;
+        return false;
+    }
+
+    public boolean isOpen()
+    {
+        String orderStatus = getOrderStatus();
+        if ( (orderStatus.compareToIgnoreCase("open") == 0) ||
+             (orderStatus.compareToIgnoreCase("processing") == 0) )
+                return true;
+        return false;
+    }
+
+    public boolean isCompleted()
+    {
+        String orderStatus = getOrderStatus();
+        if ( (orderStatus.compareToIgnoreCase("completed") == 0) ||
+             (orderStatus.compareToIgnoreCase("alertcompleted") == 0)    ||
+             (orderStatus.compareToIgnoreCase("cancelled") == 0) )
+                return true;
+        return false;
+    }
+
+    public boolean isCancelled()
+    {
+        String orderStatus = getOrderStatus();
+        if (orderStatus.compareToIgnoreCase("cancelled") == 0)
+                return true;
+        return false;
+    }
+
+
+    public void cancel()
+    {
+        setOrderStatus("cancelled");
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 0;
+        hash += (this.orderID != null ? this.orderID.hashCode() : 0);
+        return hash;
+    }
+    
+    @Override
+    public boolean equals(Object object) {
+        // TODO: Warning - this method won't work in the case the id fields are not set
+        if (!(object instanceof OrderDataBean)) {
+            return false;
+        }
+        OrderDataBean other = (OrderDataBean)object;
+        if (this.orderID != other.orderID && (this.orderID == null || !this.orderID.equals(other.orderID))) return false;
+        return true;
+    }
+}
+

Added: geronimo/daytrader/trunk/javaee6/modules/entities/src/main/java/org/apache/geronimo/daytrader/javaee6/entities/QuoteDataBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/entities/src/main/java/org/apache/geronimo/daytrader/javaee6/entities/QuoteDataBean.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/entities/src/main/java/org/apache/geronimo/daytrader/javaee6/entities/QuoteDataBean.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/entities/src/main/java/org/apache/geronimo/daytrader/javaee6/entities/QuoteDataBean.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,232 @@
+/**
+ *  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.entities;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Collection;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.NamedNativeQueries;
+import javax.persistence.NamedNativeQuery;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+@Entity(name = "quoteejb")
+@Table(name = "quoteejb")
+@NamedQueries({
+    @NamedQuery(name = "quoteejb.allQuotes",query = "SELECT q FROM quoteejb q"),
+//    @NamedQuery(name = "quoteejb.quotesByChange",query = "SELECT q FROM quoteejb q WHERE q.symbol LIKE 's:1__' ORDER BY q.change1 DESC"),
+    @NamedQuery(name = "quoteejb.quotesByChange",query = "SELECT q FROM quoteejb q WHERE q.symbol LIKE 's:1__' ORDER BY q.change1 "),
+    @NamedQuery(name = "quoteejb.findByLow", query = "SELECT q FROM quoteejb q WHERE q.low = :low"),
+    @NamedQuery(name = "quoteejb.findByOpen1", query = "SELECT q FROM quoteejb q WHERE q.open1 = :open1"),
+    @NamedQuery(name = "quoteejb.findByVolume", query = "SELECT q FROM quoteejb q WHERE q.volume = :volume"),
+    @NamedQuery(name = "quoteejb.findByPrice", query = "SELECT q FROM quoteejb q WHERE q.price = :price"),
+    @NamedQuery(name = "quoteejb.findByHigh", query = "SELECT q FROM quoteejb q WHERE q.high = :high"),
+    @NamedQuery(name = "quoteejb.findByCompanyname", query = "SELECT q FROM quoteejb q WHERE q.companyName = :companyname"),
+    @NamedQuery(name = "quoteejb.findBySymbol", query = "SELECT q FROM quoteejb q WHERE q.symbol = :symbol"),
+    @NamedQuery(name = "quoteejb.findByChange1", query = "SELECT q FROM quoteejb q WHERE q.change1 = :change1")
+})
+@NamedNativeQueries({
+    @NamedNativeQuery(name="quoteejb.quoteForUpdate", query="select * from quoteejb q where q.symbol=? for update",resultClass=org.apache.geronimo.daytrader.javaee6.entities.QuoteDataBean.class)
+})
+public class QuoteDataBean implements Serializable {
+
+    /* Accessor methods for persistent fields */
+
+    @Id
+    @Column(name = "SYMBOL", nullable = false)
+    @NotNull
+    private String symbol;          /* symbol */
+    
+    @Column(name = "COMPANYNAME")
+    private String companyName;     /* companyName */
+    
+    @Column(name = "VOLUME", nullable = false)
+    @NotNull
+    private double volume;          /* volume */
+    
+    @Column(name = "PRICE")
+    private BigDecimal price;       /* price */
+    
+    @Column(name = "OPEN1")
+    private BigDecimal open1;       /* open1 price */
+    
+    @Column(name = "LOW")
+    private BigDecimal low;         /* low price */
+    
+    @Column(name = "HIGH")
+    private BigDecimal high;        /* high price */
+    
+    @Column(name = "CHANGE1", nullable = false)
+    @NotNull
+    private double change1;         /* price change */    
+    
+
+    /* Accessor methods for relationship fields are not kept in the DataBean */
+    
+    public QuoteDataBean() {
+    }
+
+    public QuoteDataBean(String symbol, String companyName, double volume,
+            BigDecimal price, BigDecimal open, BigDecimal low,
+            BigDecimal high, double change) {
+        setSymbol(symbol);
+        setCompanyName(companyName);
+        setVolume(volume);
+        setPrice(price);
+        setOpen(open);
+        setLow(low);
+        setHigh(high);
+        setChange(change);
+    }
+
+    public static QuoteDataBean getRandomInstance() {
+        return new QuoteDataBean(
+                TradeConfig.rndSymbol(),                 //symbol
+                TradeConfig.rndSymbol() + " Incorporated",         //Company Name
+                TradeConfig.rndFloat(100000),            //volume
+                TradeConfig.rndBigDecimal(1000.0f),     //price
+                TradeConfig.rndBigDecimal(1000.0f),     //open1
+                TradeConfig.rndBigDecimal(1000.0f),     //low
+                TradeConfig.rndBigDecimal(1000.0f),     //high
+                TradeConfig.rndFloat(100000)            //volume
+        );
+    }
+
+    //Create a "zero" value quoteDataBean for the given symbol
+    public QuoteDataBean(String symbol) {
+        setSymbol(symbol);
+    }
+
+    public String toString() {
+        return "\n\tQuote Data for: " + getSymbol()
+                + "\n\t\t companyName: " + getCompanyName()
+                + "\n\t\t      volume: " + getVolume()
+                + "\n\t\t       price: " + getPrice()
+                + "\n\t\t        open1: " + getOpen()
+                + "\n\t\t         low: " + getLow()
+                + "\n\t\t        high: " + getHigh()
+                + "\n\t\t      change1: " + getChange()
+                ;
+    }
+
+    public String toHTML() {
+        return "<BR>Quote Data for: " + getSymbol()
+                + "<LI> companyName: " + getCompanyName() + "</LI>"
+                + "<LI>      volume: " + getVolume() + "</LI>"
+                + "<LI>       price: " + getPrice() + "</LI>"
+                + "<LI>        open1: " + getOpen() + "</LI>"
+                + "<LI>         low: " + getLow() + "</LI>"
+                + "<LI>        high: " + getHigh() + "</LI>"
+                + "<LI>      change1: " + getChange() + "</LI>"
+                ;
+    }
+
+    public void print() {
+        Log.log(this.toString());
+    }
+
+    public String getSymbol() {
+        return symbol;
+    }
+
+    public void setSymbol(String symbol) {
+        this.symbol = symbol;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public BigDecimal getOpen() {
+        return open1;
+    }
+
+    public void setOpen(BigDecimal open) {
+        this.open1 = open;
+    }
+
+    public BigDecimal getLow() {
+        return low;
+    }
+
+    public void setLow(BigDecimal low) {
+        this.low = low;
+    }
+
+    public BigDecimal getHigh() {
+        return high;
+    }
+
+    public void setHigh(BigDecimal high) {
+        this.high = high;
+    }
+
+    public double getChange() {
+        return change1;
+    }
+
+    public void setChange(double change) {
+        this.change1 = change;
+    }
+
+    public double getVolume() {
+        return volume;
+    }
+
+    public void setVolume(double volume) {
+        this.volume = volume;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 0;
+        hash += (this.symbol != null ? this.symbol.hashCode() : 0);
+        return hash;
+    }
+    
+    @Override
+    public boolean equals(Object object) {
+        // TODO: Warning - this method won't work in the case the id fields are not set
+        if (!(object instanceof QuoteDataBean)) {
+            return false;
+        }
+        QuoteDataBean other = (QuoteDataBean)object;
+        if (this.symbol != other.symbol && (this.symbol == null || !this.symbol.equals(other.symbol))) return false;
+        return true;
+    }
+}

Added: geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/LICENSE?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/LICENSE (added)
+++ geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/LICENSE Thu Feb 17 08:23:57 2011
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Added: geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/NOTICE?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/NOTICE (added)
+++ geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/NOTICE Thu Feb 17 08:23:57 2011
@@ -0,0 +1,9 @@
+Apache Geronimo 
+Copyright 2003-2010 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were developed at IBM and donated to the 
+ASF under the Apache 2.0 license.  The former work was referred to 
+as Trade 6.

Added: geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/persistence.xml?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/persistence.xml (added)
+++ geronimo/daytrader/trunk/javaee6/modules/entities/src/main/resources/META-INF/persistence.xml Thu Feb 17 08:23:57 2011
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
+
+    <persistence-unit transaction-type="RESOURCE_LOCAL" name="daytrader">
+        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <jta-data-source>jdbc/TradeDataSource</jta-data-source>  
+        <non-jta-data-source>jdbc/NoTxTradeDataSource</non-jta-data-source> 
+        
+        <class>org.apache.geronimo.daytrader.entities.AccountDataBean</class>
+        <class>org.apache.geronimo.daytrader.entities.AccountProfileDataBean</class>
+        <class>org.apache.geronimo.daytrader.entities.HoldingDataBean</class>
+        <class>org.apache.geronimo.daytrader.entities.OrderDataBean</class>
+        <class>org.apache.geronimo.daytrader.entities.QuoteDataBean</class>
+        <exclude-unlisted-classes>true</exclude-unlisted-classes>
+        
+        <properties>
+            <property name="openjpa.DynamicEnhancementAgent" value="false"/>
+            <property name="openjpa.BrokerImpl" value="non-finalizing" />
+            <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+            <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>
+
+            <!--
+            <property name="openjpa.jdbc.DBDictionary" value="derby" />
+            <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/> 
+            <property name="openjpa.jdbc.UpdateManager" value="org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager(batchLimit=0)" />
+            <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+            <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+            <property name="openjpa.ConnectionURL" value="jdbc:derby:tradedb;create=true"/>
+            <property name="openjpa.ConnectionProperties" value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:tradedb;create=true,MaxActive=50,MaxWait=10000,Username=,Password="/>
+            -->
+        </properties>
+    </persistence-unit>
+</persistence>

Added: geronimo/daytrader/trunk/javaee6/modules/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/pom.xml?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/pom.xml (added)
+++ geronimo/daytrader/trunk/javaee6/modules/pom.xml Thu Feb 17 08:23:57 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>javaee6</artifactId>
+    <groupId>org.apache.geronimo.daytrader</groupId>
+    <version>3.0-SNAPSHOT</version>    
+  </parent>
+  <groupId>org.apache.geronimo.daytrader.javaee6</groupId>
+  <artifactId>modules</artifactId>  
+  <name>DayTrader :: Java EE 6 :: Modules</name>
+  <description>Daytrader Java EE 6 Modules</description>
+  <packaging>pom</packaging>  
+  
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <modules>
+    <module>entities</module>
+    <!--<module>ejb3</module>-->
+    <module>utils</module>
+    <module>core</module>
+    <module>web</module>
+  </modules>
+</project>
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/utils/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/utils/pom.xml?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/utils/pom.xml (added)
+++ geronimo/daytrader/trunk/javaee6/modules/utils/pom.xml Thu Feb 17 08:23:57 2011
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <parent>
+    <artifactId>modules</artifactId>
+    <groupId>org.apache.geronimo.daytrader.javaee6</groupId>
+    <version>3.0-SNAPSHOT</version>
+  </parent>
+  
+  <groupId>org.apache.geronimo.daytrader.javaee6</groupId>
+  <artifactId>utils</artifactId>
+  
+  <name>DayTrader :: Java EE 6 :: Modules - Utils</name>
+  <description>Daytrader Java EE 6 Utils Module</description>
+   <dependencies>
+   
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jta_1.1_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>    
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jms_1.1_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-annotation_1.1_spec</artifactId>
+            <scope>provided</scope>
+    </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ejb_3.1_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <scope>provided</scope>
+        </dependency>       
+    </dependencies>
+</project>

Added: geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/KeyBlock.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/KeyBlock.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/KeyBlock.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/KeyBlock.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,129 @@
+/**
+ *  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.utils;
+
+import java.util.AbstractSequentialList;
+import java.util.ListIterator;
+public class KeyBlock extends AbstractSequentialList 
+{
+
+    // min and max provide range of valid primary keys for this KeyBlock
+    private int min = 0;
+    private int max = 0;
+    private int index = 0;
+
+    /**
+     * Constructor for KeyBlock
+     */
+    public KeyBlock() {
+        super();
+        min = 0;
+        max = 0;
+        index = min;
+    }
+
+    /**
+     * Constructor for KeyBlock 
+     */
+    public KeyBlock(int min, int max) {
+        super();
+        this.min = min;
+        this.max = max;
+        index = min;
+    }
+
+    /**
+     * @see AbstractCollection#size()
+     */
+    public int size() {
+        return (max - min) + 1;
+    }
+
+    /**
+     * @see AbstractSequentialList#listIterator(int)
+     */
+    public ListIterator listIterator(int arg0) {
+        return new KeyBlockIterator();
+    }
+
+    class KeyBlockIterator implements ListIterator {
+
+        /**
+         * @see ListIterator#hasNext()
+         */
+        public boolean hasNext() {
+            return index <= max;
+        }
+
+        /**
+         * @see ListIterator#next()
+         */
+        public synchronized Object next() {
+            if (index > max)
+                throw new java.lang.RuntimeException("KeyBlock:next() -- Error KeyBlock depleted");
+            return new Integer(index++);
+        }
+
+        /**
+         * @see ListIterator#hasPrevious()
+         */
+        public boolean hasPrevious() {
+            return index > min;
+        }
+
+        /**
+         * @see ListIterator#previous()
+         */
+        public Object previous() {
+            return new Integer(--index);
+        }
+
+        /**
+         * @see ListIterator#nextIndex()
+         */
+        public int nextIndex() {
+            return index-min;
+        }
+
+        /**
+         * @see ListIterator#previousIndex()
+         */
+        public int previousIndex() {
+            throw new UnsupportedOperationException("KeyBlock: previousIndex() not supported");
+        }
+
+        /**
+         * @see ListIterator#add()
+         */
+        public void add(Object o) {
+            throw new UnsupportedOperationException("KeyBlock: add() not supported");
+        }
+
+        /**
+         * @see ListIterator#remove()
+         */
+        public void remove() {
+            throw new UnsupportedOperationException("KeyBlock: remove() not supported");
+        }
+
+        /**
+         * @see ListIterator#set(Object)
+         */
+        public void set(Object arg0) {
+        }
+    }
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/Log.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/Log.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/Log.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/Log.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,211 @@
+/**
+ *  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.utils;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.apache.commons.logging.*;
+
+
+public class Log {
+    private final static org.apache.commons.logging.Log log = LogFactory.getLog(Log.class);
+//A general purpose, high performance logging, tracing, statistic service
+
+    public static void log(String message)
+    {
+        log.debug("DayTrader Log:" + new java.util.Date() + "------\n\t ");
+        log.debug(message);
+    }
+    public static void log(String msg1, String msg2)
+    {
+        log(msg1+msg2);
+    }
+    public static void log(String msg1, String msg2, String msg3)
+    {
+        log(msg1+msg2+msg3);
+    }
+    
+    public static void error(String message)
+    {
+        message = "Error: " + message;
+        log.error(message);
+    }
+    public static void error(String message, Throwable e)
+    {
+        error(message+"\n\t"+e.toString());
+        e.printStackTrace(System.out);
+    }
+    public static void error(String msg1, String msg2, Throwable e)
+    {
+        error(msg1+"\n"+msg2+"\n\t", e);
+    }
+    public static void error(String msg1, String msg2, String msg3, Throwable e)
+    {
+        error(msg1+"\n"+msg2+"\n"+msg3+"\n\t", e);
+    }
+    public static void error(Throwable e, String message)
+    {
+        error(message+"\n\t",e);
+        e.printStackTrace(System.out);
+    }
+    public static void error(Throwable e, String msg1, String msg2)
+    {
+        error(msg1+"\n"+msg2+"\n\t",e);
+    }
+    public static void error(Throwable e, String msg1, String msg2, String msg3)
+    {
+        error(msg1+"\n"+msg2+"\n"+msg3+"\n\t", e);
+    }
+    
+    
+    public static void trace(String message)
+    {
+        log.trace(message + " threadID="+ Thread.currentThread());
+    }
+
+    public static void trace(String message, Object parm1)
+    {
+        trace(message+"("+parm1+")");
+    }
+
+    public static void trace(String message, Object parm1, Object parm2)
+    {
+        trace(message+"("+parm1+", "+parm2+")");
+    }
+
+    public static void trace(String message, Object parm1, Object parm2, Object parm3)
+    {
+        trace(message+"("+parm1+", "+parm2+", "+parm3+")");
+    }
+    public static void trace(String message, Object parm1, Object parm2, Object parm3, Object parm4)
+    {
+        trace(message+"("+parm1+", "+parm2+", "+parm3+")"+", "+parm4);
+    }
+    public static void trace(String message, Object parm1, Object parm2, Object parm3, Object parm4, Object parm5)
+    {
+        trace(message+"("+parm1+", "+parm2+", "+parm3+")"+", "+parm4+", "+parm5);
+    }
+    public static void trace(String message, Object parm1, Object parm2, Object parm3, Object parm4, 
+                                Object parm5, Object parm6)
+    {
+        trace(message+"("+parm1+", "+parm2+", "+parm3+")"+", "+parm4+", "+parm5+", "+parm6);
+    }
+    public static void trace(String message, Object parm1, Object parm2, Object parm3, Object parm4, 
+                                  Object parm5, Object parm6, Object parm7)
+    {
+        trace(message+"("+parm1+", "+parm2+", "+parm3+")"+", "+parm4+", "+parm5+", "+parm6+", "+parm7);
+    }
+    public static void traceEnter(String message)
+    {
+        log.trace("Method enter --" + message);
+    }
+    public static void traceExit(String message)
+    {
+        log.trace("Method exit  --" + message);
+    }
+    
+    
+    public static void stat(String message)
+    {
+        log(message);
+    }
+
+    public static void debug(String message)
+    {
+        log.debug(message);
+    }
+
+    public static void print(String message)
+    {
+        log(message);
+    }
+    
+    public static void printObject(Object o)
+    {
+        log("\t"+o.toString());
+    }
+        
+    public static void printCollection(Collection c)
+    {
+        log("\t---Log.printCollection -- collection size=" + c.size());
+        Iterator it = c.iterator();
+        while ( it.hasNext() )
+        {
+            log("\t\t"+it.next().toString());
+        }
+        log("\t---Log.printCollection -- complete");        
+    }
+    
+    public static void printCollection(String message, Collection c)
+    {
+        log(message);
+        printCollection(c);
+    }
+    
+    public static boolean doActionTrace()
+    {
+        return getTrace() || getActionTrace();
+    }
+
+    public static boolean doTrace()
+    {
+        return getTrace();
+    }
+    
+    public static boolean doDebug()
+    {
+        return true;
+    }
+    
+    public static boolean doStat()
+    {
+        return true;
+    }        
+    
+    /**
+     * Gets the trace
+     * @return Returns a boolean
+     */
+    public static boolean getTrace() {
+        return TradeConfig.getTrace();
+    }
+    /**
+     * Gets the trace value for Trade actions only
+     * @return Returns a boolean
+     */
+    public static boolean getActionTrace() {
+        return TradeConfig.getActionTrace();
+    }
+        
+    /**
+     * Sets the trace
+     * @param trace The trace to set
+     */
+    public static void setTrace(boolean traceValue)
+    {
+        TradeConfig.setTrace(traceValue);
+    }
+    /**
+     * Sets the trace value for Trade actions only
+     * @param trace The trace to set
+     */
+    public static void setActionTrace(boolean traceValue)
+    {
+        TradeConfig.setActionTrace(traceValue);
+    }
+}
+

Added: geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/MDBStats.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/MDBStats.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/MDBStats.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/MDBStats.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,72 @@
+/**
+ *  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.utils;
+
+
+/**
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates.
+ * To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class MDBStats extends java.util.HashMap {
+    
+    
+    //Singleton class
+    private static MDBStats mdbStats = null;
+    private MDBStats()
+    {
+    }
+    
+    public static synchronized MDBStats getInstance()
+    {
+        if (mdbStats == null)
+            mdbStats = new MDBStats();
+        return mdbStats;
+    }
+    
+    public TimerStat addTiming(String type, long sendTime, long recvTime)
+    {
+        TimerStat stats = null;
+        synchronized (type)
+        {
+
+            stats = (TimerStat) get(type);
+            if (stats == null) stats = new TimerStat();
+
+            long time =  recvTime - sendTime;                                
+            if ( time > stats.getMax() ) stats.setMax(time);
+            if ( time < stats.getMin() ) stats.setMin(time);
+            stats.setCount(stats.getCount()+1);
+            stats.setTotalTime(stats.getTotalTime() + time);
+            
+            put(type, stats);
+        }
+        return stats;
+    }
+
+
+
+    public synchronized void reset()
+    {
+        clear();
+    }    
+    
+
+
+}

Added: geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/TimerStat.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/TimerStat.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/TimerStat.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/utils/src/main/java/org/apache/geronimo/daytrader/javaee6/utils/TimerStat.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,121 @@
+/**
+ *  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.utils;
+
+/**
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates.
+ * To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class TimerStat {
+
+        private double min=1000000000.0, max=0.0, totalTime=0.0;
+        private int count;
+        /**
+         * Returns the count.
+         * @return int
+         */
+        public int getCount() {
+            return count;
+        }
+
+        /**
+         * Returns the max.
+         * @return double
+         */
+        public double getMax() {
+            return max;
+        }
+
+        /**
+         * Returns the min.
+         * @return double
+         */
+        public double getMin() {
+            return min;
+        }
+
+        /**
+         * Sets the count.
+         * @param count The count to set
+         */
+        public void setCount(int count) {
+            this.count = count;
+        }
+
+        /**
+         * Sets the max.
+         * @param max The max to set
+         */
+        public void setMax(double max) {
+            this.max = max;
+        }
+
+        /**
+         * Sets the min.
+         * @param min The min to set
+         */
+        public void setMin(double min) {
+            this.min = min;
+        }
+
+        /**
+         * Returns the totalTime.
+         * @return double
+         */
+        public double getTotalTime() {
+            return totalTime;
+        }
+
+        /**
+         * Sets the totalTime.
+         * @param totalTime The totalTime to set
+         */
+        public void setTotalTime(double totalTime) {
+            this.totalTime = totalTime;
+        }
+
+        /**
+         * Returns the max in Secs
+         * @return double
+         */
+        public double getMaxSecs() {
+            return max/1000.0;
+        }
+
+        /**
+         * Returns the min in Secs
+         * @return double
+         */
+        public double getMinSecs() {
+            return min/1000.0;
+        }
+        
+        /**
+         * Returns the average time in Secs
+         * @return double
+         */
+        public double getAvgSecs() {
+            
+            double avg =  (double)getTotalTime() / (double)getCount();
+            return avg / 1000.0;
+        }        
+        
+
+}



Mime
View raw message