|
11
|
1 |
/*
|
|
|
2 |
* Copyright 2011 Tomas Zeman <tzeman@volny.cz>
|
|
|
3 |
*
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
|
6 |
* You may obtain a copy of the License at
|
|
|
7 |
*
|
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9 |
*
|
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13 |
* See the License for the specific language governing permissions and
|
|
|
14 |
* limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
package bootstrap.liftweb
|
|
|
17 |
|
|
|
18 |
import fis.base.model._
|
|
|
19 |
import net.liftweb.common._
|
|
|
20 |
import net.liftweb.db.{DB, ConnectionIdentifier}
|
|
|
21 |
import net.liftweb.http._
|
|
|
22 |
import net.liftweb.squerylrecord.SquerylRecord
|
|
|
23 |
import net.liftweb.util._
|
|
|
24 |
import net.liftweb.util.Helpers._
|
|
|
25 |
import net.tz.lift.boot.ProtoBoot
|
|
|
26 |
import net.tz.lift.util.StandardDBVendor
|
|
|
27 |
|
|
|
28 |
class Boot extends ProtoBoot {
|
|
|
29 |
override def boot = {
|
|
|
30 |
|
|
|
31 |
/* DB stuff */
|
|
|
32 |
DB.defineConnectionManager(FisConnectionIdentifier, new FisDbVendor)
|
|
|
33 |
S.addAround(DB.buildLoanWrapper(List(FisConnectionIdentifier)))
|
|
|
34 |
SquerylRecord.init(() => new SeqIdPostgreSqlAdapter)
|
|
|
35 |
|
|
|
36 |
super.boot
|
|
|
37 |
|
|
|
38 |
}
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
case object FisConnectionIdentifier extends ConnectionIdentifier {
|
|
|
42 |
val jndiName = "fis"
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
import java.sql.Connection
|
|
|
46 |
|
|
|
47 |
class FisDbVendor extends StandardDBVendor(
|
|
|
48 |
"org.postgresql.Driver", Props.get("db.fis.url", ""),
|
|
|
49 |
Props.get("db.fis.user"), Props.get("db.fis.pass")) {
|
|
|
50 |
|
|
|
51 |
val testQuery = "SELECT version()"
|
|
|
52 |
override protected def testConnection(c: Connection) = {
|
|
|
53 |
c.prepareStatement(testQuery).executeQuery
|
|
|
54 |
}
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
// vim: set ts=2 sw=2 et:
|