Print

Print


Author: [log in to unmask]
Date: Mon Sep 21 15:14:02 2015
New Revision: 3655

Log:
Move run webapp to webapps repo node.

Added:
    webapps/trunk/run-webapp/
      - copied from r3651, java/trunk/run-webapp/
Removed:
    java/trunk/run-webapp/
Modified:
    webapps/trunk/run-webapp/src/main/java/org/hps/run/webapp/DatabaseUtilities.java
    webapps/trunk/run-webapp/src/main/webapp/WEB-INF/web.xml

Modified: webapps/trunk/run-webapp/src/main/java/org/hps/run/webapp/DatabaseUtilities.java
 =============================================================================
--- webapps/trunk/run-webapp/src/main/java/org/hps/run/webapp/DatabaseUtilities.java	(original)
+++ webapps/trunk/run-webapp/src/main/java/org/hps/run/webapp/DatabaseUtilities.java	Mon Sep 21 15:14:02 2015
@@ -1,13 +1,22 @@
 package org.hps.run.webapp;
 
+import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.sql.DataSource;
 
-public final class DatabaseUtilities {
-
-    private static String DATASOURCE_CONTEXT = "java:comp/env/jdbc/hps_run_db";
+/**
+ * Database utility methods.
+ * 
+ * @author Jeremy McCormick, SLAC
+ */
+final class DatabaseUtilities {
     
+    /**
+     * Get the Run Database data source defined in Tomcat's context.xml file.
+     * 
+     * @return the Run Database data source
+     */
     public static DataSource getDataSource() {
         DataSource dataSource = null;
         try {
@@ -15,9 +24,6 @@
         } catch (final NamingException e) {
             throw new RuntimeException("Error creating data source.", e);
         }
-        if (dataSource == null) {
-            throw new IllegalStateException("Data source not found");
-        }
         return dataSource;
     }
 }

Modified: webapps/trunk/run-webapp/src/main/webapp/WEB-INF/web.xml
 =============================================================================
--- webapps/trunk/run-webapp/src/main/webapp/WEB-INF/web.xml	(original)
+++ webapps/trunk/run-webapp/src/main/webapp/WEB-INF/web.xml	Mon Sep 21 15:14:02 2015
@@ -8,7 +8,7 @@
     <display-name>HPS Run Web Application</display-name>
 
     <resource-ref>
-        <description>DB Connection</description>
+        <description>Run Database Connection</description>
         <res-ref-name>jdbc/hps_run_db</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>