Mercurial > dive4elements > framework
view artifact-database/src/main/java/de/intevation/artifactdatabase/SQL.java @ 77:48d1a9a082c2 0.5
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
to make the sources to be able to be formatted with jalopy (http://jalopy.sourceforge.net).
artifacts/trunk@695 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 21 Feb 2010 23:05:32 +0000 |
parents | 4ae4dc99127d |
children | 8447467cef86 |
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: