geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hogst...@apache.org
Subject svn commit: r497559 - in /geronimo/daytrader/branches/1.2/modules: ejb/src/main/java/org/apache/geronimo/samples/daytrader/ ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/ ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/ ejb...
Date Thu, 18 Jan 2007 20:14:59 GMT
Author: hogstrom
Date: Thu Jan 18 12:14:58 2007
New Revision: 497559

URL: http://svn.apache.org/viewvc?view=rev&rev=497559
Log:
DAYTRADER-22 Added new code to expose the property for publishing quote information in the
configuration page

Modified:
    geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
    geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
    geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
    geronimo/daytrader/branches/1.2/modules/ejb/src/main/resources/META-INF/ejb-jar.xml
    geronimo/daytrader/branches/1.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeConfigServlet.java
    geronimo/daytrader/branches/1.2/modules/web/src/main/webapp/config.jsp

Modified: geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java?view=diff&rev=497559&r1=497558&r2=497559
==============================================================================
--- geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
(original)
+++ geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
Thu Jan 18 12:14:58 2007
@@ -109,6 +109,7 @@
 	private static boolean updateQuotePrices = true;
 	private static int primIterations = 1;
 	private static boolean longRun = true;
+	private static boolean publishQuotePriceChange = false;
 
 	/*
 	 * Penny stocks is a problem where the random price change factor gets a stock
@@ -834,4 +835,14 @@
     public static void setLongRun(boolean longRun) {
         TradeConfig.longRun = longRun;
     }
+
+    public static void setPublishQuotePriceChange(boolean publishQuotePriceChange) {
+        TradeConfig.publishQuotePriceChange = publishQuotePriceChange;
+    }
+    
+    public static boolean getPublishQuotePriceChange() {
+        return publishQuotePriceChange;
+    }
+
+
 }

Modified: geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java?view=diff&rev=497559&r1=497558&r2=497559
==============================================================================
--- geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
(original)
+++ geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
Thu Jan 18 12:14:58 2007
@@ -1427,7 +1427,7 @@
 	}
 
 	public QuoteDataBean updateQuotePriceVolume(String symbol, BigDecimal changeFactor, double
sharesTraded) throws Exception {
-		return updateQuotePriceVolumeInt(symbol, changeFactor, sharesTraded, publishQuotePriceChange);
+		return updateQuotePriceVolumeInt(symbol, changeFactor, sharesTraded, TradeConfig.getPublishQuotePriceChange());
 	}
 
 	/**
@@ -2359,7 +2359,7 @@
         catch (Exception e)
         {
             Log.error("TradeDirect:init  Unable to locate QueueConnectionFactory.\n\t --
Asynchronous mode will not work correctly and Quote Price change publishing will be disabled");
-            publishQuotePriceChange = false;            
+            TradeConfig.setPublishQuotePriceChange(false);
         }       
         
         try
@@ -2369,7 +2369,7 @@
         catch (Exception e)
         {
             Log.error("TradeDirect:init  Unable to locate TradeBrokerQueue.\n\t -- Asynchronous
mode will not work correctly and Quote Price change publishing will be disabled");
-            publishQuotePriceChange = false;            
+            TradeConfig.setPublishQuotePriceChange(false);
         }       
         
         try
@@ -2379,7 +2379,7 @@
         catch (Exception e)
         {
             Log.error("TradeDirect:init  Unable to locate TopicConnectionFactory.\n\t --
Asynchronous mode will not work correctly and Quote Price change publishing will be disabled");
-            publishQuotePriceChange = false;            
+            TradeConfig.setPublishQuotePriceChange(false);
         }
         
         try
@@ -2389,7 +2389,7 @@
         catch (Exception e)
         {
             Log.error("TradeDirect:init  Unable to locate TradeStreamerTopic.\n\t -- Asynchronous
mode will not work correctly and Quote Price change publishing will be disabled");
-            publishQuotePriceChange = false;            
+            TradeConfig.setPublishQuotePriceChange(false);
         }       
         
         
@@ -2426,7 +2426,6 @@
 	private static ConnectionFactory tConnFactory;
 	private static Topic streamerTopic;
 	private static Trade tradeEJB;
-	private static boolean publishQuotePriceChange = true;
 	/**
 	 * Gets the inGlobalTxn
 	 * @return Returns a boolean

Modified: geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java?view=diff&rev=497559&r1=497558&r2=497559
==============================================================================
--- geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
(original)
+++ geronimo/daytrader/branches/1.2/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb/TradeBean.java
Thu Jan 18 12:14:58 2007
@@ -48,7 +48,6 @@
 	//Boolean to signify if the Order By clause is supported by the app server.
 	// This can be set to false by an env. variable
 	private boolean orderBySQLSupported = true;  
-	private boolean publishQuotePriceChange = true;  
 	private boolean updateQuotePrices = true;  
    
     private void queueOrderInternal(Integer orderID, boolean twoPhase)
@@ -312,7 +311,7 @@
 	public void publishQuotePriceChange(QuoteDataBean quoteData, BigDecimal oldPrice, BigDecimal
changeFactor, double sharesTraded)
 	throws RemoteException
 	{
-		if ( publishQuotePriceChange == false)
+		if ( TradeConfig.getPublishQuotePriceChange() == false)
 			return;
 		if (Log.doTrace())
 			Log.trace("TradeBean:publishQuotePricePublishing -- quoteData = " + quoteData);		
@@ -1156,7 +1155,6 @@
 			keySequenceHome = (LocalKeySequenceHome) ic.lookup("java:comp/env/ejb/KeySequence");	
	
 
 			orderBySQLSupported = ( (Boolean) ic.lookup("java:comp/env/orderBySQLSupported") ).booleanValue();
-			publishQuotePriceChange  = ( (Boolean) ic.lookup("java:comp/env/publishQuotePriceChange")
).booleanValue();
 			updateQuotePrices  = ( (Boolean) ic.lookup("java:comp/env/updateQuotePrices") ).booleanValue();
 			TradeConfig.setUpdateQuotePrices(updateQuotePrices);
 
@@ -1174,7 +1172,7 @@
 					warnJMSFailure = false;
 					Log.error("TradeBean:ejbCreate  Unable to lookup JMS Resources\n\t -- Asynchronous mode
will not work correctly and Quote Price change publishing will be disabled", e);
 				}				
-				publishQuotePriceChange = false;			
+				TradeConfig.setPublishQuotePriceChange(false);
 			}		
 			
 		} catch (Exception e) {

Modified: geronimo/daytrader/branches/1.2/modules/ejb/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/daytrader/branches/1.2/modules/ejb/src/main/resources/META-INF/ejb-jar.xml?view=diff&rev=497559&r1=497558&r2=497559
==============================================================================
--- geronimo/daytrader/branches/1.2/modules/ejb/src/main/resources/META-INF/ejb-jar.xml (original)
+++ geronimo/daytrader/branches/1.2/modules/ejb/src/main/resources/META-INF/ejb-jar.xml Thu
Jan 18 12:14:58 2007
@@ -42,7 +42,7 @@
             <env-entry>
                 <env-entry-name>publishQuotePriceChange</env-entry-name>
                 <env-entry-type>java.lang.Boolean</env-entry-type>
-                <env-entry-value>false</env-entry-value>
+                <env-entry-value>true</env-entry-value>
             </env-entry>
             <ejb-ref>
                 <ejb-ref-name>ejb/Trade</ejb-ref-name>

Modified: geronimo/daytrader/branches/1.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeConfigServlet.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/branches/1.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeConfigServlet.java?view=diff&rev=497559&r1=497558&r2=497559
==============================================================================
--- geronimo/daytrader/branches/1.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeConfigServlet.java
(original)
+++ geronimo/daytrader/branches/1.2/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeConfigServlet.java
Thu Jan 18 12:14:58 2007
@@ -306,6 +306,13 @@
 			}
 		}
 
+		String enablePublishQuotePriceChange = req.getParameter("EnablePublishQuotePriceChange");
+		if (enablePublishQuotePriceChange != null)
+			TradeConfig.setPublishQuotePriceChange(true);
+		else 
+			TradeConfig.setPublishQuotePriceChange(false);
+		currentConfigStr += "\t\tTradeStreamer MDB Enabled:\t" + TradeConfig.getPublishQuotePriceChange()
+ "\n";
+		
 		String enableTrace = req.getParameter("EnableTrace");
 		if (enableTrace != null)
 			Log.setTrace(true);

Modified: geronimo/daytrader/branches/1.2/modules/web/src/main/webapp/config.jsp
URL: http://svn.apache.org/viewvc/geronimo/daytrader/branches/1.2/modules/web/src/main/webapp/config.jsp?view=diff&rev=497559&r1=497558&r2=497559
==============================================================================
--- geronimo/daytrader/branches/1.2/modules/web/src/main/webapp/config.jsp (original)
+++ geronimo/daytrader/branches/1.2/modules/web/src/main/webapp/config.jsp Thu Jan 18 12:14:58
2007
@@ -259,6 +259,15 @@
 		</TR>
 		<TR>
 			<TD align="left"><INPUT type="checkbox"
+                <%=TradeConfig.getPublishQuotePriceChange() ? "checked" : ""%>
+                name="EnablePublishQuotePriceChange"> <B><FONT size="-1">Publish
Quote Updates</FONT></B><BR>
+            </TD>
+            <TD>
+                Publish quote price changes to a JMS topic.<BR>
+            </TD>
+        </TR>
+		<TR>
+			<TD align="left"><INPUT type="checkbox"
                 <%=TradeConfig.getLongRun() ? "checked" : ""%>
                 name="EnableLongRun"> <B><FONT size="-1">Enable long run support</FONT></B><BR>
             </TD>



Mime
View raw message