Author: rhirsch Date: Fri Feb 26 07:31:20 2010 New Revision: 916594 URL: http://svn.apache.org/viewvc?rev=916594&view=rev Log: [ESME-167] Simplify JDBC usage
Modified: incubator/esme/trunk/server/pom.xml incubator/esme/trunk/server/src/main/resources/props/test.default.props incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala Modified: incubator/esme/trunk/server/pom.xml URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/pom.xml?rev=916594&r1=916593&r2=916594&view=diff ============================================================================== --- incubator/esme/trunk/server/pom.xml (original) +++ incubator/esme/trunk/server/pom.xml Fri Feb 26 07:31:20 2010 @@ -25,13 +25,32 @@ <version>apache-esme-1.0-RC1-incubating</version> <packaging>war</packaging> <name>Apache Enterprise Social Messaging Experiment (ESME)</name> + <url>http://incubator.apache.org/esme</url> + <description>ESME is a social tool that takes the immediacy of messaging and applies it to real time business process problem solving</description> <inceptionYear>2008</inceptionYear> + <issueManagement> + <system>JIRA</system> + <url>http://issues.apache.org/jira/browse/ESME</url> + </issueManagement> + <ciManagement> + <system>Hudson</system> + <url>http://hudson.zones.apache.org/hudson/job/ESME</url> + </ciManagement> <licenses> <license> <name>The Apache Software License, Version 2.0</name> <url>LICENSE.txt</url> </license> </licenses> + <organization> + <name>Apache Software Foundation: Incubator</name> + <url>http://inciubator.apache.org</url> + </organization> + <scm> + <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/esme</connection> + <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/esme</developerConnection> + <url>http://svn.apache.org/repos/asf/incubator/esme</url> + </scm> <mailingLists> <mailingList> <name>ESME Dev List</name> @@ -40,7 +59,21 @@ <post>esme-...@incubator.apache.org</post> <archive>http://mail-archives.apache.org/mod_mbox/incubator-esme-dev/</archive> </mailingList> - </mailingLists> + </mailingLists> + <developers> + <developer> + <id>rhirsch</id> + <name>Dick Hirsch</name> + <email>rhirsch -at- apache.org</email> + <organization>Apache</organization> + <roles> + <role>Release Manager</role> + <role>Wiki Gardnener</role> + <role>Process Analyst</role> + <role>All-Arounder</role> + </roles> + </developer> + </developers> <properties> <lift.version>1.1-M8</lift.version> <scala.version>2.7.7</scala.version> @@ -156,11 +189,7 @@ <artifactId>compass</artifactId> <version>${compass.version}</version> </dependency> - <dependency> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - <version>8.2-507.jdbc3</version> - </dependency> + <dependency> <groupId>org.apache.derby</groupId> <artifactId>derby</artifactId> Modified: incubator/esme/trunk/server/src/main/resources/props/test.default.props URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/resources/props/test.default.props?rev=916594&r1=916593&r2=916594&view=diff ============================================================================== --- incubator/esme/trunk/server/src/main/resources/props/test.default.props (original) +++ incubator/esme/trunk/server/src/main/resources/props/test.default.props Fri Feb 26 07:31:20 2010 @@ -17,4 +17,5 @@ * under the License. */ compass_config_file=/props/compass.filesystem.cfg.xml -role.api_test=integration-admin \ No newline at end of file +role.api_test=integration-admin +db_driver=jdbc:derby:memory:esme_test_db;create=true \ No newline at end of file Modified: incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala?rev=916594&r1=916593&r2=916594&view=diff ============================================================================== --- incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala (original) +++ incubator/esme/trunk/server/src/main/scala/bootstrap/liftweb/Boot.scala Fri Feb 26 07:31:20 2010 @@ -244,30 +244,17 @@ private val maxPoolSize = 4 private def createOne: Box[Connection] = try { - if (Props.getBool("use_prod_psql", false)) { - Class.forName("org.postgresql.Driver") - val dm = DriverManager. - getConnection("jdbc:postgresql://localhost/esme_prod", - Props.get("db_user", "dpp"), - Props.get("db_pwd", "")) - Full(dm) - } else if (Props.getBool("use_local_psql", false)) { - Class.forName("org.postgresql.Driver") - val dm = DriverManager. - getConnection("jdbc:postgresql://localhost/esme_dev", - Props.get("db_user", "dpp"), - Props.get("db_pwd", "")) - Full(dm) - } else { - val driverName = Props.mode match { - case Props.RunModes.Test => "jdbc:derby:memory:esme_test_db;create=true" - case _ => "jdbc:derby:esme_db;create=true" - } - - val dm = DriverManager.getConnection(driverName) - Full(dm) - } - } catch { + + val driverClass = Props.get("db_driver", "org.apache.derby.jdbc.EmbeddedDriver") + val db_user = Props.get("db_user", "") + val db_pwd = Props.get("db_pwd", "") + val jdbc_connect = Props.get("jdbc_connect_url", "jdbc:derby:esme_db;create=true") + + Class.forName(driverClass) + val dm = DriverManager.getConnection(jdbc_connect, db_user, db_pwd) + Full(dm) + + } catch { case e: Exception => e.printStackTrace; Empty }