src/main/kotlin/de/uapcore/lightpit/DataSourceProvider.kt

changeset 184
e8eecee6aadf
parent 180
009700915269
child 247
e71ae69c68c0
equal deleted inserted replaced
183:61669abf277f 184:e8eecee6aadf
59 59
60 companion object { 60 companion object {
61 /** 61 /**
62 * The attribute name in the Servlet context under which an instance of this class can be found. 62 * The attribute name in the Servlet context under which an instance of this class can be found.
63 */ 63 */
64 val SC_ATTR_NAME = "lightpit.service.DataSourceProvider" 64 const val SC_ATTR_NAME = "lightpit.service.DataSourceProvider"
65 65
66 /** 66 /**
67 * Timeout in seconds for the validation test. 67 * Timeout in seconds for the validation test.
68 */ 68 */
69 private val DB_TEST_TIMEOUT = 10 69 private const val DB_TEST_TIMEOUT = 10
70 70
71 /** 71 /**
72 * The default schema to test against when validating the connection. 72 * The default schema to test against when validating the connection.
73 * May be overridden by context parameter. 73 * May be overridden by context parameter.
74 * 74 *
75 * @see Constants.CTX_ATTR_DB_SCHEMA 75 * @see Constants.CTX_ATTR_DB_SCHEMA
76 */ 76 */
77 private val DB_DEFAULT_SCHEMA = "lightpit" 77 private const val DB_DEFAULT_SCHEMA = "lightpit"
78 78
79 /** 79 /**
80 * The JNDI resource name for the data source. 80 * The JNDI resource name for the data source.
81 */ 81 */
82 private val DS_JNDI_NAME = "jdbc/lightpit/app" 82 private const val DS_JNDI_NAME = "jdbc/lightpit/app"
83 } 83 }
84 84
85 private fun checkConnection(ds: DataSource, testSchema: String) { 85 private fun checkConnection(ds: DataSource, testSchema: String) {
86 try { 86 try {
87 ds.connection.use { conn -> 87 ds.connection.use { conn ->

mercurial