Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java @ 5193:fb9dcc68b9c2
Possible fix for flys/1202. Initial SQL statements can now be issued at connection creation.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 07 Mar 2013 17:39:25 +0100 |
parents | d4fdd98a04f7 |
children | 92c8f8d1a3ba |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java Thu Mar 07 16:06:44 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java Thu Mar 07 17:39:25 2013 +0100 @@ -96,6 +96,9 @@ public static final String XPATH_URL = "/artifact-database/backend-database/url/text()"; + public static final String XPATH_CONNECTION_INIT_SQLS = + "/artifact-database/backend-database/connection-init-sqls/text()"; + public static final String DEFAULT_USER = System.getProperty("flys.backend.user", "flys"); @@ -117,6 +120,10 @@ "flys.backend.url", "jdbc:postgresql://localhost:5432/flys"); + public static final String DEFAULT_CONNECTION_INIT_SQLS = + System.getProperty( + "flys.backend.connection.init.sqls"); + public static final Class [] CLASSES = { Annotation.class, AnnotationType.class, @@ -203,9 +210,11 @@ String password, String dialect, String driver, - String url + String url, + String connectionInitSqls ) { - super(user, password, dialect, driver, url, CLASSES); + super( + user, password, dialect, driver, url, connectionInitSqls, CLASSES); } private static Credentials instance; @@ -222,9 +231,13 @@ Config.getStringXPath(XPATH_DRIVER, DEFAULT_DRIVER); String url = Config.getStringXPath(XPATH_URL, DEFAULT_URL); + String connectionInitSqls = + Config.getStringXPath( + XPATH_CONNECTION_INIT_SQLS, + DEFAULT_CONNECTION_INIT_SQLS); instance = new FLYSCredentials( - user, password, dialect, driver, url); + user, password, dialect, driver, connectionInitSqls, url); } return instance; } @@ -235,7 +248,8 @@ DEFAULT_PASSWORD, DEFAULT_DIALECT, DEFAULT_DRIVER, - DEFAULT_URL); + DEFAULT_URL, + DEFAULT_CONNECTION_INIT_SQLS); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :