diff artifact-database/src/main/java/de/intevation/artifactdatabase/SQL.java @ 87:0f48188a6e02

Added some javadoc to the artifactdatabase module. Not done yet. artifacts/trunk@839 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 26 Mar 2010 11:40:28 +0000
parents 8447467cef86
children e27cf9c84eb8
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/SQL.java	Fri Mar 26 10:04:34 2010 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/SQL.java	Fri Mar 26 11:40:28 2010 +0000
@@ -8,6 +8,10 @@
 import org.apache.log4j.Logger;
 
 /**
+ * Singleton to provide SQL statement strings as key/value pairs.
+ * This mechanism is used to encapsulate database specific SQL
+ * dialects.
+ *
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public final class SQL
@@ -19,6 +23,20 @@
 
     private static Properties statements;
 
+    /**
+     * Returns key/value pairs of SQL statements for the used database
+     * backend.
+     * The concrete set of SQL statements is determined by the
+     * used JDBC database driver which is configured in conf.xml.
+     * The class name of the driver is transformed by replacing
+     * all '.' with '_' and lower case the resulting string.
+     * The transformed string is used to load a properties file
+     * in '/sql/' which should contain the statements.
+     * Example:<br>
+     * <code>org.postgresql.Driver</code> results in loading of
+     * <code>/sql/org-postgresql-driver.properties</code>.
+     * @return The key/value pairs of SQL statements.
+     */
     public static final synchronized Properties getStatements() {
         if (statements == null) {
             statements = loadStatements();
@@ -61,8 +79,14 @@
         return properties;
     }
 
+    /**
+     * Returns a particular SQL statement for a given key.
+     * @param key The key of the statement.
+     * @return The corresponing SQL statement or null if none
+     * is found.
+     */
     public static final String get(String key) {
         return getStatements().getProperty(key);
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org