geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r886775 - in /geronimo/sandbox/jbohn/daytrader-bp-new/modules: core/src/main/java/org/apache/geronimo/samples/daytrader/core/ core/src/main/resources/OSGI-INF/blueprint/ persist-jdbc/src/main/java/org/apache/geronimo/samples/daytrader/persi...
Date Thu, 03 Dec 2009 13:27:25 GMT
Author: jbohn
Date: Thu Dec  3 13:27:24 2009
New Revision: 886775

URL: http://svn.apache.org/viewvc?rev=886775&view=rev
Log:
clean-up code, add nanmespace references, etc...

Modified:
    geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBManagerImpl.java
    geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/java/org/apache/geronimo/samples/daytrader/persist/jdbc/TradeJDBCDirect.java
    geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/java/org/apache/geronimo/samples/daytrader/persist/jpa/TradeJPADirect.java
    geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml

Modified: geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBManagerImpl.java?rev=886775&r1=886774&r2=886775&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBManagerImpl.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBManagerImpl.java
Thu Dec  3 13:27:24 2009
@@ -52,12 +52,14 @@
 
     private static boolean initialized = false;
 
+    private static int connCount = 0;
+
+    private static Integer lock = new Integer(0);
+
     /**
      * Zero arg constructor for TradeDBManagerImpl
      */
     public TradeDBManagerImpl() {
-        if (initialized == false)
-            init();
     }
 
     /**
@@ -373,17 +375,15 @@
      * Lookup the TradeData datasource
      */
     private void getDataSource() throws Exception {
-        if (datasource == null)
+        if (datasource == null) {
+            context = new InitialContext();
             datasource = (DataSource) context.lookup(dsName);
+        }
     }
 
     /*
      * Allocate a new connection to the datasource
      */
-    private static int connCount = 0;
-
-    private static Integer lock = new Integer(0);
-
     private Connection getConn() throws Exception {
 
         Connection conn = null;
@@ -428,19 +428,11 @@
     }
 
 
-    public static synchronized void init() {
+    public static void init() {
         if (initialized)
             return;
         if (Log.doTrace())
             Log.trace("TradeDBManagerImpl:init -- *** initializing");
-        try {
-            context = new InitialContext();
-            datasource = (DataSource) context.lookup(dsName);
-        }
-        catch (Exception e) {
-            Log.error("TradeDBManagerImpl:init -- error on JNDI lookups of DataSource --
TradeDBManagerImpl will not work", e);
-            return;
-        }
 
         TradeConfig.setPublishQuotePriceChange(false);
 

Modified: geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=886775&r1=886774&r2=886775&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp-new/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Thu Dec  3 13:27:24 2009
@@ -1,4 +1,6 @@
-<blueprint>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
   <bean id="tradeServicesManagerBean" class="org.apache.geronimo.samples.daytrader.core.TradeServicesManagerImpl"
activation="lazy" init-method="init">
       <!--<property name="tradeServicesList" ref="tradeServicesList"/>-->

Modified: geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/java/org/apache/geronimo/samples/daytrader/persist/jdbc/TradeJDBCDirect.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/java/org/apache/geronimo/samples/daytrader/persist/jdbc/TradeJDBCDirect.java?rev=886775&r1=886774&r2=886775&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/java/org/apache/geronimo/samples/daytrader/persist/jdbc/TradeJDBCDirect.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/java/org/apache/geronimo/samples/daytrader/persist/jdbc/TradeJDBCDirect.java
Thu Dec  3 13:27:24 2009
@@ -69,17 +69,21 @@
 
     private boolean inSession = false;
 
+    private static InitialContext context;
+
+    private static int connCount = 0;
+
+    private static Integer lock = new Integer(0);
+
+    private static boolean initialized = false;
+
     /**
      * Zero arg constructor for TradeJDBCDirect
      */
     public TradeJDBCDirect() {
-        if (initialized == false)
-            init();
     }
 
     public TradeJDBCDirect(boolean inSession) {
-        if (initialized == false)
-            init();
 
         this.inSession = inSession;
     }
@@ -1512,21 +1516,19 @@
      * Lookup the TradeData datasource
      */
     private void getDataSource() throws Exception {
-        datasource = (DataSource) context.lookup(dsName);
+        if (datasource == null) {
+            context = new InitialContext();
+            datasource = (DataSource) context.lookup(dsName);
+        }
     }
 
     /*
      * Allocate a new connection to the datasource
      */
-    private static int connCount = 0;
-
-    private static Integer lock = new Integer(0);
-
     private Connection getConn() throws Exception {
 
         Connection conn = null;
-        if (datasource == null)
-            getDataSource();
+        getDataSource();
         conn = datasource.getConnection();
         conn.setAutoCommit(false);
         if (Log.doTrace()) {
@@ -1684,22 +1686,11 @@
     private static final String updateQuotePriceVolumeSQL =
         "update quoteejb set " + "price = ?, change1 = ? - open1, volume = ? " + "where symbol
= ?";
 
-    private static boolean initialized = false;
-
-    public static synchronized void init() {
+    public static void init() {
         if (initialized)
             return;
         if (Log.doTrace())
             Log.trace("TradeJDBCDirect:init -- *** initializing");
-        try {
-            if (Log.doTrace())
-                Log.trace("TradeJDBCDirect: init");
-            context = new InitialContext();
-            datasource = (DataSource) context.lookup(dsName);
-        } catch (Exception e) {
-            Log.error("TradeJDBCDirect:init -- error on JNDI lookups of DataSource -- TradeJDBCDirect
will not work", e);
-            return;
-        }
 
         TradeConfig.setPublishQuotePriceChange(false);
 
@@ -1719,8 +1710,6 @@
         }
     }
 
-    private static InitialContext context;
-
     /**
      * Gets the inGlobalTxn
      * 

Modified: geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=886775&r1=886774&r2=886775&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/resources/OSGI-INF/blueprint/blueprint.xml
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jdbc/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Thu Dec  3 13:27:24 2009
@@ -1,4 +1,6 @@
-<blueprint>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
   <bean id="tradeServicesBeanJDBC" class="org.apache.geronimo.samples.daytrader.persist.jdbc.TradeJDBCDirect"
activation="lazy" init-method="init">
       <!--<property name="inSession" value="true"/>-->

Modified: geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/java/org/apache/geronimo/samples/daytrader/persist/jpa/TradeJPADirect.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/java/org/apache/geronimo/samples/daytrader/persist/jpa/TradeJPADirect.java?rev=886775&r1=886774&r2=886775&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/java/org/apache/geronimo/samples/daytrader/persist/jpa/TradeJPADirect.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/java/org/apache/geronimo/samples/daytrader/persist/jpa/TradeJPADirect.java
Thu Dec  3 13:27:24 2009
@@ -70,12 +70,9 @@
      * Zero arg constructor for TradeJPADirect
      */
     public TradeJPADirect() {
-
-        if (initialized == false)
-            init();
     }
 
-    public static synchronized void init() {
+    public static void init() {
         if (initialized)
             return;
         if (Log.doTrace())

Modified: geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=886775&r1=886774&r2=886775&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp-new/modules/persist-jpa/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Thu Dec  3 13:27:24 2009
@@ -1,4 +1,6 @@
-<blueprint>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
   <bean id="tradeServicesBeanJPA" class="org.apache.geronimo.samples.daytrader.persist.jpa.TradeJPADirect"
activation="lazy" init-method="init"> 
   </bean>



Mime
View raw message