geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r290479 [7/16] - in /geronimo/trunk/sandbox/daytrader: ./ bin/ derby/ modules/ modules/core/ modules/core/src/ modules/core/src/conf/ modules/core/src/java/ modules/core/src/java/org/ modules/core/src/java/org/apache/ modules/core/src/java/...
Date Tue, 20 Sep 2005 16:08:17 GMT
Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/util/MDBStats.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/util/MDBStats.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/util/MDBStats.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/util/MDBStats.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,74 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.util;
+
+
+/**
+ * @author stancox
+ *
+ * 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/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/util/TimerStat.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/util/TimerStat.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/util/TimerStat.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/java/org/apache/geronimo/samples/daytrader/util/TimerStat.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,123 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.util;
+
+/**
+ * @author stancox
+ *
+ * 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;
+		}		
+		
+
+}

Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/test-cactus/example/ejb/SanityWithCactusTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/test-cactus/example/ejb/SanityWithCactusTest.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/test-cactus/example/ejb/SanityWithCactusTest.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/test-cactus/example/ejb/SanityWithCactusTest.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,31 @@
+package example.ejb;
+
+import org.apache.cactus.ServletTestCase;
+
+/**
+ * This tests the facade methods using the Cactus framework.
+ *
+ * @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
+ * @version $Id: SanityWithCactusTest.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $
+ */
+public class SanityWithCactusTest extends ServletTestCase {
+
+    public void testGetLocalHome() throws Exception {
+        ExampleFacadeUtil.getLocalHome();
+    }
+
+    public void testGetFacade() throws Exception {
+        ExampleFacadeUtil.getLocalHome().create();
+    }
+
+    public void testSetName() throws Exception {
+        ExampleFacadeLocal facade = ExampleFacadeUtil.getLocalHome().create();
+        Integer id = facade.getId("Foo");
+        assertEquals("Foo", facade.getName(id));
+        facade.setName(id,  "Bar");
+        assertEquals(id,facade.getId("Bar"));
+        assertEquals("Bar", facade.getName(id));
+        facade.setName(id,  "Foo");
+        assertEquals("Foo", facade.getName(id));
+    }
+}

Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/test/example/ejb/SanityTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/test/example/ejb/SanityTest.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/test/example/ejb/SanityTest.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/test/example/ejb/SanityTest.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,15 @@
+package example.ejb;
+
+import junit.framework.TestCase;
+
+/**
+ * This is a simple JUnit test case to ensure that the environment is okay.
+ *
+ * @author <a href="trajano@yahoo.com">Archimedes Trajano</a>
+ * @version $Id: SanityTest.java,v 1.1 2004/03/07 00:21:19 evenisse Exp $
+ */
+public class SanityTest extends TestCase {
+  public void testSanity() {
+    assertEquals( "test", "test" );
+  }
+}

Added: geronimo/trunk/sandbox/daytrader/modules/ejb/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/ejb/src/webapp/WEB-INF/web.xml?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/ejb/src/webapp/WEB-INF/web.xml (added)
+++ geronimo/trunk/sandbox/daytrader/modules/ejb/src/webapp/WEB-INF/web.xml Tue Sep 20 09:07:08 2005
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app >
+</web-app>
\ No newline at end of file

Added: geronimo/trunk/sandbox/daytrader/modules/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/project.properties?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/project.properties (added)
+++ geronimo/trunk/sandbox/daytrader/modules/project.properties Tue Sep 20 09:07:08 2005
@@ -0,0 +1,29 @@
+#    Copyright 2004 The Apache Software Foundation
+#
+#    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.
+
+##
+## $Rev: 264809 $ $Date: 2005-08-30 12:43:18 -0400 (Tue, 30 Aug 2005) $
+##
+
+# the directory containing the geronimo website in CVS
+
+geronimo.cvs.docdir = ../incubator-site/build/site/projects/geronimo
+
+#maven.test.failure.ignore=true
+maven.test.skip=true
+maven.itest.skip=true
+
+#multiproject properties
+maven.multiproject.includes=modules/*/project.xml
+maven.multiproject.excludes=

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/maven.xml?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/maven.xml (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/maven.xml Tue Sep 20 09:07:08 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="jar:install">
+  <preGoal name="java:compile">
+  </preGoal>
+</project>
+

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/project.properties?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/project.properties (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/project.properties Tue Sep 20 09:07:08 2005
@@ -0,0 +1,11 @@
+maven.xdoc.date=left
+maven.ejb.src=${maven.build.dir}/xdoclet/ejb
+maven.eclipse.classpath.include=${maven.build.dir}/xdoclet/ejbdoclet,src/test-cactus
+maven.xdoclet.ejbdoclet.utilobject.0.cacheHomes=true
+maven.xdoclet.ejbdoclet.utilobject.0.includeGUID=true
+maven.xdoclet.ejbdoclet.dataobject.0=true
+maven.xdoclet.ejbdoclet.entityfacade.0=true
+maven.xdoclet.ejbdoclet.valueobject.0=true
+maven.xdoclet.ejbdoclet.deploymentdescriptor.0.validateXML=true
+cactus.src.mergewebxml = src/conf/cactus-web.xml
+cactus.is.ear=true

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/project.xml?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/project.xml (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/project.xml Tue Sep 20 09:07:08 2005
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project>
+  <extend>../../project.xml</extend>
+  <pomVersion>3</pomVersion>
+  <id>daytrader-streamer</id>
+  <name>streamer</name>
+  <currentVersion>1.0-SNAPSHOT</currentVersion>
+  <package>org.apache.geronimo.samples.daytrader.client</package>
+  <description>Streamer Application for Day Trader</description>
+  <dependencies>
+    <dependency>
+      <id>junit</id>
+      <version>3.8.1</version>
+    </dependency>
+    
+     <dependency>
+      <groupId>daytrader</groupId>
+      <artifactId>daytrader-ejb</artifactId>
+      <version>1.0-SNAPSHOT</version>
+     <type>ejb</type>
+    </dependency>
+    
+     <dependency>
+      <groupId>geronimo-spec</groupId>
+      <artifactId>geronimo-spec-j2ee</artifactId>
+      <version>1.4-rc4</version>
+    </dependency>
+    
+     <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.3</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <sourceDirectory>src/java</sourceDirectory>
+    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+    <unitTest>
+      <includes>
+        <include>**/*Test.java</include>
+      </includes>
+      <excludes>
+        <exclude>**/NaughtyTest.java</exclude>
+      </excludes>
+    </unitTest>
+    <resources>
+      <resource>
+        <directory>src/conf</directory>
+        <includes>
+          <include>*.properties</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+</project>

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/conf/app.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/conf/app.properties?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/conf/app.properties (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/conf/app.properties Tue Sep 20 09:07:08 2005
@@ -0,0 +1,18 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 The Apache Software Foundation.
+# 
+# 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.
+# -------------------------------------------------------------------
+
+# Sample app properties.
+foo=bar

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/Main.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/Main.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/Main.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/Main.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+public class Main {
+	public static void main(String[] args) {
+		// TODO Auto-generated method stub
+	}
+
+	/* (non-Java-doc)
+	 * @see java.lang.Object#Object()
+	 */
+	public Main() {
+		super();
+	}
+
+}
\ No newline at end of file

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/AuditModel.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/AuditModel.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/AuditModel.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/AuditModel.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,60 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.math.BigDecimal;
+
+public class AuditModel {
+	// TODO: For now using composition, later move to base classes
+	public static final int PRICE = 0;
+	public static final int VOLUME = 1;
+
+	private BigDecimal aPrice;
+	private double aVolume;
+	private int type;
+
+	public AuditModel(BigDecimal aPrice) {
+		this.aPrice = aPrice;
+		type = PRICE;
+	}
+
+	public AuditModel(double aVolume) {
+		this.aVolume = aVolume;
+		type = VOLUME;
+	}
+
+	public BigDecimal getAuditPrice() {
+		return aPrice;
+	}
+
+	public void setAuditPrice(BigDecimal aPrice) {
+	 this.aPrice = aPrice;
+	}
+
+	public double getAuditVolume() {
+		return aVolume;
+	}
+
+	public void setAuditVolume(double aVolume) {
+		this.aVolume = aVolume;
+	}
+
+	public int getType() {
+		return type;
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/AuditRenderer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/AuditRenderer.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/AuditRenderer.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/AuditRenderer.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,71 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import java.text.*;
+import java.math.BigDecimal;
+
+public class AuditRenderer extends DefaultTableCellRenderer {
+	private NumberFormat nf = NumberFormat.getCurrencyInstance();
+
+	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+		super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+		if (value instanceof AuditModel) {
+			AuditModel am = (AuditModel)value;
+			// TODO: Terrible abuse of Swing and Models - fix this
+			TradeStreamerQuoteDataBean quote = TradeClient.getTradeClient().getAuditStats().getSymbol(row);
+			switch (am.getType()) {
+				case AuditModel.PRICE: {
+					BigDecimal aPrice = am.getAuditPrice();
+					setText(nf.format(aPrice));
+					if (aPrice.compareTo(quote.getPrice()) != 0) {
+						setForeground(Color.red);
+						setFont(table.getFont().deriveFont(Font.BOLD));
+					}
+					else {
+						setForeground(table.getForeground());
+						setFont(table.getFont());
+					}
+					break;
+				}
+				case AuditModel.VOLUME: {
+					double aVolume = am.getAuditVolume();
+					setText(String.valueOf(aVolume));
+					if (aVolume != quote.getVolume()) {
+						setForeground(Color.red);
+						setFont(table.getFont().deriveFont(Font.BOLD));
+					}
+					else {
+						setForeground(table.getForeground());
+						setFont(table.getFont());
+					}
+					break;
+				}
+				default: {
+					System.out.println("should not be reached");
+				}
+			}
+		}
+		return this;
+	}
+}
+
+		

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/ChangeModel.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/ChangeModel.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/ChangeModel.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/ChangeModel.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,30 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+public class ChangeModel {
+	private double change;
+
+	public ChangeModel(double change) {
+		this.change = change;
+	}
+
+	public double getChange() {
+		return change;
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/ChangeRenderer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/ChangeRenderer.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/ChangeRenderer.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/ChangeRenderer.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,44 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import java.text.*;
+
+public class ChangeRenderer extends DefaultTableCellRenderer {
+	private NumberFormat nf = NumberFormat.getCurrencyInstance();
+
+	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+		super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+		if (value instanceof ChangeModel) {
+			double change = ((ChangeModel)value).getChange();
+			setText(nf.format(change));
+			if (change >= 0.0) {
+				setForeground(Color.green);
+			}
+			else {
+				setForeground(Color.red);
+			}
+		}
+		return this;
+	}
+}
+
+		

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,149 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.util.*;
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.geronimo.samples.daytrader.ejb.*;
+
+import org.apache.geronimo.samples.daytrader.*;
+
+public class TradeClient implements Runnable {
+
+	public static final int DEFAULT_UPDATE_INTERVAL = 2;
+	public static final int DEFAULT_MAX_PER_SECOND = 10;
+
+	// Various components
+	private TradeQuoteAuditStats auditStats;
+	private TradeClientMessageListener listener;
+	private TradeClientGUI gui;
+	private int maxPerSecond = DEFAULT_MAX_PER_SECOND;
+
+	private static TradeClient tradeClient;
+
+	// EJB values
+	private InitialContext initial;
+	private Trade trade;
+	private boolean useENC = true;
+
+	// Updater thread
+	private int updateInterval = DEFAULT_UPDATE_INTERVAL;
+
+	public static void main(String[] args) {
+		try	{
+			TradeClient streamer  = new TradeClient();
+			if (args.length > 0) {
+				if (args[0].equals("-noENC")) {
+					streamer.useENC = false;
+				}
+				else {
+					System.out.println("Usage TradeClient [-noENC]");
+					System.exit(1);
+				}
+			}
+
+			tradeClient = streamer;
+			streamer.startClient();
+		}
+		catch (Exception e)	{
+			System.err.println("Caught an unexpected exception!");
+			e.printStackTrace();
+		}
+	}
+
+	public static TradeClient getTradeClient() {
+		return tradeClient;
+	}
+
+	public void startClient() throws Exception {
+		auditStats = new TradeQuoteAuditStats();
+		setupEJB();
+		listener = new TradeClientMessageListener(this, useENC);
+		listener.subscribe();
+		resetStatsFromServer();
+		gui = new TradeClientGUI(this);
+		gui.show();
+		Thread t = new Thread(this);
+		t.setDaemon(true);
+		t.start();
+	}
+
+	public TradeQuoteAuditStats getAuditStats() {
+		return auditStats;
+	}
+
+	public void reset() throws Exception {
+		resetStatsFromServer();
+	}
+
+	public void resetStatsFromServer() throws Exception {
+		auditStats.clearStats();
+		Collection quotes = trade.getAllQuotes();
+
+		for (Iterator it = quotes.iterator(); it.hasNext(); ) {
+			QuoteDataBean bean = (QuoteDataBean)it.next();
+			auditStats.updateSymbol(bean.getSymbol(), bean.getCompanyName(), bean.getPrice(), bean.getOpen(), bean.getLow(), bean.getHigh(), bean.getVolume(), System.currentTimeMillis(), bean.getPrice(), bean.getVolume());
+		}
+	}
+
+	public void updateStatusMessage(String message) {
+		gui.updateStatusMessage(message);
+	}
+
+	public InitialContext getInitialContext() {
+		return initial;
+	}
+
+	public void setupEJB() throws Exception {
+		initial = new InitialContext();
+		Object objref;
+		if (useENC) {
+			objref = initial.lookup("java:comp/env/ejb/Trade");
+		}
+		else {
+			objref = initial.lookup("ejb/TradeEJB");
+		}
+		TradeHome home = (TradeHome)PortableRemoteObject.narrow(objref, TradeHome.class);
+		trade = home.create();
+	}
+
+	public int getUpdateInterval() {
+		return updateInterval;
+	}
+
+	public void setUpdateInterval(int updateInterval) {
+		this.updateInterval = updateInterval;
+	}
+
+	public void closeClient() {
+		System.exit(1);
+	}
+
+	public void run() {
+		while(true) {
+			try {
+				Thread.sleep((long)updateInterval*1000);
+			}
+			catch (InterruptedException ie) {
+			}
+			auditStats.fireTableDataChanged();
+		}
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,130 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import org.apache.geronimo.samples.daytrader.client.table.*;
+
+public class TradeClientGUI extends JFrame implements ActionListener, WindowListener {
+	private JMenuItem resetItem;
+	private JMenuItem exitItem;
+	private JMenuItem propItem;
+	private TradeClient client;
+	private JTextField statusMsg;
+	private JLabel webLabel, ejbLabel;
+	private TradeClientGUIProperties props;
+
+	private static final String TRADELOGO_FILENAME = "/images/tradeLogoSmall.gif";
+	private static final String WEBSPHERELOGO_FILENAME = "/images/WEBSPHERE_18P_UNIX.GIF";
+
+	public TradeClientGUI(TradeClient client) {
+		this.client = client;
+		
+		JTabbedPane overallPanel = new JTabbedPane();
+
+		// Panel 1 - Streaming quotes
+		JPanel streamerPanel = new JPanel();
+		streamerPanel.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
+		JPanel topBarPanel = new JPanel();
+		topBarPanel.setLayout(new BoxLayout(topBarPanel, BoxLayout.X_AXIS));
+		JPanel topImagePanel = new JPanel();
+		topImagePanel.setLayout(new BorderLayout());
+
+		statusMsg = new JTextField("");
+
+		SortableTable auditTable = new SortableTable(client.getAuditStats());
+		auditTable.setDefaultRenderer(ChangeModel.class, new ChangeRenderer());
+		auditTable.setDefaultRenderer(AuditModel.class, new AuditRenderer());
+		auditTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+
+		JScrollPane scrollpane1 = new JScrollPane(auditTable);
+
+		ImageIcon iconTrade = new ImageIcon(this.getClass().getResource(TRADELOGO_FILENAME));
+		ImageIcon iconWS = new ImageIcon(this.getClass().getResource(WEBSPHERELOGO_FILENAME));
+
+		topImagePanel.add(new JLabel(iconTrade), BorderLayout.WEST);
+		topImagePanel.add(new JLabel(iconWS), BorderLayout.EAST);
+
+		streamerPanel.setLayout(new BorderLayout());
+		streamerPanel.add(topImagePanel, BorderLayout.NORTH);
+		streamerPanel.add(scrollpane1, BorderLayout.CENTER);
+		streamerPanel.add(statusMsg, BorderLayout.SOUTH);
+        
+		// Overall Frame
+		setTitle("Trade Client Application");
+		addWindowListener(this);
+
+		JMenuBar jmb = new JMenuBar();
+		JMenu file = new JMenu ("File");
+		exitItem = new JMenuItem("Exit");
+		resetItem = new JMenuItem("Reset");
+		propItem = new JMenuItem("Properties");
+    file.add(exitItem);
+		file.add(resetItem);
+		file.add(propItem);
+    exitItem.addActionListener(this);
+		resetItem.addActionListener(this);
+    propItem.addActionListener(this);
+		jmb.add(file);
+		setJMenuBar(jmb);
+
+		overallPanel.addTab("Streamer", streamerPanel);
+		getContentPane().add(overallPanel, java.awt.BorderLayout.CENTER);
+		setSize(800, 600);
+
+		props = new TradeClientGUIProperties(client, this);
+		props.pack();
+
+		setVisible(true);
+	}
+
+	public void updateStatusMessage(String message) {
+		statusMsg.setText(message);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		if (e.getSource() == resetItem) {
+			try {
+				client.reset();
+			}
+			catch (Exception ex)	{
+				System.err.println("Caught an unexpected exception!");
+				ex.printStackTrace();
+			}
+		}
+		if (e.getSource() == propItem) {
+			props.setVisible(true);
+		}
+		if (e.getSource() == exitItem) {
+			client.closeClient();
+		}
+	}
+
+	public void windowClosing(WindowEvent e) {
+		client.closeClient();
+	}
+
+	public void windowOpened(WindowEvent e) {}
+	public void windowClosed(WindowEvent e) {}
+	public void windowIconified(WindowEvent e) {}
+	public void windowDeiconified(WindowEvent e) {}
+	public void windowActivated(WindowEvent e) {}
+	public void windowDeactivated(WindowEvent e) {}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUIProperties.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUIProperties.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUIProperties.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUIProperties.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,89 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.awt.event.*;
+import javax.swing.*;
+
+public class TradeClientGUIProperties extends JDialog implements ActionListener, WindowListener {
+	private JTextField updateInterval, maxPerSecond;
+	private JButton okButton;
+	private TradeClient client;
+
+	public TradeClientGUIProperties(TradeClient client, TradeClientGUI gui) {
+		super(gui, true);
+		this.client = client;
+
+		JPanel buttonPanel = new JPanel();
+		okButton = new JButton("OK");
+		buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
+		buttonPanel.add(okButton);
+		okButton.addActionListener(this);
+
+		JPanel mainPanel = new JPanel();
+		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
+
+		JPanel panel = new JPanel();
+		panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+
+		JLabel label1 = new JLabel("Update Interval:");
+		updateInterval = new JTextField(String.valueOf(client.getUpdateInterval()), 3);
+		panel.add(label1);
+		panel.add(updateInterval);
+
+		mainPanel.add(panel);
+
+		mainPanel.add(buttonPanel);
+
+		getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER);
+		setDefaultCloseOperation(HIDE_ON_CLOSE);
+		addWindowListener(this);
+		setTitle("Trade Streamer Client Configuration Properties");
+	}
+
+	private void updateUpdateInterval() {
+		String udi = updateInterval.getText().trim();
+		int udii = TradeClient.DEFAULT_UPDATE_INTERVAL;
+		try {
+			udii = Integer.parseInt(udi);
+		}
+		catch (NumberFormatException nfe) {
+			updateInterval.setText(String.valueOf(udii));
+		}
+		client.setUpdateInterval(udii);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		if (e.getSource() == okButton) {
+			updateUpdateInterval();
+			setVisible(false);
+		}
+	}
+
+	public void windowClosing(WindowEvent e) {
+		updateUpdateInterval();
+	}
+
+	public void windowOpened(WindowEvent e) {}
+	public void windowClosed(WindowEvent e) {}
+	public void windowIconified(WindowEvent e) {}
+	public void windowDeiconified(WindowEvent e) {}
+	public void windowActivated(WindowEvent e) {}
+	public void windowDeactivated(WindowEvent e) {}
+
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientMessageListener.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientMessageListener.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientMessageListener.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeClientMessageListener.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,134 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+
+import javax.naming.InitialContext;
+import javax.jms.*;
+
+import org.apache.geronimo.samples.daytrader.util.*;
+
+import java.math.*;
+
+public class TradeClientMessageListener implements MessageListener {
+	private TradeClient client;
+	private boolean useENC;
+
+	public TradeClientMessageListener(TradeClient client, boolean useENC) {
+		this.client = client;
+		this.useENC = useENC;
+	}
+
+	public void subscribe() {
+		try	{
+			System.out.println("TradeStreamer getInitial Context");
+			InitialContext context = client.getInitialContext();
+			
+			Log.trace("TradeStreamer pub/sub JNDI starting");
+			ConnectionFactory connFactory;
+			if (useENC) {
+				connFactory = (ConnectionFactory) context.lookup("java:comp/env/jms/TopicConnectionFactory");
+			}
+			else {
+				connFactory = (ConnectionFactory) context.lookup("jms/TopicConnectionFactory");
+			}
+
+			Topic streamerTopic;
+			if (useENC) {
+				streamerTopic = (Topic) context.lookup("java:comp/env/jms/TradeStreamerTopic");
+			}
+			else {
+				streamerTopic = (Topic) context.lookup("jms/TradeStreamerTopic");
+			}
+
+			Log.trace("TradeStreamer pub/sub JNDI ending");
+
+			Connection conn = connFactory.createConnection();
+			Log.trace("TradeStreamer pub/sub after create Topic");
+			Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+			Log.trace("TradeStreamer pub/sub after create session");
+			MessageConsumer consumer = sess.createConsumer(streamerTopic);
+			Log.trace("TradeStreamer pub/sub after create sub");
+			conn.start();
+			Log.trace("TradeStreamer pub/sub after tconn startc");
+			consumer.setMessageListener(this);
+			Log.trace("TradeStreamer pub/sub after set message listener");
+			
+			consumer = sess.createConsumer(streamerTopic);
+			Log.trace("TradeStreamer pub/sub listener registered successfully");
+		}
+		catch (Exception e)	{
+			Log.error("TradeStreamer Subscribe Exception: " + e);
+		}
+	}
+
+	public void onMessage(Message message) {
+		TextMessage msg = null;
+		try	{
+			if (message instanceof TextMessage) {
+				msg = (TextMessage) message;
+
+				long recvTime = System.currentTimeMillis();
+				String command = message.getStringProperty("command");
+				
+				if ( (command !=null) && (command.equalsIgnoreCase("updateQuote")) ) {
+					String symbol = message.getStringProperty("symbol");
+					String company = message.getStringProperty("company");
+					BigDecimal price = new BigDecimal(message.getStringProperty("price"));				
+					BigDecimal oldPrice = new BigDecimal(message.getStringProperty("oldPrice"));							
+					BigDecimal open = new BigDecimal(message.getStringProperty("open"));
+					BigDecimal low = new BigDecimal(message.getStringProperty("low"));
+					BigDecimal high = new BigDecimal(message.getStringProperty("high"));
+					double volume = message.getDoubleProperty("volume");		
+				
+					BigDecimal changeFactor = new BigDecimal(message.getStringProperty("changeFactor"));		
+					double sharesTraded = message.getDoubleProperty("sharesTraded");				
+					long publishTime = message.getLongProperty("publishTime");
+
+					TradeQuoteAuditStats stats = client.getAuditStats();
+					BigDecimal priceDiff = price.subtract(oldPrice);
+					stats.updateSymbol(symbol, company, price, open, low, high, volume, publishTime, priceDiff, sharesTraded);
+					/*			
+								jTextArea1.append("Streamer--> " + new java.util.Date() + " Stock: " + symbol  + " ");
+								BigDecimal diff = price.subtract(oldPrice);
+								String direction = null;
+								if (diff.doubleValue() < 0.0)
+								direction = "DOWN";
+								else
+								direction = "UP";
+		        	
+								jTextArea1.append(price + " (" + diff + ") " + direction  + "\n");
+					*/
+				}
+				else {
+					System.out.println("msg = " + msg + " action = " + msg.getStringProperty("action"));
+					client.updateStatusMessage(msg.getText());
+				}
+			}
+			else {
+				System.out.println("Message of wrong type: " + message.getClass().getName());
+			}
+		}
+		catch (JMSException e) {
+			System.out.println("JMSException in onMessage(): " + e.toString());
+		}
+		catch (Throwable t) {
+			System.out.println("Exception in onMessage():" + t.getMessage());
+		}
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeQuoteAuditStats.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeQuoteAuditStats.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeQuoteAuditStats.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeQuoteAuditStats.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,238 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.text.*;
+import java.util.*;
+import java.math.BigDecimal;
+import javax.swing.table.*;
+
+public class TradeQuoteAuditStats extends AbstractTableModel {
+	public static final int SYMBOL_COL = 0;
+	public static final int COMPANY_COL = 1;
+	public static final int PRICE_COL = 2;
+	public static final int AUDIT_PRICE_COL = 3;
+	public static final int VOLUME_COL = 4;
+	public static final int AUDIT_VOLUME_COL = 5;
+	public static final int OPEN_COL = 6;
+	public static final int LOW_COL = 7;
+	public static final int HIGH_COL = 8;
+	public static final int CHANGE_COL = 9;
+	public static final int UPDATE_COL = 10;
+
+  private static String columns[] = {
+		"Symbol", "Company Name", "Price",
+		"Audit Price", "Volume", "Audit Volume",
+		"Open", "Low", "High",
+		"Change", "Last Update"};
+
+	private static Class columnClasses[] = {
+		String.class, String.class, String.class,
+		AuditModel.class, String.class, AuditModel.class,
+		String.class, String.class, String.class,
+		ChangeModel.class, String.class};
+
+  private int numColumns = columns.length;
+
+	private NumberFormat nf;
+	private DateFormat df;
+	private Map map;
+	private ArrayList sortedList;
+	private Object lock;
+	private int lastSortCol = SYMBOL_COL;
+	private boolean lastSortForward = true;
+
+	public TradeQuoteAuditStats() {
+		init();
+	}
+
+	public void init() {
+		map = new HashMap();
+		sortedList = new ArrayList();
+		nf = NumberFormat.getCurrencyInstance();
+		df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
+		lock = new Object();
+	}
+
+	public void updateSymbol(String symbol, String company, BigDecimal newPrice, BigDecimal open, BigDecimal low, BigDecimal high, double volume, long publishTime, BigDecimal priceChange, double volumeChange) {
+		boolean newSymbol = false;
+		TradeStreamerQuoteDataBean bean;
+
+		synchronized(lock) {
+			bean = getSymbol(symbol);
+			if (bean == null) { // first time bean was used
+				bean = new TradeStreamerQuoteDataBean();
+				bean.setSymbol(symbol);
+				bean.setCompanyName(company);
+				bean.setPrice(newPrice);
+				bean.setOpen(open);
+				bean.setLow(low);
+				bean.setHigh(high);
+				bean.setVolume(volume);
+				bean.setLastUpdate(new Date(publishTime));
+				bean.setAuditPrice(priceChange);
+				bean.setAuditVolume(volumeChange);
+				bean.setChange(newPrice.subtract(open).doubleValue());
+				newSymbol = true;
+			}
+			else { // update to an existing bean
+				bean.setPrice(newPrice);
+				bean.setOpen(open);
+				bean.setLow(low);
+				bean.setHigh(high);
+				bean.setVolume(volume);
+				bean.setLastUpdate(new Date(publishTime));
+				bean.setAuditPrice((bean.getAuditPrice()).add(priceChange));
+				bean.setAuditVolume(bean.getAuditVolume() + volumeChange);
+				bean.setChange(newPrice.subtract(open).doubleValue());
+			}
+
+			map.put(symbol, bean);
+
+			if (newSymbol) {
+				sort(lastSortCol, false);
+			}
+		}
+	}
+
+	public TradeStreamerQuoteDataBean getSymbol(String symbol) {
+		synchronized(lock) {
+			TradeStreamerQuoteDataBean quote = (TradeStreamerQuoteDataBean)map.get(symbol);
+			return quote;
+		}
+	}
+
+	public TradeStreamerQuoteDataBean getSymbol(int row) {
+		synchronized(lock) {
+			Iterator it = sortedList.iterator();
+			int ii = 0;
+			while (true) {
+				if (!it.hasNext()) {
+					break;
+				}
+				TradeStreamerQuoteDataBean bean = (TradeStreamerQuoteDataBean)it.next();
+				if (ii == row) {
+					return bean;
+				}
+				ii++;
+			}
+			return null;
+		}
+	}
+
+	public void clearStats() {
+		synchronized(lock) {
+			init();
+		}
+	}
+
+  public int getColumnCount() {
+    return numColumns;
+  }
+
+  public int getRowCount() {
+		synchronized(lock) {
+			return map.size();
+		}
+  }
+
+  public Object getValueAt (int row, int column) {
+		synchronized(lock) {
+			Iterator it = sortedList.iterator();
+			int ii = 0;
+			while (true) {
+				if (!it.hasNext()) {
+					break;
+				}
+				TradeStreamerQuoteDataBean bean = (TradeStreamerQuoteDataBean)it.next();
+				double price;
+				if (ii == row) {
+					switch (column) {
+						case SYMBOL_COL:
+							return bean.getSymbol();
+						case COMPANY_COL:
+							return bean.getCompanyName();
+						case PRICE_COL:
+							price = bean.getPrice().doubleValue();
+							return nf.format(price);
+						case AUDIT_PRICE_COL:
+							return bean.getAuditPriceModel();
+						case VOLUME_COL:
+							return String.valueOf(bean.getVolume());
+						case AUDIT_VOLUME_COL:
+							return bean.getAuditVolumeModel();
+						case OPEN_COL:
+							price = bean.getOpen().doubleValue();
+							return nf.format(price);
+						case LOW_COL:
+							price = bean.getLow().doubleValue();
+							return nf.format(price);
+						case HIGH_COL:
+							price = bean.getHigh().doubleValue();
+							return nf.format(price);
+						case CHANGE_COL:
+							return bean.getChangeModel();
+						case UPDATE_COL:
+							Date update = bean.getLastUpdate();
+							return df.format(update);
+						default:
+							break;
+					}
+				}
+				ii++;
+			}
+			return null;
+		}
+  }
+
+  public void setValueAt (Object aValue, int row, int column) {
+		// not editable
+	}
+
+  public String getColumnName(int columnIndex) {
+    return columns[columnIndex];
+  }
+
+  public Class getColumnClass(int columnIndex) {
+    return columnClasses[columnIndex];
+  }
+
+  public boolean isCellEditable(int row, int column) {
+		return false;
+  }
+
+	public void sort(int column, boolean fromUserGUI) {
+		synchronized(lock) {
+			Collection values = map.values();
+			sortedList.clear();
+			sortedList.addAll(values);
+			// TODO: be more carefull with obect allocation - make static comps?
+			Comparator comp = new TradeQuoteAuditStatsComparator(column);
+			Collections.sort(sortedList, comp);
+			if (fromUserGUI) {
+				if (column == lastSortCol) {
+					if (lastSortForward) { // if we already sorted forward, reverse
+						Collections.reverse(sortedList);
+					}
+					lastSortForward = !lastSortForward; // switch the last sort
+				}
+			}
+			lastSortCol = column;
+		}
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeQuoteAuditStatsComparator.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeQuoteAuditStatsComparator.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeQuoteAuditStatsComparator.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeQuoteAuditStatsComparator.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,72 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.util.*;
+
+public class TradeQuoteAuditStatsComparator implements Comparator {
+	private int index;
+
+	public TradeQuoteAuditStatsComparator(int index) {
+		this.index = index;
+	}
+
+	public int compare(Object o1, Object o2) {
+		TradeStreamerQuoteDataBean bean1 = (TradeStreamerQuoteDataBean)o1;
+		TradeStreamerQuoteDataBean bean2 = (TradeStreamerQuoteDataBean)o2;
+
+		switch (index) {
+			case TradeQuoteAuditStats.SYMBOL_COL: {
+				return bean1.getSymbol().compareTo(bean2.getSymbol());
+			}
+			case TradeQuoteAuditStats.COMPANY_COL: {
+				return bean1.getCompanyName().compareTo(bean2.getCompanyName());
+			}
+			case TradeQuoteAuditStats.PRICE_COL: {
+				return bean1.getPrice().compareTo(bean2.getPrice());
+			}
+			case TradeQuoteAuditStats.AUDIT_PRICE_COL: {
+				return bean1.getAuditPrice().compareTo(bean2.getAuditPrice());
+			}
+			case TradeQuoteAuditStats.VOLUME_COL: {
+				return (int)(bean1.getVolume() - bean2.getVolume());
+			}
+			case TradeQuoteAuditStats.AUDIT_VOLUME_COL: {
+				return (int)(bean1.getAuditVolume() - bean2.getAuditVolume());
+			}
+			case TradeQuoteAuditStats.OPEN_COL: {
+				return bean1.getOpen().compareTo(bean2.getOpen());
+			}
+			case TradeQuoteAuditStats.LOW_COL: {
+				return bean1.getLow().compareTo(bean2.getLow());
+			}
+			case TradeQuoteAuditStats.HIGH_COL: {
+				return bean1.getHigh().compareTo(bean2.getHigh());
+			}
+			case TradeQuoteAuditStats.CHANGE_COL: {
+				return (int)(bean1.getChange() - bean2.getChange());
+			}
+			case TradeQuoteAuditStats.UPDATE_COL: {
+				return bean1.getLastUpdate().compareTo(bean2.getLastUpdate());
+			}
+			default: {
+				throw new IllegalArgumentException();
+			}
+		}
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeStreamerQuoteDataBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeStreamerQuoteDataBean.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeStreamerQuoteDataBean.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/TradeStreamerQuoteDataBean.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,150 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client;
+
+import java.util.Date;
+import java.math.BigDecimal;
+import org.apache.geronimo.samples.daytrader.*;
+
+public class TradeStreamerQuoteDataBean extends QuoteDataBean {
+
+	private BigDecimal auditPrice;
+	private double auditVolume;
+	private Date lastUpdate;
+	private ChangeModel changeModel;
+	private AuditModel auditPriceModel;
+	private AuditModel auditVolumeModel;
+
+	/**
+	 * Gets the price
+	 * @return Returns a BigDecimal
+	 */
+	public BigDecimal getAuditPrice() {
+		return auditPrice;
+	}
+
+	/**
+	 * Sets the price
+	 * @param price The price to set
+	 */
+	public void setAuditPrice(BigDecimal auditPrice) {
+		this.auditPrice = auditPrice;
+		setAuditPriceModel(auditPrice);
+	}
+
+	/**
+	 * Gets the volume
+	 * @return Returns a BigDecimal
+	 */
+	public double getAuditVolume() {
+		return auditVolume;
+	}
+
+	/**
+	 * Sets the volume
+	 * @param volume The volume to set
+	 */
+	public void setAuditVolume(double auditVolume) {
+		this.auditVolume = auditVolume;
+		setAuditVolumeModel(auditVolume);
+	}
+
+	/**
+	 * Gets the last update date of the quote
+	 * @return Returns the last update date
+	 */
+	public Date getLastUpdate() {
+		return lastUpdate;
+	}
+
+	/**
+	 * Sets the change since open
+	 * Overridden to provide model class for JTable to render
+	 */
+	public void setChange(double change) {
+		changeModel = new ChangeModel(change);
+		super.setChange(change);
+	}
+
+	/**
+	 * Gets the change model since open
+	 * @return the change model
+	 */
+	public ChangeModel getChangeModel() {
+		return changeModel;
+	}
+
+	/**
+	 * Gets the audit price model
+	 * @return the audit price model
+	 */
+	public AuditModel getAuditPriceModel() {
+		return auditPriceModel;
+	}
+
+	/**
+	 * Sets the audit price model
+	 * @param price the audit price
+	 */
+	public void setAuditPriceModel(BigDecimal aPrice) {
+		if (auditPriceModel != null) {
+			auditPriceModel.setAuditPrice(aPrice);
+		}
+		else {
+			auditPriceModel = new AuditModel(aPrice);
+		}
+	}
+
+	/**
+	 * Gets the audit volume model
+	 * @return the audit volume model
+	 */
+	public AuditModel getAuditVolumeModel() {
+		return auditVolumeModel;
+	}
+
+	/**
+	 * Sets the audit volume model
+	 * @param volume the audit volume
+	 */
+	public void setAuditVolumeModel(double aVolume) {
+		if (auditVolumeModel != null) {
+			auditVolumeModel.setAuditVolume(aVolume);
+		}
+		else {
+			auditVolumeModel = new AuditModel(aVolume);
+		}
+	}
+
+	/**
+	 * Sets the last update date of the quote
+	 * @param lastUpdate the last update date of the quote
+	 */
+	public void setLastUpdate(Date lastUpdate) {
+		this.lastUpdate = lastUpdate;
+	}
+
+	public String toString() {
+		return "\n\tAudit Quote Data for: " + getSymbol() +
+			//"\n\t\t   statsOrder: " + getStatsOrder() +
+			"\n\t\t       volume: " + getVolume() +
+			"\n\t\t        price: " + getPrice() +
+			"\n\t\t audit volume: " + getAuditVolume() +
+			"\n\t\t  audit price: " + getAuditPrice();
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/table/SortableTable.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/table/SortableTable.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/table/SortableTable.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/java/org/apache/geronimo/samples/daytrader/client/table/SortableTable.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,47 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.client.table;
+
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.table.*;
+import org.apache.geronimo.samples.daytrader.client.*;
+
+public class SortableTable extends JTable {
+	public SortableTable(TableModel tm) {
+		super(tm);
+		addMouseListenerToTableHeader();
+	}
+
+	public void addMouseListenerToTableHeader() {
+		setColumnSelectionAllowed(false);                
+		JTableHeader th = getTableHeader(); 
+		th.addMouseListener(new listMouseListener ()); 
+	}
+
+	class listMouseListener extends MouseAdapter {
+		public void mouseClicked(MouseEvent e) {
+			TableColumnModel columnModel = getColumnModel();
+			int viewColumn = columnModel.getColumnIndexAtX (e.getX()); 
+			int columnIndex = convertColumnIndexToModel(viewColumn); 
+			if (e.getClickCount() == 1 && columnIndex != -1) {                
+				((TradeQuoteAuditStats)getModel ()).sort(columnIndex, true);
+			}
+		}
+	}
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/AbstractTestCase.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/AbstractTestCase.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/AbstractTestCase.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,40 @@
+package org.apache.geronimo.samples.daytrader;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Abstract base class for test cases.
+ *
+ * @author <a href="jason@zenplex.com">Jason van Zyl</a>
+ */
+public abstract class AbstractTestCase
+    extends TestCase 
+{
+    /** 
+     * Basedir for all file I/O. Important when running tests from
+     * the reactor.
+     */
+    public String basedir = System.getProperty("basedir");
+    
+    /**
+     * Constructor.
+     */
+    public AbstractTestCase(String testName)
+    {
+        super(testName);
+    }
+    
+    /**
+     * Get test input file.
+     *
+     * @param path Path to test input file.
+     */
+    public String getTestFile(String path)
+    {
+        return new File(basedir,path).getAbsolutePath();
+    }
+}
+

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/AppTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/AppTest.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/AppTest.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/AppTest.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,40 @@
+package org.apache.geronimo.samples.daytrader;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ *
+ * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
+ */
+public class AppTest 
+    extends AbstractTestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertEquals( "maven kicks ass", "maven kicks ass" );
+    }
+}

Added: geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/NaughtyTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/NaughtyTest.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/NaughtyTest.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/streamer/src/test/org/apache/geronimo/samples/daytrader/NaughtyTest.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,40 @@
+package org.apache.geronimo.samples.daytrader;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ *
+ * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
+ */
+public class NaughtyTest
+    extends AbstractTestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public NaughtyTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( NaughtyTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        // Crash and burn!
+    }
+}

Added: geronimo/trunk/sandbox/daytrader/modules/web/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/web/maven.xml?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/web/maven.xml (added)
+++ geronimo/trunk/sandbox/daytrader/modules/web/maven.xml Tue Sep 20 09:07:08 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" default="war:install">
+  <preGoal name="java:compile">
+  </preGoal>
+</project>
+

Added: geronimo/trunk/sandbox/daytrader/modules/web/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/web/project.properties?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/web/project.properties (added)
+++ geronimo/trunk/sandbox/daytrader/modules/web/project.properties Tue Sep 20 09:07:08 2005
@@ -0,0 +1,10 @@
+maven.xdoc.date=left
+maven.eclipse.classpath.include=src/test-cactus
+maven.war.webapp.dir=${maven.build.dir}/xdoclet/webdoclet
+maven.xdoclet.webdoclet.0=true
+maven.xdoclet.webdoclet.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
+maven.xdoclet.webdoclet.0.mergeDir=src/merge
+maven.xdoclet.webdoclet.deploymentdescriptor.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF
+maven.xdoclet.webdoclet.deploymentdescriptor.0.mergeDir=src/merge
+maven.xdoclet.webdoclet.jsptaglib.0.destDir=${maven.build.dir}/xdoclet/webdoclet/WEB-INF/tld
+cactus.src.mergewebxml = src/conf/cactus-web.xml

Added: geronimo/trunk/sandbox/daytrader/modules/web/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/web/project.xml?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/web/project.xml (added)
+++ geronimo/trunk/sandbox/daytrader/modules/web/project.xml Tue Sep 20 09:07:08 2005
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project>
+  <extend>../../project.xml</extend>
+  <pomVersion>3</pomVersion>
+  <id>daytrader-web</id>
+  <name>Web Application</name>
+  <currentVersion>1.0-SNAPSHOT</currentVersion>
+  <package>org.apache.geronimo.samples.daytrader.web</package>
+  <description>This is the web application.</description>
+  <dependencies>
+    <dependency>
+      <groupId>daytrader</groupId>
+      <artifactId>daytrader-ejb</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <type>ejb</type>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+
+    <dependency>
+      <id>junit</id>
+      <version>3.8.1</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>geronimo-spec</groupId>
+      <artifactId>geronimo-spec-j2ee</artifactId>
+      <version>1.4-rc4</version>
+    </dependency>
+
+     <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.3</version>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <sourceDirectory>src/java</sourceDirectory>
+    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+    <unitTest>
+      <includes>
+        <include>**/*Test.java</include>
+      </includes>
+      <excludes>
+        <exclude>**/NaughtyTest.java</exclude>
+      </excludes>
+    </unitTest>
+    <resources>
+      <resource>
+        <directory>src/conf</directory>
+        <includes>
+          <include>*.properties</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+</project>

Added: geronimo/trunk/sandbox/daytrader/modules/web/src/conf/app.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/web/src/conf/app.properties?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/web/src/conf/app.properties (added)
+++ geronimo/trunk/sandbox/daytrader/modules/web/src/conf/app.properties Tue Sep 20 09:07:08 2005
@@ -0,0 +1,2 @@
+# Sample app properties.
+foo=bar

Added: geronimo/trunk/sandbox/daytrader/modules/web/src/conf/cactus-web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/web/src/conf/cactus-web.xml?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/web/src/conf/cactus-web.xml (added)
+++ geronimo/trunk/sandbox/daytrader/modules/web/src/conf/cactus-web.xml Tue Sep 20 09:07:08 2005
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+</web-app>

Added: geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/OrdersAlertFilter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/OrdersAlertFilter.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/OrdersAlertFilter.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/OrdersAlertFilter.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,104 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.web;
+
+import java.io.IOException;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import org.apache.geronimo.samples.daytrader.soap.*;
+import org.apache.geronimo.samples.daytrader.util.*;
+
+import org.apache.geronimo.samples.daytrader.*;
+
+public class OrdersAlertFilter implements Filter {
+
+	/**
+	 * Constructor for CompletedOrdersAlertFilter
+	 */
+	public OrdersAlertFilter() {
+		super();
+	}
+
+	/**
+	 * @see Filter#init(FilterConfig)
+	 */
+	private FilterConfig filterConfig = null;
+	public void init(FilterConfig filterConfig) throws ServletException {
+	      this.filterConfig = filterConfig;
+	}
+
+	/**
+	 * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
+	 */
+	public void doFilter(
+		ServletRequest req,
+		ServletResponse resp,
+		FilterChain chain)
+		throws IOException, ServletException {
+		if (filterConfig == null)
+			return;
+		
+		try
+		{
+			String action = req.getParameter("action");
+			if ( action != null ) 
+			{
+				action = action.trim();
+				if ( (action.length() > 0) && (!action.equals("logout")) )
+				{
+					String userID;
+					if ( action.equals("login") )
+						userID = req.getParameter("uid");
+					else
+						userID = (String) ((HttpServletRequest) req).getSession().getAttribute("uidBean");
+					if ( (userID != null) && (userID.trim().length()>0) )
+					{	
+						TradeServices tAction=null;
+						if(TradeConfig.getAccessMode() == TradeConfig.STANDARD)
+							tAction = new TradeAction();
+						else if(TradeConfig.getAccessMode() == TradeConfig.WEBSERVICES)
+							tAction = new TradeWebSoapProxy();										
+						java.util.Collection closedOrders = tAction.getClosedOrders(userID);
+						if ( (closedOrders!=null) && (closedOrders.size() > 0) )
+							req.setAttribute("closedOrders", closedOrders);
+						if (Log.doTrace()) Log.printCollection("OrderAlertFilter: userID="+userID+" closedOrders=", closedOrders);
+					}
+				}	
+			}
+		}
+		catch (Exception e)
+		{
+			Log.error(e, "OrdersAlertFilter - Error checking for closedOrders");
+		}
+
+        ServletContext sc = filterConfig.getServletContext();
+        //String xyz = (String) sc.getAttribute("hitCounter");
+		chain.doFilter(req, resp/*wrapper*/);        
+
+	}
+
+	/**
+	 * @see Filter#destroy()
+	 */
+	public void destroy() {
+		this.filterConfig = null;	
+	}
+
+}
+

Added: geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/TestServlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/TestServlet.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/TestServlet.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/TestServlet.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,107 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.web;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import org.apache.geronimo.samples.daytrader.util.*;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import org.apache.geronimo.samples.daytrader.*;
+
+public class TestServlet extends HttpServlet {
+
+
+	public void init(ServletConfig config) throws ServletException
+	{
+		super.init(config);
+	}
+	
+	
+   /**
+	* Process incoming HTTP GET requests
+	*
+	* @param request Object that encapsulates the request to the servlet
+	* @param response Object that encapsulates the response from the servlet
+	*/
+	public void doGet(HttpServletRequest request, HttpServletResponse response)
+		throws ServletException, IOException
+	{
+		performTask(request,response);
+	}
+
+   /**
+	* Process incoming HTTP POST requests
+	*
+	* @param request Object that encapsulates the request to the servlet
+	* @param response Object that encapsulates the response from the servlet
+	*/
+	public void doPost(HttpServletRequest request, HttpServletResponse response)
+		throws ServletException, IOException
+	{
+		performTask(request,response);
+	}	
+
+   /**
+	* Main service method for TradeAppServlet
+	*
+	* @param request Object that encapsulates the request to the servlet
+	* @param response Object that encapsulates the response from the servlet
+	*/    	
+	public void performTask(HttpServletRequest req, HttpServletResponse resp)
+		throws ServletException, IOException 
+	{
+		try {
+			Log.debug("Enter TestServlet doGet");
+			TradeConfig.runTimeMode = TradeConfig.DIRECT;
+			for (int i=0; i<10; i++) 
+			{
+				new TradeAction().createQuote("s:"+i, "Company " + i, new BigDecimal(i*1.1));
+			}
+			/*
+			
+			AccountDataBean accountData = new TradeAction().register("user1", "password", "fullname", "address", 
+											"email", "creditCard", new BigDecimal(123.45), false);
+
+			OrderDataBean orderData = new TradeAction().buy("user1", "s:1", 100.0);
+			orderData = new TradeAction().buy("user1", "s:2", 200.0);
+			Thread.sleep(5000);
+			accountData = new TradeAction().getAccountData("user1");
+			Collection holdingDataBeans = new TradeAction().getHoldings("user1");
+			PrintWriter out = resp.getWriter();
+			resp.setContentType("text/html");
+			out.write("<HEAD></HEAD><BODY><BR><BR>");
+			out.write(accountData.toString());
+			Log.printCollection("user1 Holdings", holdingDataBeans);
+			ServletContext sc  = getServletContext();
+			req.setAttribute("results", "Success");
+			req.setAttribute("accountData", accountData);
+			req.setAttribute("holdingDataBeans", holdingDataBeans);
+			getServletContext().getRequestDispatcher("/tradehome.jsp").include(req, resp);
+			out.write("<BR><BR>done.</BODY>");
+			*/
+		}
+		catch (Exception e)
+		{
+			Log.error("TestServletException", e);
+		}
+	}
+}
+

Added: geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java?rev=290479&view=auto
==============================================================================
--- geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java (added)
+++ geronimo/trunk/sandbox/daytrader/modules/web/src/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java Tue Sep 20 09:07:08 2005
@@ -0,0 +1,239 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable 
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.web;
+
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import org.apache.geronimo.samples.daytrader.direct.*;
+import org.apache.geronimo.samples.daytrader.util.*;
+
+import java.io.IOException;
+import org.apache.geronimo.samples.daytrader.*;
+
+/**
+ *
+ * TradeAppServlet provides the standard web interface to Trade and can be accessed with the Go Trade! link. 
+ * Driving benchmark load using this interface requires a sophisticated web load generator that is capable of 
+ * filling HTML forms and posting dynamic data.
+ */
+
+public class TradeAppServlet extends HttpServlet {
+
+   /**
+	* Servlet initialization method.
+	*/	
+	public void init(ServletConfig config) throws ServletException
+	{
+		super.init(config);
+		java.util.Enumeration en = config.getInitParameterNames();
+		while ( en.hasMoreElements() )
+		{
+			String parm = (String) en.nextElement();
+			String value = config.getInitParameter(parm);
+			TradeConfig.setConfigParam(parm, value);
+		}
+		try
+		{
+			TradeDirect.init();		
+		}
+		catch (Exception e)
+		{
+			Log.error(e, "TradeAppServlet:init -- Error initializing TradeDirect");
+		}
+	}
+	
+	
+   /**
+	* Returns a string that contains information about TradeScenarioServlet
+	*
+	* @return The servlet information
+	*/
+	public java.lang.String getServletInfo()
+	{
+		return "TradeAppServlet provides the standard web interface to Trade";
+	}	
+
+
+   /**
+	* Process incoming HTTP GET requests
+	*
+	* @param request Object that encapsulates the request to the servlet
+	* @param response Object that encapsulates the response from the servlet
+	*/
+	public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
+		throws ServletException, IOException
+	{
+		performTask(request,response);
+	}
+
+   /**
+	* Process incoming HTTP POST requests
+	*
+	* @param request Object that encapsulates the request to the servlet
+	* @param response Object that encapsulates the response from the servlet
+	*/
+	public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
+		throws ServletException, IOException
+	{
+		performTask(request,response);
+	}	
+
+   /**
+	* Main service method for TradeAppServlet
+	*
+	* @param request Object that encapsulates the request to the servlet
+	* @param response Object that encapsulates the response from the servlet
+	*/    	
+	public void performTask(HttpServletRequest req, HttpServletResponse resp)
+		throws ServletException, IOException {
+
+		String action = null;
+		String userID = null;
+		// String to create full dispatch path to TradeAppServlet w/ request Parameters
+		String dispPath = null; // Dispatch Path to TradeAppServlet
+
+
+		resp.setContentType("text/html");
+		TradeServletAction tsAction = new TradeServletAction();
+
+
+		//Dyna - need status string - prepended to output
+			action = req.getParameter("action");
+
+
+			ServletContext ctx = getServletConfig().getServletContext();
+
+			if (action == null)
+			{
+				tsAction.doWelcome(ctx, req, resp, "");
+				return;
+			}
+			else if (action.equals("login"))
+			{
+				userID = req.getParameter("uid");
+				String passwd = req.getParameter("passwd");
+				String inScenario = req.getParameter("inScenario");
+				tsAction.doLogin(ctx, req, resp, userID, passwd);
+				return;
+			}
+			else if (action.equals("register"))
+			{
+				userID = req.getParameter("user id");
+				String passwd = req.getParameter("passwd");
+				String cpasswd = req.getParameter("confirm passwd");
+				String fullname = req.getParameter("Full Name");
+				String ccn = req.getParameter("Credit Card Number");
+				String money = req.getParameter("money");
+				String email = req.getParameter("email");
+				String smail = req.getParameter("snail mail");
+				tsAction.doRegister(
+					ctx, 
+					req, 
+					resp, 
+					userID, 
+					passwd, 
+					cpasswd, 
+					fullname, 
+					ccn, 
+					money, 
+					email, 
+					smail); 
+				return;
+			}
+
+			// The rest of the operations require the user to be logged in -
+			//Get the Session and validate the user.
+			HttpSession session = req.getSession();
+			userID = (String) session.getAttribute("uidBean");
+
+			if (userID == null)
+			{
+				System.out.println("TradeAppServlet service error: User Not Logged in");
+				tsAction.doWelcome(ctx, req, resp, "User Not Logged in");
+				return;
+			}
+			if ( action.equals("quotes"))
+			{
+				String symbols = req.getParameter("symbols");
+				tsAction.doQuotes(ctx, req, resp, userID, symbols);
+			}
+			else if (action.equals("buy"))
+			{
+				String symbol = req.getParameter("symbol");
+				String quantity = req.getParameter("quantity");
+				tsAction.doBuy(ctx, req, resp, userID, symbol, quantity);
+			}
+			else if (action.equals("sell"))
+			{
+				int holdingID = Integer.parseInt(req.getParameter("holdingID"));
+				tsAction.doSell(ctx, req, resp, userID, new Integer(holdingID));
+			}
+			else if (action.equals("portfolio") || action.equals("portfolioNoEdge"))
+			{
+				tsAction.doPortfolio(ctx, req, resp, userID, "Portfolio as of " + new java.util.Date());
+			}
+			else if (action.equals("logout"))
+			{
+				tsAction.doLogout(ctx, req, resp, userID);
+			}
+			else if (action.equals("home"))
+			{
+				tsAction.doHome(ctx, req, resp, userID, "Ready to Trade");
+			}
+			else if (action.equals("account"))
+			{
+				tsAction.doAccount(ctx, req, resp, userID, "");
+			}
+			else if (action.equals("update_profile"))
+			{
+				String   password = req.getParameter("password");				
+				String  cpassword = req.getParameter("cpassword");								
+				String   fullName = req.getParameter("fullname");
+				String    address = req.getParameter("address");
+				String creditcard = req.getParameter("creditcard");
+				String      email = req.getParameter("email");
+				tsAction.doAccountUpdate(
+					ctx, 
+					req, 
+					resp, 
+					userID, 
+					password   == null? "":password.trim(),
+					cpassword  == null? "":cpassword.trim(),
+					fullName   == null? "":fullName.trim(), 
+					address    == null? "":address.trim(), 
+					creditcard == null? "":creditcard.trim(), 
+					email      == null? "":email.trim()); 
+			}
+			else
+			{
+				System.out.println("TradeAppServlet: Invalid Action=" + action);
+				tsAction.doWelcome(ctx, req, resp, "TradeAppServlet: Invalid Action" + action);
+			}
+	}
+
+		
+	private void sendRedirect(HttpServletResponse resp, String page)
+		throws ServletException, IOException {
+		resp.sendRedirect(resp.encodeRedirectURL(page));
+	}
+
+	// URL Path Prefix for dispatching to TradeAppServlet
+	private final static String tasPathPrefix = "/app?action=";
+			
+}
\ No newline at end of file



Mime
View raw message