Author: snoopdave
Date: Thu May 24 10:58:53 2007
New Revision: 541372
URL: http://svn.apache.org/viewvc?view=rev&rev=541372
Log:
Latest from trunk
Added:
roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernateConnectionProvider.java
- copied unchanged from r541345,
roller/trunk/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernateConnectionProvider.java
Removed:
roller/branches/roller_4.0_newbackend/apps/planet/testdata/hibernate.cfg.xml
roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet.properties
roller/branches/roller_4.0_newbackend/apps/planet/testdata/planetRuntimeConfigDefs.xml
roller/branches/roller_4.0_newbackend/apps/planet/testdata/rome.properties
Modified:
roller/branches/roller_4.0_newbackend/apps/planet/build.properties
roller/branches/roller_4.0_newbackend/apps/planet/build.xml
roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties
Modified: roller/branches/roller_4.0_newbackend/apps/planet/build.properties
URL:
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/apps/planet/build.properties?view=diff&rev=541372&r1=541371&r2=541372
==============================================================================
--- roller/branches/roller_4.0_newbackend/apps/planet/build.properties
(original)
+++ roller/branches/roller_4.0_newbackend/apps/planet/build.properties Thu May
24 10:58:53 2007
@@ -1,7 +1,7 @@
# compile properties
build.debug=true
-build.sourcelevel=1.4
+build.sourcelevel=1.5
build.deprecation=false
Modified: roller/branches/roller_4.0_newbackend/apps/planet/build.xml
URL:
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/apps/planet/build.xml?view=diff&rev=541372&r1=541371&r2=541372
==============================================================================
--- roller/branches/roller_4.0_newbackend/apps/planet/build.xml (original)
+++ roller/branches/roller_4.0_newbackend/apps/planet/build.xml Thu May 24
10:58:53 2007
@@ -33,6 +33,7 @@
<property name="src" value="${basedir}/src/java" />
<property name="tools" value="${basedir}/../../tools" />
<property name="test" value="${basedir}/test/java" />
+ <property name="testcontext"
value="${basedir}/build/test/testcontext" />
<property name="web" value="${basedir}/web" />
<!-- build properties -->
@@ -369,7 +370,13 @@
<pathelement location="${tools}/buildtime/ant-1.6.2/ant.jar"/>
</classpath>
</javac>
-
+
+ <mkdir dir="${testcontext}" />
+ <copy todir="${testcontext}">
+ <fileset dir="${web}" excludes="**/jsps/**,**/velocity/**" />
+ <fileset dir="${basedir}/testdata" />
+ </copy>
+
<!-- Copy test resources -->
<copy todir="${build.compile.test}">
<fileset dir="${test}" excludes="**/*.java, **/*.html, **/*.png" />
@@ -405,8 +412,9 @@
<!-- plus our compiled test classes -->
<pathelement location="${build.compile.test}"/>
- <!-- testdata. the equivalent of /WEB-INF/classes in a webapp
-->
- <pathelement location="${basedir}/testdata" />
+ <!-- testdata. the equivalent of /WEB-INF/classes in a webapp
-->
+ <pathelement location="${basedir}/build/test/testcontext" />
+ <pathelement
location="${basedir}/build/test/testcontext/WEB-INF/classes" />
<!-- plus the classpath for jars needed to talk to the test db
-->
<pathelement path="${test.db.cpath}" />
Modified:
roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
URL:
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java?view=diff&rev=541372&r1=541371&r2=541372
==============================================================================
---
roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
(original)
+++
roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/hibernate/HibernatePlanetImpl.java
Thu May 24 10:58:53 2007
@@ -18,7 +18,6 @@
package org.apache.roller.planet.business.hibernate;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.RollerException;
@@ -39,7 +38,7 @@
private static Log log = LogFactory.getLog(HibernatePlanetImpl.class);
// our singleton instance
- private static HibernatePlanetImpl me = null;
+ protected static HibernatePlanetImpl me = null;
// a persistence utility class
protected HibernatePersistenceStrategy strategy = null;
@@ -60,28 +59,8 @@
* file plus JDBC overrides from planet-custom.properties.
*/
protected HibernatePlanetImpl() throws RollerException {
- try {
- if
(StringUtils.isNotEmpty(PlanetConfig.getProperty("jdbc.driverClass"))) {
- // create and configure for JDBC access
- strategy = new HibernatePersistenceStrategy(
- PlanetConfig.getProperty("hibernate.configResource"),
- PlanetConfig.getProperty("hibernate.dialect"),
- PlanetConfig.getProperty("jdbc.driverClass"),
- PlanetConfig.getProperty("jdbc.connectionURL"),
- PlanetConfig.getProperty("jdbc.username"),
- PlanetConfig.getProperty("jdbc.password"));
- } else {
- // create an configure via config resource only
- strategy = new HibernatePersistenceStrategy(
- PlanetConfig.getProperty("hibernate.configResource"),
- PlanetConfig.getProperty("hibernate.dialect"));
- }
-
- } catch(Throwable t) {
- // if this happens then we are screwed
- log.fatal("Error initializing Hibernate", t);
- throw new RollerException(t);
- }
+
+ strategy = getStrategy();
try {
String feedFetchClass =
PlanetConfig.getProperty("feedfetcher.classname");
@@ -98,6 +77,22 @@
} catch (Exception e) {
throw new RollerException("Error initializing feed fetcher", e);
}
+ }
+
+ protected HibernatePersistenceStrategy getStrategy() throws
RollerException {
+ try {
+ String dialect =
+ PlanetConfig.getProperty("hibernate.dialect");
+ String connectionProvider =
+ PlanetConfig.getProperty("hibernate.connectionProvider");
+ return new HibernatePersistenceStrategy(
+ "/hibernate.cfg.xml", dialect, connectionProvider);
+
+ } catch(Throwable t) {
+ // if this happens then we are screwed
+ log.fatal("Error initializing Hibernate", t);
+ throw new RollerException(t);
+ }
}
Modified:
roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties
URL:
http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties?view=diff&rev=541372&r1=541371&r2=541372
==============================================================================
---
roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties
(original)
+++
roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties
Thu May 24 10:58:53 2007
@@ -1,12 +1,14 @@
-
persistence.planet.classname=org.apache.roller.planet.business.jpa.JPAPlanetImpl
#persistence.planet.classname=org.apache.roller.planet.business.datamapper.jpa.JPAPlanetImpl
#persistence.planet.classname=org.apache.roller.planet.business.hibernate.HibernatePlanetImpl
-jdbc.driverClass=org.apache.derby.jdbc.ClientDriver
-jdbc.connectionURL=jdbc:derby://localhost:3219/planet
-jdbc.username=app
-jdbc.password=app
+database.configurationType=jdbc
+
+database.jdbc.driverClass=org.apache.derby.jdbc.ClientDriver
+database.jdbc.connectionURL=jdbc:derby://localhost:3219/planet
+database.jdbc.username=app
+database.jdbc.password=app
+
hibernate.dialect=org.hibernate.dialect.DerbyDialect
#jdbc.driverClass=com.mysql.jdbc.Driver