geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r831303 - in /geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main: java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java resources/OSGI-INF/blueprint/blueprint.xml
Date Fri, 30 Oct 2009 14:07:07 GMT
Author: jbohn
Date: Fri Oct 30 14:07:07 2009
New Revision: 831303

URL: http://svn.apache.org/viewvc?rev=831303&view=rev
Log:
some more tweaks

Modified:
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java?rev=831303&r1=831302&r2=831303&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
Fri Oct 30 14:07:07 2009
@@ -58,7 +58,7 @@
 
 public class TradeJPADirect implements TradeServices, TradeDBServices {
 
-    @PersistenceUnit
+    @PersistenceUnit(unitName="daytrader")
     private static EntityManagerFactory emf;
 
     private static BigDecimal ZERO = new BigDecimal(0.0);
@@ -70,15 +70,6 @@
      */
     public TradeJPADirect() {
 
-
-        // TO-DO why
-        TradeConfig.setPublishQuotePriceChange(false);
-        if (emf == null) {
-            // creating entity manager factory. the persistence xml must be
-            // place under src/META-INF/
-            emf = Persistence.createEntityManagerFactory("daytrader");
-        }
-
         if (initialized == false)
             init();
     }
@@ -89,8 +80,6 @@
         if (Log.doTrace())
             Log.trace("TradeJPADirect:init -- *** initializing");
 
-        // TO-DO-for some reason this is not setting it to false- added
-        // to the construct.
         TradeConfig.setPublishQuotePriceChange(false);
 
         if (Log.doTrace())
@@ -174,8 +163,7 @@
         return marketSummaryData;
     }
 
-    public OrderDataBean buy(String userID, String symbol, double quantity,
-                             int orderProcessingMode) {
+    public OrderDataBean buy(String userID, String symbol, double quantity, int orderProcessingMode)
{
         OrderDataBean order = null;
         BigDecimal total;
         /*
@@ -198,8 +186,7 @@
 
             HoldingDataBean holding = null; // The holding will be created by this buy order
 
-            order = createOrder(account, quote, holding, "buy", quantity,
-                                entityManager);
+            order = createOrder(account, quote, holding, "buy", quantity, entityManager);
 
             // order = createOrder(account, quote, holding, "buy", quantity);
             // UPDATE - account should be credited during completeOrder
@@ -641,18 +628,15 @@
          * "quoteejb.quoteForUpdate" defined in QuoteDatabean
          */
         EntityManager entityManager = emf.createEntityManager();
-        QuoteDataBean quote = new QuoteDataBean();
+        QuoteDataBean quote = null;
         if (TradeConfig.jpaLayer == TradeConfig.HIBERNATE) {
             quote = entityManager.find(QuoteDataBean.class, symbol);
-        }
-
-        if (TradeConfig.jpaLayer == TradeConfig.OPENJPA) {
+        } else if (TradeConfig.jpaLayer == TradeConfig.OPENJPA) {
   
             Query q = entityManager.createNamedQuery("quoteejb.quoteForUpdate");
             q.setParameter(1, symbol);
   
             quote = (QuoteDataBean) q.getSingleResult();
-
         }
 
         BigDecimal oldPrice = quote.getPrice();

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=831303&r1=831302&r2=831303&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Fri Oct 30 14:07:07 2009
@@ -14,7 +14,7 @@
       </service-properties>
   </service>
 
-  <bean id="tradeServicesBeanJPA" class="org.apache.geronimo.samples.daytrader.core.direct.TradeJPADirect"
activation="lazy"/> 
+  <bean id="tradeServicesBeanJPA" class="org.apache.geronimo.samples.daytrader.core.direct.TradeJPADirect"
activation="lazy" init-method="init"/> 
   
   <service id="tradeServicesJPA" ref="tradeServicesBeanJPA" interface="org.apache.geronimo.samples.daytrader.core.TradeServices">
       <service-properties>



Mime
View raw message