Author: [log in to unmask]
Date: Mon Sep 21 15:31:02 2015
New Revision: 3657
Log:
Fix bad commit which broke this file.
Modified:
webapps/trunk/run-webapp/src/main/java/org/hps/run/webapp/DatabaseUtilities.java
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:31:02 2015
@@ -1,22 +1,13 @@
package org.hps.run.webapp;
-import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
-/**
- * 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 final class DatabaseUtilities {
+
+ private static String DATASOURCE_CONTEXT = "java:comp/env/jdbc/hps_run_db";
+
public static DataSource getDataSource() {
DataSource dataSource = null;
try {
@@ -24,6 +15,9 @@
} catch (final NamingException e) {
throw new RuntimeException("Error creating data source.", e);
}
+ if (dataSource == null) {
+ throw new IllegalStateException("Data source not found");
+ }
return dataSource;
}
}
|