Mercurial > dive4elements > framework
view artifact-database/src/main/java/de/intevation/artifactdatabase/SQL.java @ 43:b8516aa3d8a1
Time delta calculation in SQL statement to figure out outdated artifacts
in H2 database was broken.
artifacts/trunk@122 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 24 Sep 2009 09:15:56 +0000 |
parents | 5a6b6a3debc7 |
children | 4ae4dc99127d |
line wrap: on
line source
package de.intevation.artifactdatabase; import java.util.Properties; import java.io.IOException; import java.io.InputStream; import org.apache.log4j.Logger; /** * @author Sascha L. Teichmann */ public final class SQL { private static Logger logger = Logger.getLogger(SQL.class); private SQL() { } private static Properties statements; public static final synchronized Properties getStatements() { if (statements == null) { statements = loadStatements(); } return statements; } private static final Properties loadStatements() { String driver = Config.getStringXPath( DBConnection.DB_DRIVER, DBConnection.DEFAULT_DRIVER); Properties properties = new Properties(); InputStream in = null; try { String res = "/sql/" + driver.replace('.', '-').toLowerCase() + ".properties"; in = SQL.class.getResourceAsStream(res); if (in == null) { logger.warn("No SQL file for driver '" + driver + "' found."); res = "/sql/" + DBConnection.DEFAULT_DRIVER.replace('.', '-').toLowerCase() + ".properties"; if ((in = SQL.class.getResourceAsStream(res)) == null) { logger.error("No SQL file found"); } } properties.load(in); } catch (IOException ioe) { logger.error(ioe.getLocalizedMessage(), ioe); } finally { if (in != null) { try { in.close(); } catch (IOException ioe) {} } } return properties; } public static final String get(String key) { return getStatements().getProperty(key); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: