You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2007/03/07 15:20:57 UTC

svn commit: r515580 - in /incubator/roller/branches/roller_4.0_newbackend: apps/planet/ apps/planet/src/java/org/apache/roller/planet/business/jpa/ apps/planet/testdata/ apps/planet/web/WEB-INF/classes/ components/core/src/java/org/apache/roller/busine...

Author: snoopdave
Date: Wed Mar  7 06:20:50 2007
New Revision: 515580

URL: http://svn.apache.org/viewvc?view=rev&rev=515580
Log:
- Reduce number of places JDBC configuration muyst be specified
- Enable JPA configuration via roller-custom.properties

Removed:
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/velocity.log
Modified:
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/build.properties
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/JPAEMF.properties
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties
    incubator/roller/branches/roller_4.0_newbackend/apps/planet/web/WEB-INF/classes/JPAEMF.properties
    incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java
    incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java
    incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties
    incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties
    incubator/roller/branches/roller_4.0_newbackend/tools/roller-core/roller-core.jar
    incubator/roller/branches/roller_4.0_newbackend/tools/roller-planet/roller-planet-business.jar
    incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/JPAEMF.properties

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/build.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/build.properties?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/build.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/build.properties Wed Mar  7 06:20:50 2007
@@ -30,9 +30,9 @@
 #test.db.initTask=init-db
 #test.db.stopTask=nothing
 #test.db.name=mysql
-#test.db.cpath=/export/home/java/mysql-connector-java-3.0.14-production/mysql-connector-java-3.0.14-production-bin.jar
+#test.db.cpath=/Users/dave/tomcat/common/lib/mysql-connector-java-3.1.14-bin.jar
 #test.db.driver=com.mysql.jdbc.Driver
-#test.db.url=jdbc:mysql://localhost/test_planet
-#test.db.username=roller
-#test.db.password=roller
+#test.db.url=jdbc:mysql://localhost/rollertest
+#test.db.username=scott
+#test.db.password=tiger
 

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/src/java/org/apache/roller/planet/business/jpa/JPAPlanetImpl.java Wed Mar  7 06:20:50 2007
@@ -18,12 +18,20 @@
 
 package org.apache.roller.planet.business.jpa;
 
+import java.io.InputStream;
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Enumeration;
+import java.util.Properties;
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
 import org.apache.roller.planet.business.URLStrategy;
 import org.apache.roller.planet.business.Planet;
 import org.apache.roller.planet.business.PlanetManager;
+import org.apache.roller.planet.config.PlanetConfig;
 import org.apache.roller.business.jpa.JPAPersistenceStrategy;
 import org.apache.roller.planet.business.PropertiesManager;
 
@@ -51,8 +59,54 @@
     
         
     protected JPAPlanetImpl() throws RollerException {
+        
         // set strategy used by Datamapper
-        strategy = new JPAPersistenceStrategy("PlanetPU");
+        // You can configure JPA completely via the JPAEMF.properties file
+        Properties emfProps = loadPropertiesFromResourceName(
+           "JPAEMF.properties", getContextClassLoader());
+        
+        // Or add OpenJPA, Toplink and Hibernate properties to Roller config.
+        // These override properties set so far.
+        Enumeration keys = PlanetConfig.keys();
+        while (keys.hasMoreElements()) {
+            String key = (String)keys.nextElement();
+            if (key.startsWith("openjpa.") || key.startsWith("toplink.")) {
+                String value = PlanetConfig.getProperty(key);
+                log.info(key + ": " + value);
+                emfProps.setProperty(key, value);
+            }
+        }
+
+        // Or, for plain-old JDBC, use Roller's jdbc properties and
+        // we'll convert them to OpenJPA, Toplink and Hibernate properties.
+        // These override properties set so far.
+        if (StringUtils.isNotEmpty(PlanetConfig.getProperty("jdbc.driverClass"))) {
+            
+            String driver =   PlanetConfig.getProperty("jdbc.driverClass");
+            String url =      PlanetConfig.getProperty("jdbc.connectionURL");
+            String username = PlanetConfig.getProperty("jdbc.username");
+            String password = PlanetConfig.getProperty("jdbc.password");
+            log.info("driverClass:    " + driver);
+            log.info("connectionURL:  " + url);
+            log.info("username:       " + username);         
+            
+            emfProps.setProperty("openjpa.ConnectionDriverName", driver);
+            emfProps.setProperty("openjpa.ConnectionURL", url);
+            emfProps.setProperty("openjpa.ConnectionUserName", username);
+            emfProps.setProperty("openjpa.ConnectionPassword", password); 
+           
+            emfProps.setProperty("toplink.jdbc.driver", driver);
+            emfProps.setProperty("toplink.jdbc.url", url);
+            emfProps.setProperty("toplink.jdbc.user", username);
+            emfProps.setProperty("toplink.jdbc.password", password);
+            
+            emfProps.setProperty("hibernate.connection.driver_class", driver);
+            emfProps.setProperty("hibernate.connection.url", url);
+            emfProps.setProperty("hibernate.connection.username", username);
+            emfProps.setProperty("hibernate.connection.password", password);      
+        } 
+        
+        strategy = new JPAPersistenceStrategy("PlanetPU", emfProps);
     }
     
     
@@ -127,4 +181,52 @@
             JPAPersistenceStrategy strategy) {
         return new JPAPropertiesManagerImpl(strategy);
     } 
+    
+    /**
+     * Loads properties from given resourceName using given class loader
+     * @param resourceName The name of the resource containing properties
+     * @param cl Classloeder to be used to locate the resouce
+     * @return A properties object
+     * @throws RollerException
+     */
+    private static Properties loadPropertiesFromResourceName(
+            String resourceName, ClassLoader cl) throws RollerException {
+        Properties props = new Properties();
+        InputStream in = null;
+        in = cl.getResourceAsStream(resourceName);
+        if (in == null) {
+            //TODO: Check how i18n is done in roller
+            throw new RollerException(
+                    "Could not locate properties to load " + resourceName);
+        }
+        try {
+            props.load(in);
+        } catch (IOException ioe) {
+            throw new RollerException(
+                    "Could not load properties from " + resourceName);
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException ioe) {
+                }
+            }
+        }
+        
+        return props;
+    }
+    
+    /**
+     * Get the context class loader associated with the current thread. This is
+     * done in a doPrivileged block because it is a secure method.
+     * @return the current thread's context class loader.
+     */
+    private static ClassLoader getContextClassLoader() {
+        return (ClassLoader) AccessController.doPrivileged(
+                new PrivilegedAction() {
+            public Object run() {
+                return Thread.currentThread().getContextClassLoader();
+            }
+        });
+    }
 }

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/JPAEMF.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/JPAEMF.properties?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/JPAEMF.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/JPAEMF.properties Wed Mar  7 06:20:50 2007
@@ -14,54 +14,13 @@
 # copyright in this work, please see the NOTICE file in the top level
 # directory of this distribution.
 
+# JPA properties file
+#
+# You can set JPA/Toplink, JPA/OpenJPA and JPA/Hibernate properties in your
+# roller-custom.properties override file. For other JPA implementations set
+# properties here and Roller will pick them up.
 
-#----------------- JPA/Toplink
-
-# JPA/TopLink and Derby
-#toplink.jdbc.driver=org.apache.derby.jdbc.ClientDriver
-#toplink.jdbc.url=jdbc:derby://localhost:3219/planet
-#toplink.jdbc.user=APP
-#toplink.jdbc.password=APP
-
-# JPA/TopLink and MySQL
-#toplink.jdbc.driver=com.mysql.jdbc.Driver
-#toplink.jdbc.url=jdbc:mysql://localhost/test_planet
-#toplink.jdbc.user=roller
-#toplink.jdbc.password=roller
-
-#----------------- JPA/OpenJPA
-
-# OpenJPA and Derby
-openjpa.ConnectionDriverName=org.apache.derby.jdbc.ClientDriver
-openjpa.ConnectionURL=jdbc:derby://localhost:3219/planet
-openjpa.ConnectionUserName=APP
-openjpa.ConnectionPassword=APP
-
+# Required properties for using OpenJPA with Roller
 openjpa.IgnoreChanges=true
 openjpa.FlushBeforeQueries=true
-
-#openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=false, UseClobs=true, SearchStringEscape=\\\\)
-#openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACEopenjpa.IgnoreChanges=true
-
-# OpenJPA and MySQL
-#openjpa.ConnectionDriverName=com.mysql.jdbc.Driver
-#openjpa.ConnectionURL=jdbc:mysql://localhost:3306/test_planet
-#openjpa.ConnectionUserName=scott
-#openjpa.ConnectionPassword=tiger
-
-#----------------- JPA/Hibernate
-
-# JPA/Hibernate and Derby
-#hibernate.dialect=org.hibernate.dialect.DerbyDialect
-#hibernate.connection.driver_class=org.apache.derby.jdbc.ClientDriver
-#hibernate.connection.url=jdbc:derby://localhost:3219/planet
-#hibernate.connection.username=app
-#hibernate.connection.password=app
-
-# JPA/Hibernate and MySQL
-#hibernate.dialect=org.hibernate.dialect.MySQLDialect
-#hibernate.connection.driver_class=com.mysql.jdbc.Driver
-#hibernate.connection.url=jdbc:mysql://localhost/test_planet
-#hibernate.connection.username=roller
-#hibernate.connection.password=roller
-
+#openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE
\ No newline at end of file

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/testdata/planet-custom.properties Wed Mar  7 06:20:50 2007
@@ -14,3 +14,7 @@
 #jdbc.username=scott
 #jdbc.password=tiger
 #hibernate.dialect=org.hibernate.dialect.MySQLDialect
+#openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=false, UseClobs=true, SearchStringEscape=\\\\)
+
+#openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE
+

Modified: incubator/roller/branches/roller_4.0_newbackend/apps/planet/web/WEB-INF/classes/JPAEMF.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/apps/planet/web/WEB-INF/classes/JPAEMF.properties?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/apps/planet/web/WEB-INF/classes/JPAEMF.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/apps/planet/web/WEB-INF/classes/JPAEMF.properties Wed Mar  7 06:20:50 2007
@@ -14,10 +14,15 @@
 # copyright in this work, please see the NOTICE file in the top level
 # directory of this distribution.
 
-#openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=false, UseClobs=true, SearchStringEscape=\\\\)
+# JPA properties file
+#
+# You can set JPA/Toplink, JPA/OpenJPA and JPA/Hibernate properties in your
+# roller-custom.properties override file. For other JPA implementations set
+# properties here and Roller will pick them up.
 
+# Required properties for using OpenJPA with Roller
 openjpa.ConnectionFactoryName=java:comp/env/jdbc/rollerdb
 openjpa.IgnoreChanges=true
 openjpa.FlushBeforeQueries=true
-
 #openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE
+

Modified: incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/components/core/src/java/org/apache/roller/business/jpa/JPAPersistenceStrategy.java Wed Mar  7 06:20:50 2007
@@ -22,15 +22,11 @@
 import java.util.Collection;
 import java.util.Properties;
 import java.util.Iterator;
-import java.io.InputStream;
-import java.io.IOException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
-
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.EntityManager;
 import javax.persistence.FlushModeType;
@@ -60,22 +56,20 @@
      */
     private static Log logger = LogFactory.getFactory().getInstance(
             JPAPersistenceStrategy.class);
-    
+            
     /**
      * Construct by finding JPA EntityManagerFactory.
      * @throws org.apache.roller.RollerException on any error
      */
-    public JPAPersistenceStrategy(String puName) throws RollerException {
-        Properties emfProps = loadPropertiesFromResourceName(
-                "JPAEMF.properties", getContextClassLoader());
+    public JPAPersistenceStrategy(String puName, Properties emfProperties) throws RollerException {                   
         try {
-            this.emf = Persistence.createEntityManagerFactory(puName, emfProps);
+            this.emf = Persistence.createEntityManagerFactory(puName, emfProperties);
         } catch (PersistenceException pe) {
             logger.error("ERROR: creating entity manager", pe);
             throw new RollerException(pe);
         }
-    }
-    
+    }    
+        
     /**
      * Flush changes to the datastore, commit transaction, release em.
      * @throws org.apache.roller.RollerException on any error
@@ -221,7 +215,7 @@
         EntityManager em = getEntityManager(false);
         Query q = em.createNamedQuery(queryName);
         // Never flush for queries. Roller code assumes this behavior
-        //q.setFlushMode(FlushModeType.COMMIT);
+        q.setFlushMode(FlushModeType.COMMIT);
         return q;
     }
     
@@ -235,7 +229,7 @@
         EntityManager em = getEntityManager(false);
         Query q = em.createQuery(queryString);
         // Never flush for queries. Roller code assumes this behavior
-        //q.setFlushMode(FlushModeType.COMMIT);
+        q.setFlushMode(FlushModeType.COMMIT);
         return q;
     }
     
@@ -251,54 +245,6 @@
         Query q = em.createNamedQuery(queryName);
         return q;
     }
-    
-    
-    /**
-     * Loads properties from given resourceName using given class loader
-     * @param resourceName The name of the resource containing properties
-     * @param cl Classloeder to be used to locate the resouce
-     * @return A properties object
-     * @throws RollerException
-     */
-    private static Properties loadPropertiesFromResourceName(
-            String resourceName, ClassLoader cl) throws RollerException {
-        Properties props = new Properties();
-        InputStream in = null;
-        in = cl.getResourceAsStream(resourceName);
-        if (in == null) {
-            //TODO: Check how i18n is done in roller
-            throw new RollerException(
-                    "Could not locate properties to load " + resourceName);
-        }
-        try {
-            props.load(in);
-        } catch (IOException ioe) {
-            throw new RollerException(
-                    "Could not load properties from " + resourceName);
-        } finally {
-            if (in != null) {
-                try {
-                    in.close();
-                } catch (IOException ioe) {
-                }
-            }
-        }
-        
-        return props;
-    }
-    
-    /**
-     * Get the context class loader associated with the current thread. This is
-     * done in a doPrivileged block because it is a secure method.
-     * @return the current thread's context class loader.
-     */
-    private static ClassLoader getContextClassLoader() {
-        return (ClassLoader) AccessController.doPrivileged(
-                new PrivilegedAction() {
-            public Object run() {
-                return Thread.currentThread().getContextClassLoader();
-            }
-        });
-    }
+       
 }
 

Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java Wed Mar  7 06:20:50 2007
@@ -18,6 +18,13 @@
  */
 package org.apache.roller.business.jpa;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Enumeration;
+import java.util.Properties;
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
@@ -28,12 +35,12 @@
 import org.apache.roller.business.RollerImpl;
 import org.apache.roller.business.UserManager;
 import org.apache.roller.business.WeblogManager;
-import org.apache.roller.business.datamapper.jpa.JPARefererManager;
 import org.apache.roller.business.runnable.ThreadManager;
 import org.apache.roller.business.pings.AutoPingManager;
 import org.apache.roller.business.pings.PingQueueManager;
 import org.apache.roller.business.pings.PingTargetManager;
 import org.apache.roller.business.referrers.RefererManager;
+import org.apache.roller.config.RollerConfig;
 
 /**
  * A JPA specific implementation of the Roller business layer.
@@ -66,8 +73,54 @@
      * @throws org.apache.roller.RollerException on any error
      */
     protected JPARollerImpl() throws RollerException {
-        // set strategy used by JPA
-        strategy = new JPAPersistenceStrategy("RollerPU");
+        
+        // set strategy used by Datamapper
+        // You can configure JPA completely via the JPAEMF.properties file
+        Properties emfProps = loadPropertiesFromResourceName(
+           "JPAEMF.properties", getContextClassLoader());
+        
+        // Or add OpenJPA, Toplink and Hibernate properties to Roller config.
+        // These override properties set so far.
+        Enumeration keys = RollerConfig.keys();
+        while (keys.hasMoreElements()) {
+            String key = (String)keys.nextElement();
+            if (key.startsWith("openjpa.") || key.startsWith("toplink.")) {
+                String value = RollerConfig.getProperty(key);
+                logger.info(key + ": " + value);
+                emfProps.setProperty(key, value);
+            }
+        }
+
+        // Or, for plain-old JDBC, use Roller's jdbc properties and
+        // we'll convert them to OpenJPA, Toplink and Hibernate properties.
+        // These override properties set so far.
+        if (StringUtils.isNotEmpty(RollerConfig.getProperty("jdbc.driverClass"))) {
+            
+            String driver =   RollerConfig.getProperty("jdbc.driverClass");
+            String url =      RollerConfig.getProperty("jdbc.connectionURL");
+            String username = RollerConfig.getProperty("jdbc.username");
+            String password = RollerConfig.getProperty("jdbc.password");
+            logger.info("driverClass:    " + driver);
+            logger.info("connectionURL:  " + url);
+            logger.info("username:       " + username);         
+            
+            emfProps.setProperty("openjpa.ConnectionDriverName", driver);
+            emfProps.setProperty("openjpa.ConnectionURL", url);
+            emfProps.setProperty("openjpa.ConnectionUserName", username);
+            emfProps.setProperty("openjpa.ConnectionPassword", password); 
+           
+            emfProps.setProperty("toplink.jdbc.driver", driver);
+            emfProps.setProperty("toplink.jdbc.url", url);
+            emfProps.setProperty("toplink.jdbc.user", username);
+            emfProps.setProperty("toplink.jdbc.password", password);
+            
+            emfProps.setProperty("hibernate.connection.driver_class", driver);
+            emfProps.setProperty("hibernate.connection.url", url);
+            emfProps.setProperty("hibernate.connection.username", username);
+            emfProps.setProperty("hibernate.connection.password", password);      
+        } 
+        
+        strategy = new JPAPersistenceStrategy("RollerPU", emfProps);
     }
 
     protected UserManager createJPAUserManager(JPAPersistenceStrategy strategy) {
@@ -254,6 +307,55 @@
      */
     public ConfigManager getConfigManager() {
         throw new RuntimeException("Deprecated method getConfigManager.");
+    }
+    
+        
+    /**
+     * Loads properties from given resourceName using given class loader
+     * @param resourceName The name of the resource containing properties
+     * @param cl Classloeder to be used to locate the resouce
+     * @return A properties object
+     * @throws RollerException
+     */
+    private static Properties loadPropertiesFromResourceName(
+            String resourceName, ClassLoader cl) throws RollerException {
+        Properties props = new Properties();
+        InputStream in = null;
+        in = cl.getResourceAsStream(resourceName);
+        if (in == null) {
+            //TODO: Check how i18n is done in roller
+            throw new RollerException(
+                    "Could not locate properties to load " + resourceName);
+        }
+        try {
+            props.load(in);
+        } catch (IOException ioe) {
+            throw new RollerException(
+                    "Could not load properties from " + resourceName);
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException ioe) {
+                }
+            }
+        }
+        
+        return props;
+    }
+    
+    /**
+     * Get the context class loader associated with the current thread. This is
+     * done in a doPrivileged block because it is a secure method.
+     * @return the current thread's context class loader.
+     */
+    private static ClassLoader getContextClassLoader() {
+        return (ClassLoader) AccessController.doPrivileged(
+                new PrivilegedAction() {
+            public Object run() {
+                return Thread.currentThread().getContextClassLoader();
+            }
+        });
     }
     
 }

Modified: incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/testdata/WEB-INF/classes/JPAEMF.properties Wed Mar  7 06:20:50 2007
@@ -1,51 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  The ASF licenses this file to You
+# under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.  For additional information regarding
+# copyright in this work, please see the NOTICE file in the top level
+# directory of this distribution.
+
+# JPA properties file
+#
+# You can set JPA/Toplink, JPA/OpenJPA and JPA/Hibernate properties in your
+# roller-custom.properties override file. For other JPA implementations set
+# properties here and Roller will pick them up.
 
-#----------------- JPA/Toplink
-
-# JPA/TopLink and Derby
-#toplink.jdbc.driver=org.apache.derby.jdbc.ClientDriver
-#toplink.jdbc.url=jdbc:derby://localhost:3219/roller
-#toplink.jdbc.user=APP
-#toplink.jdbc.password=APP
-
-# JPA/TopLink and MySQL
-#toplink.jdbc.driver=com.mysql.jdbc.Driver
-#toplink.jdbc.url=jdbc:mysql://localhost/roller
-#toplink.jdbc.user=roller
-#toplink.jdbc.password=roller
-
-
-#----------------- JPA/OpenJPA
-
+# Required properties for using OpenJPA with Roller
 openjpa.IgnoreChanges=true
 openjpa.FlushBeforeQueries=true
-#openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE
-
-# OpenJPA and Derby
-openjpa.ConnectionDriverName=org.apache.derby.jdbc.ClientDriver
-openjpa.ConnectionURL=jdbc:derby://localhost:3219/roller
-openjpa.ConnectionUserName=APP
-openjpa.ConnectionPassword=APP
-
-# OpenJPA and MySQL
-#openjpa.ConnectionDriverName=com.mysql.jdbc.Driver
-#openjpa.ConnectionURL=jdbc:mysql://localhost:3306/rollertest
-#openjpa.ConnectionUserName=scott
-#openjpa.ConnectionPassword=tiger
-#openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=false, UseClobs=true, SearchStringEscape=\\\\)
-
-
-#----------------- JPA/Hibernate
-
-# JPA/Hibernate and Derby
-#hibernate.dialect=org.hibernate.dialect.DerbyDialect
-#hibernate.connection.driver_class=org.apache.derby.jdbc.ClientDriver
-#hibernate.connection.url=jdbc:derby://localhost:3219/roller
-#hibernate.connection.username=app
-#hibernate.connection.password=app
-
-# JPA/Hibernate and MySQL
-#hibernate.dialect=org.hibernate.dialect.MySQLDialect
-#hibernate.connection.driver_class=com.mysql.jdbc.Driver
-#hibernate.connection.url=jdbc:mysql://localhost/roller
-#hibernate.connection.username=roller
-#hibernate.connection.password=roller
+#openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE
\ No newline at end of file

Modified: incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/testdata/roller-custom.properties Wed Mar  7 06:20:50 2007
@@ -22,4 +22,6 @@
 #jdbc.username=scott
 #jdbc.password=tiger
 #hibernate.dialect=org.hibernate.dialect.MySQLDialect
+#openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=false, UseClobs=true, SearchStringEscape=\\\\)
 
+#openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE

Modified: incubator/roller/branches/roller_4.0_newbackend/tools/roller-core/roller-core.jar
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/tools/roller-core/roller-core.jar?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
Binary files - no diff available.

Modified: incubator/roller/branches/roller_4.0_newbackend/tools/roller-planet/roller-planet-business.jar
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/tools/roller-planet/roller-planet-business.jar?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
Binary files - no diff available.

Modified: incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/JPAEMF.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/JPAEMF.properties?view=diff&rev=515580&r1=515579&r2=515580
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/JPAEMF.properties (original)
+++ incubator/roller/branches/roller_4.0_newbackend/web/WEB-INF/classes/JPAEMF.properties Wed Mar  7 06:20:50 2007
@@ -14,11 +14,14 @@
 # copyright in this work, please see the NOTICE file in the top level
 # directory of this distribution.
 
-#openjpa.jdbc.DBDictionary=mysql(SupportsSubselect=false, UseClobs=true, SearchStringEscape=\\\\)
+# JPA properties file
+#
+# You can set JPA/Toplink, JPA/OpenJPA and JPA/Hibernate properties in your
+# roller-custom.properties override file. For other JPA implementations set
+# properties here and Roller will pick them up.
 
+# Required properties for using OpenJPA with Roller
 openjpa.ConnectionFactoryName=java:comp/env/jdbc/rollerdb
 openjpa.IgnoreChanges=true
 openjpa.FlushBeforeQueries=true
-
-openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO
 #openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE