roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r541458 [2/7] - in /roller/trunk: ./ apps/planet/ apps/planet/nbproject/ apps/planet/src/java/META-INF/ apps/planet/src/java/org/apache/roller/planet/business/ apps/planet/src/java/org/apache/roller/planet/business/hibernate/ apps/planet/sr...
Date Thu, 24 May 2007 22:25:15 GMT
Added: roller/trunk/apps/planet/velocity.log
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/velocity.log?view=auto&rev=541458
==============================================================================
--- roller/trunk/apps/planet/velocity.log (added)
+++ roller/trunk/apps/planet/velocity.log Thu May 24 15:25:10 2007
@@ -0,0 +1,150 @@
+2007-05-24 16:36:03,527 - Log4JLogChute initialized using file 'velocity.log'
+2007-05-24 16:36:03,527 - The version of log4j being used does not support the "trace" level.
+2007-05-24 16:36:03,527 - *******************************************************************
+2007-05-24 16:36:03,527 - Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
+2007-05-24 16:36:03,527 - RuntimeInstance initializing.
+2007-05-24 16:36:03,527 - Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
+2007-05-24 16:36:03,527 - Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
+2007-05-24 16:36:03,530 - Couldn't find class org.apache.velocity.runtime.log.AvalonLogChute or necessary supporting classes in classpath.
+java.lang.NoClassDefFoundError: org/apache/log/format/Formatter
+	at java.lang.Class.forName0(Native Method)
+	at java.lang.Class.forName(Class.java:164)
+	at org.apache.velocity.util.ClassUtils.getClass(ClassUtils.java:76)
+	at org.apache.velocity.util.ClassUtils.getNewInstance(ClassUtils.java:95)
+	at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:147)
+	at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:208)
+	at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:728)
+	at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:240)
+	at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:116)
+	at org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.java:483)
+	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
+	at org.apache.tools.ant.Task.perform(Task.java:364)
+	at org.apache.tools.ant.Target.execute(Target.java:341)
+	at org.apache.tools.ant.Target.performTasks(Target.java:369)
+	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
+	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
+	at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
+	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
+	at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
+	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
+	at org.apache.tools.ant.Task.perform(Task.java:364)
+	at org.apache.tools.ant.Target.execute(Target.java:341)
+	at org.apache.tools.ant.Target.performTasks(Target.java:369)
+	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
+	at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
+	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
+	at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
+	at org.apache.tools.ant.Main.runBuild(Main.java:668)
+	at org.apache.tools.ant.Main.startAnt(Main.java:187)
+	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
+	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
+2007-05-24 16:36:03,531 - Trying to use logger class org.apache.velocity.runtime.log.Log4JLogChute
+2007-05-24 16:36:03,531 - Using logger class org.apache.velocity.runtime.log.Log4JLogChute
+2007-05-24 16:36:03,534 - Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
+2007-05-24 16:36:03,538 - ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,542 - ClasspathResourceLoader : initialization complete.
+2007-05-24 16:36:03,558 - ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
+2007-05-24 16:36:03,558 - Default ResourceManager initialization complete.
+2007-05-24 16:36:03,560 - Loaded System Directive: org.apache.velocity.runtime.directive.Literal
+2007-05-24 16:36:03,564 - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
+2007-05-24 16:36:03,566 - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
+2007-05-24 16:36:03,568 - Loaded System Directive: org.apache.velocity.runtime.directive.Include
+2007-05-24 16:36:03,570 - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
+2007-05-24 16:36:03,615 - Created '20' parsers.
+2007-05-24 16:36:03,629 - Velocimacro : initialization starting.
+2007-05-24 16:36:03,629 - Velocimacro : "velocimacro.library" is not set.  Trying default library: VM_global_library.vm
+2007-05-24 16:36:03,630 - Velocimacro : Default library not found.
+2007-05-24 16:36:03,630 - Velocimacro : allowInline = true : VMs can be defined inline in templates
+2007-05-24 16:36:03,630 - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
+2007-05-24 16:36:03,630 - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
+2007-05-24 16:36:03,630 - Velocimacro : autoload off : VM system will not automatically reload global library macros
+2007-05-24 16:36:03,630 - Velocimacro : Velocimacro : initialization complete.
+2007-05-24 16:36:03,630 - RuntimeInstance successfully initialized.
+2007-05-24 16:36:03,667 - ResourceManager : found control.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,677 - Velocimacro : added #addColumnNull(  table column type ) : source = macros.vm
+2007-05-24 16:36:03,684 - Velocimacro : added #addColumnNotNull(  table column type default ) : source = macros.vm
+2007-05-24 16:36:03,685 - Velocimacro : added #dropNotNullFromTableId(  table ) : source = macros.vm
+2007-05-24 16:36:03,687 - Velocimacro : added #longtext(  size ) : source = macros.vm
+2007-05-24 16:36:03,687 - ResourceManager : found macros.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,706 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,713 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,719 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,723 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,725 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,728 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 16:36:03,733 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,635 - Log4JLogChute initialized using file 'velocity.log'
+2007-05-24 17:31:56,635 - The version of log4j being used does not support the "trace" level.
+2007-05-24 17:31:56,635 - *******************************************************************
+2007-05-24 17:31:56,635 - Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
+2007-05-24 17:31:56,635 - RuntimeInstance initializing.
+2007-05-24 17:31:56,635 - Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
+2007-05-24 17:31:56,635 - Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
+2007-05-24 17:31:56,638 - Couldn't find class org.apache.velocity.runtime.log.AvalonLogChute or necessary supporting classes in classpath.
+java.lang.NoClassDefFoundError: org/apache/log/format/Formatter
+	at java.lang.Class.forName0(Native Method)
+	at java.lang.Class.forName(Class.java:164)
+	at org.apache.velocity.util.ClassUtils.getClass(ClassUtils.java:76)
+	at org.apache.velocity.util.ClassUtils.getNewInstance(ClassUtils.java:95)
+	at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:147)
+	at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:208)
+	at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:728)
+	at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:240)
+	at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:116)
+	at org.apache.velocity.texen.ant.TexenTask.execute(TexenTask.java:483)
+	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
+	at org.apache.tools.ant.Task.perform(Task.java:364)
+	at org.apache.tools.ant.Target.execute(Target.java:341)
+	at org.apache.tools.ant.Target.performTasks(Target.java:369)
+	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
+	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
+	at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
+	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
+	at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
+	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
+	at org.apache.tools.ant.Task.perform(Task.java:364)
+	at org.apache.tools.ant.Target.execute(Target.java:341)
+	at org.apache.tools.ant.Target.performTasks(Target.java:369)
+	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
+	at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
+	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
+	at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
+	at org.apache.tools.ant.Main.runBuild(Main.java:668)
+	at org.apache.tools.ant.Main.startAnt(Main.java:187)
+	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
+	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
+2007-05-24 17:31:56,640 - Trying to use logger class org.apache.velocity.runtime.log.Log4JLogChute
+2007-05-24 17:31:56,640 - Using logger class org.apache.velocity.runtime.log.Log4JLogChute
+2007-05-24 17:31:56,643 - Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
+2007-05-24 17:31:56,646 - ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,648 - ClasspathResourceLoader : initialization complete.
+2007-05-24 17:31:56,667 - ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
+2007-05-24 17:31:56,667 - Default ResourceManager initialization complete.
+2007-05-24 17:31:56,669 - Loaded System Directive: org.apache.velocity.runtime.directive.Literal
+2007-05-24 17:31:56,671 - Loaded System Directive: org.apache.velocity.runtime.directive.Macro
+2007-05-24 17:31:56,673 - Loaded System Directive: org.apache.velocity.runtime.directive.Parse
+2007-05-24 17:31:56,676 - Loaded System Directive: org.apache.velocity.runtime.directive.Include
+2007-05-24 17:31:56,677 - Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
+2007-05-24 17:31:56,727 - Created '20' parsers.
+2007-05-24 17:31:56,740 - Velocimacro : initialization starting.
+2007-05-24 17:31:56,740 - Velocimacro : "velocimacro.library" is not set.  Trying default library: VM_global_library.vm
+2007-05-24 17:31:56,741 - Velocimacro : Default library not found.
+2007-05-24 17:31:56,741 - Velocimacro : allowInline = true : VMs can be defined inline in templates
+2007-05-24 17:31:56,741 - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
+2007-05-24 17:31:56,741 - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
+2007-05-24 17:31:56,741 - Velocimacro : autoload off : VM system will not automatically reload global library macros
+2007-05-24 17:31:56,741 - Velocimacro : Velocimacro : initialization complete.
+2007-05-24 17:31:56,741 - RuntimeInstance successfully initialized.
+2007-05-24 17:31:56,839 - ResourceManager : found control.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,851 - Velocimacro : added #addColumnNull(  table column type ) : source = macros.vm
+2007-05-24 17:31:56,857 - Velocimacro : added #addColumnNotNull(  table column type default ) : source = macros.vm
+2007-05-24 17:31:56,859 - Velocimacro : added #dropNotNullFromTableId(  table ) : source = macros.vm
+2007-05-24 17:31:56,860 - Velocimacro : added #longtext(  size ) : source = macros.vm
+2007-05-24 17:31:56,860 - ResourceManager : found macros.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,877 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,886 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,892 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,896 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,898 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,901 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+2007-05-24 17:31:56,905 - ResourceManager : found createdb.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

Added: roller/trunk/apps/planet/web/WEB-INF/classes/JPAEMF.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/web/WEB-INF/classes/JPAEMF.properties?view=auto&rev=541458
==============================================================================
--- roller/trunk/apps/planet/web/WEB-INF/classes/JPAEMF.properties (added)
+++ roller/trunk/apps/planet/web/WEB-INF/classes/JPAEMF.properties Thu May 24 15:25:10 2007
@@ -0,0 +1,27 @@
+# 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.
+
+# Required properties for using OpenJPA with Roller
+openjpa.IgnoreChanges=true
+openjpa.FlushBeforeQueries=true
+#openjpa.Log=DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE
+

Modified: roller/trunk/build.xml
URL: http://svn.apache.org/viewvc/roller/trunk/build.xml?view=diff&rev=541458&r1=541457&r2=541458
==============================================================================
--- roller/trunk/build.xml (original)
+++ roller/trunk/build.xml Thu May 24 15:25:10 2007
@@ -163,6 +163,31 @@
                      excludes="**/*.java, **/*.html, **/*.png, org/apache/roller/ui/**, org/apache/roller/webservices/**, org/apache/roller/planet/**" />
         </copy>
         
+        <mkdir dir="${build.compile.business}/META-INF" />
+        <copy todir="${build.compile.business}/META-INF" file="${ro.src}/META-INF/persistence.xml" />
+
+        <!-- OpenJPA bytecode enhancement  -->
+        <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="business.path" />
+        <openjpac>
+            <config propertiesFile="${ro.src}/META-INF/persistence.xml" />
+            <classpath>
+                <path refid="business.path"/>
+                <pathelement location="${build.compile.business}" />
+                <pathelement location="${build.compile.business}/org/apache/roller/pojos" />
+                &custom-jars;
+            </classpath>
+        </openjpac>
+
+        <!-- JPA/Toplink bytecode enhancement
+        <taskdef name="weave" classname="oracle.toplink.essentials.weaving.StaticWeaveAntTask" classpathref="business.path"/>
+        <weave  source="${build.compile.business}" target="${build.compile.business}">
+            <classpath>
+                <path refid="business.path"/>
+                <pathelement location="${build.compile.business}" />
+                <pathelement location="${build.compile.business}/org/apache/roller/pojos" />
+            </classpath>
+        </weave> -->  
+    
         <!-- allow for custom build work -->
         &custom-build-business;
         
@@ -227,12 +252,14 @@
             <fileset refid="presentation.jars" />
             <fileset refid="hibernate.jar" />
             <fileset refid="hibernate.jars" />
+            <fileset refid="jpa.jars" />
             <fileset refid="struts.jars" />
             <fileset refid="struts2.jars" />
             <fileset refid="spring.jars" /> 
             <fileset refid="jstl.jars" />
             <fileset refid="xmlrpc.jars" />
             
+            <fileset refid="roller-core.jars" />
             <fileset refid="roller-planet.jars" />
             
             <!-- include custom jars -->

Added: roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/HibernatePersistenceStrategy$1.class
URL: http://svn.apache.org/viewvc/roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/HibernatePersistenceStrategy%241.class?view=auto&rev=541458
==============================================================================
Binary file - no diff available.

Propchange: roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/HibernatePersistenceStrategy$1.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.class
URL: http://svn.apache.org/viewvc/roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.class?view=auto&rev=541458
==============================================================================
Binary file - no diff available.

Propchange: roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose$NoCleanupSynch.class
URL: http://svn.apache.org/viewvc/roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose%24NoCleanupSynch.class?view=auto&rev=541458
==============================================================================
Binary file - no diff available.

Propchange: roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose$NoCleanupSynch.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.class
URL: http://svn.apache.org/viewvc/roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.class?view=auto&rev=541458
==============================================================================
Binary file - no diff available.

Propchange: roller/trunk/components/core/build/compile/business/org/apache/roller/business/hibernate/ThreadLocalSessionContextNoAutoClose.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: roller/trunk/components/core/build/compile/business/org/apache/roller/business/jpa/JPAPersistenceStrategy$1.class
URL: http://svn.apache.org/viewvc/roller/trunk/components/core/build/compile/business/org/apache/roller/business/jpa/JPAPersistenceStrategy%241.class?view=auto&rev=541458
==============================================================================
Binary file - no diff available.

Propchange: roller/trunk/components/core/build/compile/business/org/apache/roller/business/jpa/JPAPersistenceStrategy$1.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: roller/trunk/components/core/build/compile/business/org/apache/roller/business/jpa/JPAPersistenceStrategy.class
URL: http://svn.apache.org/viewvc/roller/trunk/components/core/build/compile/business/org/apache/roller/business/jpa/JPAPersistenceStrategy.class?view=auto&rev=541458
==============================================================================
Binary file - no diff available.

Propchange: roller/trunk/components/core/build/compile/business/org/apache/roller/business/jpa/JPAPersistenceStrategy.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: roller/trunk/components/core/build/compile/business/org/apache/roller/util/UUIDGenerator.class
URL: http://svn.apache.org/viewvc/roller/trunk/components/core/build/compile/business/org/apache/roller/util/UUIDGenerator.class?view=auto&rev=541458
==============================================================================
Binary file - no diff available.

Propchange: roller/trunk/components/core/build/compile/business/org/apache/roller/util/UUIDGenerator.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: roller/trunk/components/core/build/lib/roller-core.jar
URL: http://svn.apache.org/viewvc/roller/trunk/components/core/build/lib/roller-core.jar?view=auto&rev=541458
==============================================================================
Binary file - no diff available.

Propchange: roller/trunk/components/core/build/lib/roller-core.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: roller/trunk/nbproject/project.xml
URL: http://svn.apache.org/viewvc/roller/trunk/nbproject/project.xml?view=diff&rev=541458&r1=541457&r2=541458
==============================================================================
--- roller/trunk/nbproject/project.xml (original)
+++ roller/trunk/nbproject/project.xml Thu May 24 15:25:10 2007
@@ -5,13 +5,6 @@
         <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
             <!--Do not use Project Properties customizer when editing this file manually.-->
             <name>roller_trunk</name>
-            <!--
-            <properties>
-                <property name="src.dir">../src</property>
-                <property name="test.dir">${project.dir}/tests</property>
-                <property name="planetroller.test.dir">${project.dir}/sandbox/planetroller/test</property>
-            </properties>
--->
             <folders>
                 <source-folder>
                     <label>web</label>
@@ -34,14 +27,9 @@
                     <location>apps/planet/src/java</location>
                 </source-folder>
                 <source-folder>
-                    <label>apps/planet/test/java</label>
+                    <label>components/core/src/java</label>
                     <type>java</type>
-                    <location>apps/planet/test/java</location>
-                </source-folder>
-                <source-folder>
-                    <label>sandbox/standalone/src</label>
-                    <type>java</type>
-                    <location>sandbox/standalone/src</location>
+                    <location>components/core/src/java</location>
                 </source-folder>
                 <source-folder>
                     <label>sandbox/scripting/bsf/src</label>
@@ -54,32 +42,23 @@
                     <location>sandbox/scripting/groovy/src</location>
                 </source-folder>
                 <source-folder>
-                    <label>sandbox/scripting/jruby/src</label>
-                    <type>java</type>
-                    <location>sandbox/scripting/jruby/src</location>
-                </source-folder>
-                <source-folder>
-                    <label>generated/web</label>
-                    <type>java</type>
-                    <location>build/generated/web</location>
-                </source-folder>
-                <source-folder>
-                    <label>generated/business</label>
+                    <label>build/generated/business</label>
                     <type>java</type>
                     <location>build/generated/business</location>
                 </source-folder>
                 <source-folder>
-                    <label>custom/src</label>
+                    <label>build/generated/web</label>
                     <type>java</type>
-                    <location>custom/src</location>
+                    <location>build/generated/web</location>
                 </source-folder>
             </folders>
             <ide-actions>
                 <action name="build">
-                    <target>stage-webapp</target>
+                    <target>build</target>
                 </action>
                 <action name="clean">
-                    <target>rebuild</target>
+                    <target>clean</target>
+                    <target>all</target>
                 </action>
                 <action name="javadoc">
                     <target>javadoc</target>
@@ -88,8 +67,9 @@
                     <target>tests</target>
                 </action>
                 <action name="rebuild">
-                    <target>rebuild</target>
-                    <target>stage-webapp</target>
+                    <target>clean</target>
+                    <target>all</target>
+                    <target>build</target>
                 </action>
                 <action name="debug.single">
                     <target>debug-selected-files</target>
@@ -119,19 +99,6 @@
                     <script>nbproject/ide-targets.xml</script>
                     <target>debug-nb</target>
                 </action>
-                <action name="debug.single">
-                    <script>nbproject/ide-file-targets.xml</script>
-                    <target>debug-selected-file-in-tests</target>
-                    <context>
-                        <property>debug.class</property>
-                        <folder>tests</folder>
-                        <pattern>\.java$</pattern>
-                        <format>java-name</format>
-                        <arity>
-                            <one-file-only/>
-                        </arity>
-                    </context>
-                </action>
             </ide-actions>
             <view>
                 <items>
@@ -152,12 +119,8 @@
                         <location>apps/planet/src/java</location>
                     </source-folder>
                     <source-folder style="packages">
-                        <label>apps/planet/test/java</label>
-                        <location>apps/planet/test/java</location>
-                    </source-folder>
-                    <source-folder style="packages">
-                        <label>sandbox/standalone/src</label>
-                        <location>sandbox/standalone/src</location>
+                        <label>components/core/src/java</label>
+                        <location>components/core/src/java</location>
                     </source-folder>
                     <source-folder style="packages">
                         <label>sandbox/scripting/bsf/src</label>
@@ -168,20 +131,12 @@
                         <location>sandbox/scripting/groovy/src</location>
                     </source-folder>
                     <source-folder style="packages">
-                        <label>sandbox/scripting/jruby/src</label>
-                        <location>sandbox/scripting/jruby/src</location>
-                    </source-folder>
-                    <source-folder style="packages">
-                        <label>generated/web</label>
-                        <location>build/generated/web</location>
-                    </source-folder>
-                    <source-folder style="packages">
-                        <label>generated/business</label>
+                        <label>build/generated/business</label>
                         <location>build/generated/business</location>
                     </source-folder>
                     <source-folder style="packages">
-                        <label>custom/src</label>
-                        <location>custom/src</location>
+                        <label>build/generated/web</label>
+                        <location>build/generated/web</location>
                     </source-folder>
                     <source-file>
                         <location>build.xml</location>
@@ -200,14 +155,14 @@
         </general-data>
         <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
             <compilation-unit>
+                <package-root>components/core/src/java</package-root>
                 <package-root>src</package-root>
-                <package-root>sandbox/standalone/src</package-root>
-                <package-root>tests</package-root>
-                <package-root>build/generated/web</package-root>
                 <package-root>build/generated/business</package-root>
+                <package-root>build/generated/web</package-root>
+                <package-root>tests</package-root>
                 <package-root>apps/planet/src/java</package-root>
                 <package-root>apps/planet/test/java</package-root>
-                <package-root>sandbox/scripting/groovy/src</package-root>
+                <package-root>sandbox/jdobackend/src</package-root>
                 <package-root>sandbox/scripting/bsf/src</package-root>
                 <package-root>custom/src</package-root>
                 <package-root>sandbox/scripting/jruby/src</package-root>

Modified: roller/trunk/properties.xmlf
URL: http://svn.apache.org/viewvc/roller/trunk/properties.xmlf?view=diff&rev=541458&r1=541457&r2=541458
==============================================================================
--- roller/trunk/properties.xmlf (original)
+++ roller/trunk/properties.xmlf Thu May 24 15:25:10 2007
@@ -54,7 +54,12 @@
 
 <!-- various libraries used by Roller -->
 <property name="tools.struts"        value="${ro.tools}/struts-1.2.4" />
+<property name="tools.struts2"       value="${ro.tools}/struts-2.0.5" />
 <property name="tools.hibernate"     value="${ro.tools}/hibernate-3.1" />
+<property name="tools.jpa"           value="${ro.tools}/openjpa-0.9.7" />
+<!-- 
+<property name="tools.jpa"           value="${ro.tools}/toplink-essentials-9.1" />
+-->
 <property name="tools.spring"        value="${ro.tools}/spring-1.2" />
 <property name="tools.jstl"          value="${ro.tools}/jakarta-taglibs-standard-1.1.2" />
 <property name="tools.xdoclet"       value="${ro.tools}/buildtime/xdoclet-1.2.3" />
@@ -81,12 +86,13 @@
 <!-- **************************************************************** -->
 
 <fileset id="base.jars" dir="${ro.tools}/lib">
+    <include name="commons-id-0.1-SNAPSHOT.jar"/>
     <include name="commons-betwixt-1.0-beta-1.jar" />
     <include name="commons-cache.jar" />
+    <include name="commons-collections-3.2.jar" />
     <include name="commons-codec-1.3.jar" />
     <include name="commons-logging-1.0.4.jar" />
     <include name="commons-lang-2.1.jar" />
-    <include name="commons-collections-3.1.jar" />
     <include name="concurrent-1.3.2.jar"/>
     <include name="jaxen-full.jar" />
     <include name="saxpath.jar" />
@@ -143,6 +149,10 @@
     <include name="*.jar"/>
 </fileset>
 
+<fileset id="jpa.jars" dir="${tools.jpa}">
+    <include name="*.jar"/>
+</fileset>
+
 <fileset id="spring.jars" dir="${tools.spring}">
     <include name="*.jar"/>
 </fileset>
@@ -154,6 +164,10 @@
     <include name="xmlrpc-server-3.0.jar"/>
 </fileset>
 
+<fileset id="roller-core.jars" dir="${ro.tools}/roller-core">
+    <include name="*.jar"/>
+</fileset>
+
 <fileset id="roller-planet.jars" dir="${ro.tools}/roller-planet">
     <include name="*.jar"/>
 </fileset>
@@ -166,8 +180,11 @@
 <path id="base.path">
     <fileset refid="base.jars"/>
     <fileset refid="mail.jars"/>
+    <fileset refid="roller-core.jars" />
     <fileset refid="roller-planet.jars" />
     <fileset refid="xmlrpc.jars"/>
+    <!-- JPA bytecode enhancement apparently wants JPA classes everywhere -->
+    <fileset refid="jpa.jars" />
 </path>
 
 <path id="business.path">

Modified: roller/trunk/sandbox/scripting/bsf/build.xml
URL: http://svn.apache.org/viewvc/roller/trunk/sandbox/scripting/bsf/build.xml?view=diff&rev=541458&r1=541457&r2=541458
==============================================================================
--- roller/trunk/sandbox/scripting/bsf/build.xml (original)
+++ roller/trunk/sandbox/scripting/bsf/build.xml Thu May 24 15:25:10 2007
@@ -6,6 +6,7 @@
         
     <path id="scripting.path">
         <fileset dir="${rollersrc.dir}/build/webapp/WEB-INF/lib">   
+            <include name="roller-core.jar"/>   
             <include name="roller-web.jar"/>   
             <include name="roller-business.jar"/>   
             <include name="commons-logging.jar"/>   

Modified: roller/trunk/src/org/apache/roller/business/DatabaseProvider.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/DatabaseProvider.java?view=diff&rev=541458&r1=541457&r2=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/DatabaseProvider.java (original)
+++ roller/trunk/src/org/apache/roller/business/DatabaseProvider.java Thu May 24 15:25:10 2007
@@ -32,7 +32,7 @@
  */
 public class DatabaseProvider  {
     private static Log log = LogFactory.getLog(DatabaseProvider.class);
-    private enum ConfigurationType {JNDI_NAME, JDBC_PROPERTIES;}
+    public enum ConfigurationType {JNDI_NAME, JDBC_PROPERTIES;}
     
     private static DatabaseProvider singletonInstance = null;
     
@@ -65,22 +65,22 @@
         jdbcPassword =      RollerConfig.getProperty("database.jdbc.password");
         
         // init now so we fail early
-        if (type == ConfigurationType.JDBC_PROPERTIES) {
+        if (getType() == ConfigurationType.JDBC_PROPERTIES) {
             log.info("Using 'jdbc' properties based configuration");
             try {
-                Class.forName(jdbcDriverClass);
+                Class.forName(getJdbcDriverClass());
             } catch (ClassNotFoundException ex) {
                 throw new RollerException(
-                   "Cannot load specified JDBC driver class [" +jdbcDriverClass+ "]", ex);
+                   "Cannot load specified JDBC driver class [" +getJdbcDriverClass()+ "]", ex);
             }
-            if (jdbcUsername != null || jdbcPassword != null) {
+            if (getJdbcUsername() != null || getJdbcPassword() != null) {
                 props = new Properties();
-                if (jdbcUsername != null) props.put("user", jdbcUsername);
-                if (jdbcPassword != null) props.put("password", jdbcPassword);
+                if (getJdbcUsername() != null) props.put("user", getJdbcUsername());
+                if (getJdbcPassword() != null) props.put("password", getJdbcPassword());
             }
         } else {
             log.info("Using 'jndi' based configuration");
-            String name = "java:comp/env/" + jndiName;
+            String name = "java:comp/env/" + getJndiName();
             try {
                 InitialContext ic = new InitialContext();
                 dataSource = (DataSource)ic.lookup(name);
@@ -112,10 +112,34 @@
      * on which is configured.
      */
     public Connection getConnection() throws SQLException {
-        if (type == ConfigurationType.JDBC_PROPERTIES) {
-            return DriverManager.getConnection(jdbcConnectionURL, props);
+        if (getType() == ConfigurationType.JDBC_PROPERTIES) {
+            return DriverManager.getConnection(getJdbcConnectionURL(), props);
         } else {
             return dataSource.getConnection();
         }
     } 
+
+    public ConfigurationType getType() {
+        return type;
+    }
+
+    public String getJndiName() {
+        return jndiName;
+    }
+
+    public String getJdbcDriverClass() {
+        return jdbcDriverClass;
+    }
+
+    public String getJdbcConnectionURL() {
+        return jdbcConnectionURL;
+    }
+
+    public String getJdbcPassword() {
+        return jdbcPassword;
+    }
+
+    public String getJdbcUsername() {
+        return jdbcUsername;
+    }
 }

Modified: roller/trunk/src/org/apache/roller/business/RollerFactory.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/RollerFactory.java?view=diff&rev=541458&r1=541457&r2=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/RollerFactory.java (original)
+++ roller/trunk/src/org/apache/roller/business/RollerFactory.java Thu May 24 15:25:10 2007
@@ -31,7 +31,9 @@
     private static Log log = LogFactory.getLog(RollerFactory.class);
     
     private static final String DEFAULT_IMPL =
-            "org.apache.roller.business.hibernate.HibernateRollerImpl";
+        "org.apache.roller.business.jpa.JPARollerImpl";
+        //"org.apache.roller.business.hibernate.HibernateRollerImpl";
+        //"org.apache.roller.business.datamapper.jpa.JPARollerImpl";
     
     private static Roller rollerInstance = null;
     

Modified: roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java?view=diff&rev=541458&r1=541457&r2=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java (original)
+++ roller/trunk/src/org/apache/roller/business/hibernate/HibernateBookmarkManagerImpl.java Thu May 24 15:25:10 2007
@@ -93,7 +93,8 @@
     
     public void saveFolder(FolderData folder) throws RollerException {
         
-        if(folder.getId() == null && isDuplicateFolderName(folder)) {
+        FolderData existingFolder = getFolder(folder.getId());        
+        if(existingFolder == null && isDuplicateFolderName(folder)) {
             throw new RollerException("Duplicate folder name");
         }
         

Modified: roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java?view=diff&rev=541458&r1=541457&r2=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java (original)
+++ roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java Thu May 24 15:25:10 2007
@@ -33,7 +33,7 @@
 import org.apache.roller.business.UserManager;
 import org.apache.roller.business.WeblogManager;
 import org.apache.roller.business.runnable.ThreadManager;
-
+import org.apache.roller.business.hibernate.HibernatePersistenceStrategy;
 
 /**
  * A Hibernate specific implementation of the Roller business layer.

Added: roller/trunk/src/org/apache/roller/business/jpa/JPAAutoPingManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/jpa/JPAAutoPingManagerImpl.java?view=auto&rev=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/jpa/JPAAutoPingManagerImpl.java (added)
+++ roller/trunk/src/org/apache/roller/business/jpa/JPAAutoPingManagerImpl.java Thu May 24 15:25:10 2007
@@ -0,0 +1,145 @@
+
+/*
+ * 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.
+ */
+package org.apache.roller.business.jpa;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.business.RollerFactory;
+import org.apache.roller.business.pings.AutoPingManager;
+import org.apache.roller.business.pings.PingQueueManager;
+import org.apache.roller.config.PingConfig;
+import org.apache.roller.pojos.AutoPingData;
+import org.apache.roller.pojos.PingTargetData;
+import org.apache.roller.pojos.WeblogEntryData;
+import org.apache.roller.pojos.WebsiteData;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import javax.persistence.Query;
+
+/*
+ * JPAAutoPingManagerImpl.java
+ *
+ * Created on May 29, 2006, 11:29 AM
+ *
+ */
+public class JPAAutoPingManagerImpl implements AutoPingManager {
+
+    private JPAPersistenceStrategy strategy;
+    
+    /**
+     * The logger instance for this class.
+     */
+    private static Log logger = LogFactory
+            .getFactory().getInstance(JPAAutoPingManagerImpl.class);
+
+    /**
+     * Creates a new instance of JPAAutoPingManagerImpl
+     */
+    public JPAAutoPingManagerImpl
+            (JPAPersistenceStrategy strategy) {
+        this.strategy = strategy;
+    }
+
+    public AutoPingData getAutoPing(String id) throws RollerException {
+        return (AutoPingData)strategy.load(AutoPingData.class, id);
+    }
+
+    public void saveAutoPing(AutoPingData autoPing) throws RollerException {
+        strategy.store(autoPing);
+    }
+
+    public void removeAutoPing(AutoPingData autoPing) throws RollerException {
+        strategy.remove(autoPing);
+    }
+
+    public void removeAutoPing(PingTargetData pingTarget, WebsiteData website)
+            throws RollerException {
+        Query q = strategy.getNamedUpdate("AutoPingData.removeByPingTarget&Website");
+        q.setParameter(1, pingTarget);
+        q.setParameter(2, website);
+        q.executeUpdate();
+    }
+
+    public void removeAutoPings(Collection autopings) 
+            throws RollerException {
+        strategy.removeAll(autopings);
+    }
+
+    public void removeAllAutoPings() 
+            throws RollerException {
+        Query q = strategy.getNamedUpdate("AutoPingData.getAll");
+        removeAutoPings(q.getResultList());
+    }
+
+    public void queueApplicableAutoPings(WeblogEntryData changedWeblogEntry)
+            throws RollerException {
+        if (PingConfig.getSuspendPingProcessing()) {
+            if (logger.isDebugEnabled())
+                logger.debug("Ping processing is suspended." +
+                    " No auto pings will be queued.");
+            return;
+        }
+
+        PingQueueManager pingQueueMgr = RollerFactory.getRoller().
+            getPingQueueManager();
+        List applicableAutopings = getApplicableAutoPings(changedWeblogEntry);
+        for (Iterator i = applicableAutopings.iterator(); i.hasNext(); ) {
+            AutoPingData autoPing = (AutoPingData) i.next();
+            pingQueueMgr.addQueueEntry(autoPing);
+        }
+    }
+
+    public List getAutoPingsByWebsite(WebsiteData website)
+            throws RollerException {
+        Query q = strategy.getNamedQuery("AutoPingData.getByWebsite");
+        q.setParameter(1, website);
+        return q.getResultList();
+    }
+
+    public List getAutoPingsByTarget(PingTargetData pingTarget) 
+            throws RollerException {
+        Query q = strategy.getNamedQuery("AutoPingData.getByPingTarget");
+        q.setParameter(1, pingTarget);
+        return q.getResultList();
+    }
+
+    public List getApplicableAutoPings(WeblogEntryData changedWeblogEntry) 
+            throws RollerException {
+        return getAutoPingsByWebsite(changedWeblogEntry.getWebsite());
+        //        return (List)strategy.newQuery(AutoPingData.class, "AutoPingData.getByWebsite")
+        //            .execute(changedWeblogEntry.getWebsite());
+    }
+
+    public List getCategoryRestrictions(AutoPingData autoPing)
+            throws RollerException {
+        return Collections.EMPTY_LIST;
+    }
+
+    public void setCategoryRestrictions
+            (AutoPingData autoPing, Collection newCategories) {
+        // NOT YET IMPLEMENTED
+    }
+
+    public void release() {}
+    
+}

Added: roller/trunk/src/org/apache/roller/business/jpa/JPABookmarkManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/jpa/JPABookmarkManagerImpl.java?view=auto&rev=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/jpa/JPABookmarkManagerImpl.java (added)
+++ roller/trunk/src/org/apache/roller/business/jpa/JPABookmarkManagerImpl.java Thu May 24 15:25:10 2007
@@ -0,0 +1,381 @@
+
+/*
+ * 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.
+ */
+package org.apache.roller.business.jpa;
+
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.List;
+import javax.persistence.NoResultException;
+import javax.persistence.Query;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.business.BookmarkManager;
+import org.apache.roller.business.RollerFactory;
+import org.apache.roller.pojos.BookmarkData;
+import org.apache.roller.pojos.FolderData;
+import org.apache.roller.pojos.WebsiteData;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+
+/*
+ * JPABookmarkManagerImpl.java
+ *
+ * Created on May 31, 2006, 3:49 PM
+ *
+ */
+public class JPABookmarkManagerImpl implements BookmarkManager {
+    
+    private JPAPersistenceStrategy strategy;
+    
+    /**
+     * The logger instance for this class.
+     */
+    private static Log log = LogFactory
+            .getFactory().getInstance(JPABookmarkManagerImpl.class);
+
+    /**
+     * Creates a new instance of JPABookmarkManagerImpl
+     */
+    public JPABookmarkManagerImpl 
+            (JPAPersistenceStrategy strategy) {
+        log.debug("Instantiating JPA Bookmark Manager");
+
+        this.strategy = strategy;
+    }
+
+    public void saveBookmark(BookmarkData bookmark) throws RollerException {
+        boolean exists = getBookmark(bookmark.getId()) != null;        
+        if (!exists) {
+            // New object make sure that relationship is set on managed copy of other side
+            bookmark.getFolder().getBookmarks().add(bookmark);
+        }
+
+        this.strategy.store(bookmark);
+
+        // update weblog last modified date (date is updated by saveWebsite())
+        RollerFactory.getRoller().getUserManager().
+            saveWebsite(bookmark.getWebsite());
+    }
+
+    public BookmarkData getBookmark(String id) throws RollerException {
+        return (BookmarkData) strategy.load(BookmarkData.class, id);
+    }
+
+    public void removeBookmark(BookmarkData bookmark) throws RollerException {
+        //Now remove it from database
+        this.strategy.remove(bookmark);
+        //Remove the bookmark from its parent folder
+        bookmark.getFolder().getBookmarks().remove(bookmark);
+        // update weblog last modified date.  date updated by saveWebsite()
+        RollerFactory.getRoller().getUserManager()
+                .saveWebsite(bookmark.getWebsite());
+    }
+
+    public void saveFolder(FolderData folder) throws RollerException {
+        
+        if(folder.getId() == null || this.getFolder(folder.getId()) == null) {
+            // New folder, so make sure name is unique
+            if (isDuplicateFolderName(folder)) {
+                throw new RollerException("Duplicate folder name");
+            }
+
+            // And If it has a parent, maintain relationship from both sides
+            FolderData parent = folder.getParent();
+            if(parent != null) {
+                parent.getFolders().add(folder);
+            }
+        }
+
+        this.strategy.store(folder);
+
+        // update weblog last modified date.  date updated by saveWebsite()
+        RollerFactory.getRoller().getUserManager().saveWebsite(folder.getWebsite());
+    }
+
+    public void removeFolder(FolderData folder) throws RollerException {
+        this.strategy.remove(folder);
+        FolderData parent = folder.getParent();
+        if (parent != null) {
+            parent.getFolders().remove(folder);
+        }
+
+        // update weblog last modified date.  date updated by saveWebsite()
+        RollerFactory.getRoller().getUserManager().
+            saveWebsite(folder.getWebsite());
+    }
+    
+    public void moveFolder(FolderData srcFolder, FolderData destFolder)
+            throws RollerException {
+        
+        // TODO: this check should be made before calling this method?
+        if (destFolder.descendentOf(srcFolder)) {
+            throw new RollerException(
+                    "ERROR cannot move parent folder into it's own child");
+        }
+        
+        log.debug("Moving folder " + srcFolder.getPath() + " under " +
+            destFolder.getPath());
+        
+        // Manage relationships
+        FolderData oldParent = srcFolder.getParent();
+        if(oldParent != null) {
+            oldParent.getFolders().add(srcFolder);
+        }
+        srcFolder.setParent(destFolder);
+        destFolder.getFolders().add(srcFolder);
+        
+        if("/".equals(destFolder.getPath())) {
+            srcFolder.setPath("/"+srcFolder.getName());
+        } else {
+            srcFolder.setPath(destFolder.getPath() + "/" + srcFolder.getName());
+        }
+        saveFolder(srcFolder);
+        
+        // the main work to be done for a category move is to update the 
+        // path attribute of the category and all descendent categories
+        updatePathTree(srcFolder);
+    }    
+
+    // updates the paths of all descendents of the given folder
+    private void updatePathTree(FolderData folder) throws RollerException {
+        
+        log.debug("Updating path tree for folder "+folder.getPath());
+        
+        FolderData childFolder = null;
+        Iterator childFolders = folder.getFolders().iterator();
+        while(childFolders.hasNext()) {
+            childFolder = (FolderData) childFolders.next();
+            
+            log.debug("OLD child folder path was "+childFolder.getPath());
+            
+            // update path and save
+            if("/".equals(folder.getPath())) {
+                childFolder.setPath("/" + childFolder.getName());
+            } else {
+                childFolder.setPath(folder.getPath() + "/" + 
+                    childFolder.getName());
+            }
+            saveFolder(childFolder);
+            
+            log.debug("NEW child folder path is "+ childFolder.getPath());
+            
+            // then make recursive call to update this folders children
+            updatePathTree(childFolder);
+        }
+    }
+
+    
+    /**
+     * Retrieve folder and lazy-load it's sub-folders and bookmarks.
+     */
+    public FolderData getFolder(String id) throws RollerException {
+        return (FolderData) strategy.load(FolderData.class, id);
+    }
+
+    
+    public void importBookmarks(
+            WebsiteData website, String folderName, String opml)
+            throws RollerException {
+        String msg = "importBookmarks";
+        try {
+            // Build JDOC document OPML string
+            SAXBuilder builder = new SAXBuilder();
+            StringReader reader = new StringReader( opml );
+            Document doc = builder.build( reader );
+
+            FolderData newFolder = getFolder(website, folderName);
+            if (newFolder == null) {
+                newFolder = new FolderData(
+                        getRootFolder(website), 
+                        folderName, folderName, website);
+                this.strategy.store(newFolder);
+            }
+
+            // Iterate through children of OPML body, importing each
+            Element body = doc.getRootElement().getChild("body");
+            Iterator iter = body.getChildren().iterator();
+            while (iter.hasNext()) {
+                Element elem = (Element)iter.next();
+                importOpmlElement( website, elem, newFolder );
+            }
+
+        } catch (Exception ex) {
+            throw new RollerException(ex);
+        }
+    }
+
+    // convenience method used when importing bookmarks
+    // NOTE: this method does not commit any changes; 
+    // that is done by importBookmarks()
+    private void importOpmlElement(
+            WebsiteData website, Element elem, FolderData parent)
+            throws RollerException {
+        String text = elem.getAttributeValue("text");
+        String title = elem.getAttributeValue("title");
+        String desc = elem.getAttributeValue("description");
+        String url = elem.getAttributeValue("url");
+        //String type = elem.getAttributeValue("type");
+        String xmlUrl = elem.getAttributeValue("xmlUrl");
+        String htmlUrl = elem.getAttributeValue("htmlUrl");
+
+        title =   null!=title ? title : text;
+        desc =    null!=desc ? desc : title;
+        xmlUrl =  null!=xmlUrl ? xmlUrl : url;
+        url =     null!=htmlUrl ? htmlUrl : url;
+
+        if (elem.getChildren().size()==0) {
+            // Leaf element.  Store a bookmark
+            // Currently bookmarks must have at least a name and 
+            // HTML url to be stored. Previous logic was
+            // trying to skip invalid ones, but was letting ones 
+            // with an xml url and no html url through
+            // which could result in a db exception.
+            // TODO: Consider providing error feedback instead of 
+            // silently skipping the invalid bookmarks here.
+            if (null != title && null != url) {
+                BookmarkData bd = new BookmarkData(parent,
+                        title,
+                        desc,
+                        url,
+                        xmlUrl,
+                        new Integer(0),
+                        new Integer(100),
+                        null);
+                parent.addBookmark(bd);
+                // TODO: maybe this should be saving the folder?
+                this.strategy.store(bd);
+            }
+        } else {
+            // Store a folder
+            FolderData fd = new FolderData(
+                    parent,
+                    title,
+                    desc,
+                    parent.getWebsite());
+            this.strategy.store(fd);
+
+            // Import folder's children
+            Iterator iter = elem.getChildren("outline").iterator();
+            while ( iter.hasNext() ) {
+                Element subelem = (Element)iter.next();
+                importOpmlElement( website, subelem, fd  );
+            }
+        }
+    }
+
+
+    public FolderData getFolder(WebsiteData website, String path)
+            throws RollerException {
+
+        if (path == null || path.trim().equals("/")) {
+            return getRootFolder(website);
+        } else {
+            String folderPath = path;
+
+            // all folder paths must begin with a '/'
+            if(!folderPath.startsWith("/")) {
+                folderPath = "/"+folderPath;
+            }
+
+            // now just do simple lookup by path
+            Query query = strategy.getNamedQuery("FolderData.getByWebsite&Path");
+            query.setParameter(1, website);
+            query.setParameter(2, folderPath);
+            try {
+                return (FolderData)query.getSingleResult();
+            } catch (NoResultException e) {
+                return null;
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.roller.model.BookmarkManager#retrieveBookmarks(
+     *      org.apache.roller.pojos.FolderData, boolean)
+     */
+    public List getBookmarks(FolderData folder, boolean subfolders) 
+            throws RollerException {
+        Query query = null;
+        List results = null;
+
+        if(!subfolders) {
+            // if no subfolders then this is an equals query
+            query = strategy.getNamedQuery("BoomarkData.getByFolder");
+            query.setParameter(1, folder);
+            results = query.getResultList();
+        } else {
+            // if we are doing subfolders then do a case sensitive
+            // query using folder path
+            query = strategy.getNamedQuery( 
+                "BoomarkData.getByFolder.pathLike&Folder.website");
+            query.setParameter(1, folder.getPath() + '%');
+            query.setParameter(2, folder.getWebsite());
+            results = query.getResultList();
+        }
+            
+        return results;
+    }
+
+    public FolderData getRootFolder(WebsiteData website)
+            throws RollerException {
+        if (website == null)
+            throw new RollerException("website is null");
+        
+        Query q = strategy.getNamedQuery("FolderData.getByWebsite&ParentNull");
+        q.setParameter(1, website);
+        try {
+            return (FolderData)q.getSingleResult();
+        } catch (NoResultException e) {
+            return null;
+        }
+    }
+
+    public List getAllFolders(WebsiteData website)
+            throws RollerException {
+        if (website == null)
+            throw new RollerException("Website is null");
+        
+        Query q = strategy.getNamedQuery("FolderData.getByWebsite");
+        q.setParameter(1, website);
+        return q.getResultList();
+    }
+
+    
+    /**
+     * make sure the given folder doesn't already exist.
+     */
+    private boolean isDuplicateFolderName(FolderData folder) 
+        throws RollerException {
+
+        // ensure that no sibling categories share the same name
+        FolderData parent = folder.getParent();
+        if (null != parent) {
+            return (getFolder(folder.getWebsite(), folder.getPath()) != null);
+        }
+        
+        return false;
+    }
+
+
+    public void release() {}
+    
+}

Added: roller/trunk/src/org/apache/roller/business/jpa/JPAPingQueueManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/jpa/JPAPingQueueManagerImpl.java?view=auto&rev=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/jpa/JPAPingQueueManagerImpl.java (added)
+++ roller/trunk/src/org/apache/roller/business/jpa/JPAPingQueueManagerImpl.java Thu May 24 15:25:10 2007
@@ -0,0 +1,115 @@
+
+/*
+ * 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.
+ */
+package org.apache.roller.business.jpa;
+
+import java.sql.Timestamp;
+import java.util.List;
+import javax.persistence.Query;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.roller.RollerException;
+
+import org.apache.roller.business.pings.PingQueueManager;
+import org.apache.roller.pojos.AutoPingData;
+import org.apache.roller.pojos.PingQueueEntryData;
+
+/*
+ * JPAPingQueueManagerImpl.java
+ *
+ * Created on May 28, 2006, 4:11 PM
+ *
+ */
+public class JPAPingQueueManagerImpl implements PingQueueManager {
+
+    private static Log log = LogFactory.getLog(
+        JPAPingQueueManagerImpl.class);
+
+    /** The strategy for this manager. */
+    private JPAPersistenceStrategy strategy;
+
+    /**
+     * Creates a new instance of JPAPingQueueManagerImpl
+     */
+    public JPAPingQueueManagerImpl(
+            JPAPersistenceStrategy strategy) {
+        this.strategy =  strategy;
+    }
+
+    public PingQueueEntryData getQueueEntry(String id) 
+            throws RollerException {
+        return (PingQueueEntryData)strategy.load(
+            PingQueueEntryData.class, id);
+    }
+
+    public void saveQueueEntry(PingQueueEntryData pingQueueEntry) 
+            throws RollerException {
+        log.debug("Storing ping queue entry: " + pingQueueEntry);
+        strategy.store(pingQueueEntry);
+    }
+
+    public void removeQueueEntry(PingQueueEntryData pingQueueEntry) 
+            throws RollerException {
+        log.debug("Removing ping queue entry: " + pingQueueEntry);
+        strategy.remove(pingQueueEntry);
+    }
+
+    
+    public void addQueueEntry(AutoPingData autoPing) throws RollerException {
+        log.debug("Creating new ping queue entry for auto ping configuration: " 
+            + autoPing);
+        
+        // First check if there is an existing ping queue entry 
+        // for the same target and website
+        if (isAlreadyQueued(autoPing)) {
+            log.debug("A ping queue entry is already present" +
+                " for this ping target and website: " + autoPing);
+            return;
+        }
+
+        Timestamp now = new Timestamp(System.currentTimeMillis());
+        PingQueueEntryData pingQueueEntry =
+                new PingQueueEntryData(
+                    null, now, autoPing.getPingTarget(), 
+                    autoPing.getWebsite(), 0);
+        this.saveQueueEntry(pingQueueEntry);
+    }
+
+    public List getAllQueueEntries() 
+            throws RollerException {
+        return (List)strategy.getNamedQuery(
+                "PingQueueEntryData.getAllOrderByEntryTime").getResultList();
+    }
+
+    // private helper to determine if an has already been queued 
+    // for the same website and ping target.
+    private boolean isAlreadyQueued(AutoPingData autoPing) 
+        throws RollerException {
+        // first, determine if an entry already exists
+        Query q = strategy.getNamedQuery("PingQueueEntryData.getByPingTarget&Website");
+        q.setParameter(1, autoPing.getPingTarget());
+        q.setParameter(2, autoPing.getWebsite());
+        return q.getResultList().size() > 0;
+    }
+
+    public void release() {}
+    
+
+}

Added: roller/trunk/src/org/apache/roller/business/jpa/JPAPingTargetManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/jpa/JPAPingTargetManagerImpl.java?view=auto&rev=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/jpa/JPAPingTargetManagerImpl.java (added)
+++ roller/trunk/src/org/apache/roller/business/jpa/JPAPingTargetManagerImpl.java Thu May 24 15:25:10 2007
@@ -0,0 +1,184 @@
+
+/*
+ * 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.
+ */
+package org.apache.roller.business.jpa;
+
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.List;
+import java.util.Iterator;
+import javax.persistence.Query;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.roller.RollerException;
+
+import org.apache.roller.business.pings.PingTargetManager;
+import org.apache.roller.pojos.AutoPingData;
+import org.apache.roller.pojos.PingTargetData;
+import org.apache.roller.pojos.WebsiteData;
+
+/*
+ * JPAPingTargetManagerImpl.java
+ *
+ * Created on May 29, 2006, 2:24 PM
+ *
+ */
+public class JPAPingTargetManagerImpl implements PingTargetManager {
+    
+    /** The logger instance for this class. */
+    private static Log log = LogFactory.getLog(
+        JPAPingTargetManagerImpl.class);
+
+    private JPAPersistenceStrategy strategy;
+    
+    public JPAPingTargetManagerImpl(
+            JPAPersistenceStrategy strategy) {
+        this.strategy = strategy;
+    }
+
+    public void removePingTarget(PingTargetData pingTarget) 
+            throws RollerException {
+        // remove contents and then target
+        this.removePingTargetContents(pingTarget);
+        this.strategy.remove(pingTarget);
+    }
+
+    /**
+     * Convenience method which removes any queued pings or auto pings that
+     * reference the given ping target.
+     */
+    private void removePingTargetContents(PingTargetData ping) 
+            throws RollerException {
+        // Remove the website's ping queue entries
+        Query q = strategy.getNamedUpdate("PingQueueEntryData.removeByPingTarget");
+        q.setParameter(1, ping);
+        q.executeUpdate();
+        
+        // Remove the website's auto ping configurations
+        q = strategy.getNamedUpdate("AutoPingData.removeByPingTarget");
+        q.setParameter(1, ping);
+        q.executeUpdate();
+    }
+
+    public void removeAllCustomPingTargets()
+            throws RollerException {
+        Query q = strategy.getNamedUpdate(
+            "PingTargetData.removeByWebsiteNotNull");
+        q.executeUpdate();
+    }
+
+    public void savePingTarget(PingTargetData pingTarget)
+            throws RollerException {
+        strategy.store(pingTarget);
+    }
+
+    public PingTargetData getPingTarget(String id)
+            throws RollerException {
+        return (PingTargetData)strategy.load(PingTargetData.class, id);
+    }
+
+    public boolean isNameUnique(PingTargetData pingTarget) 
+            throws RollerException {
+        String name = pingTarget.getName();
+        if (name == null || name.trim().length() == 0) return false;
+        
+        String id = pingTarget.getId();
+        
+        // Determine the set of "brother" targets (custom or common) 
+        // among which this name should be unique.
+        List brotherTargets = null;
+        WebsiteData website = pingTarget.getWebsite();
+        if (website == null) {
+            brotherTargets = getCommonPingTargets();
+        } else {
+            brotherTargets = getCustomPingTargets(website);
+        }
+        
+        // Within that set of targets, fail if there is a target 
+        // with the same name and that target doesn't
+        // have the same id.
+        for (Iterator i = brotherTargets.iterator(); i.hasNext();) {
+            PingTargetData brother = (PingTargetData) i.next();
+            // Fail if it has the same name but not the same id.
+            if (brother.getName().equals(name) && 
+                (id == null || !brother.getId().equals(id))) {
+                return false;
+            }
+        }
+        // No conflict found
+        return true;
+    }
+
+    
+    public boolean isUrlWellFormed(PingTargetData pingTarget) 
+            throws RollerException {
+        String url = pingTarget.getPingUrl();
+        if (url == null || url.trim().length() == 0) return false;
+        try {
+            URL parsedUrl = new URL(url);
+            // OK.  If we get here, it parses ok.  Now just check 
+            // that the protocol is http and there is a host portion.
+            boolean isHttp = parsedUrl.getProtocol().equals("http");
+            boolean hasHost = (parsedUrl.getHost() != null) && 
+                (parsedUrl.getHost().trim().length() > 0);
+            return isHttp && hasHost;
+        } catch (MalformedURLException e) {
+            return false;
+        }
+    }
+
+    
+    public boolean isHostnameKnown(PingTargetData pingTarget) 
+            throws RollerException {
+        String url = pingTarget.getPingUrl();
+        if (url == null || url.trim().length() == 0) return false;
+        try {
+            URL parsedUrl = new URL(url);
+            String host = parsedUrl.getHost();
+            if (host == null || host.trim().length() == 0) return false;
+            InetAddress addr = InetAddress.getByName(host);
+            return true;
+        } catch (MalformedURLException e) {
+            return false;
+        } catch (UnknownHostException e) {
+            return false;
+        }
+    }
+
+    public List getCommonPingTargets()
+            throws RollerException {
+        Query q = strategy.getNamedQuery(
+                "PingTargetData.getByWebsiteNullOrderByName");
+        return q.getResultList();
+    }
+
+    public List getCustomPingTargets(WebsiteData website)
+            throws RollerException {
+        Query q = strategy.getNamedQuery(
+                "PingTargetData.getByWebsiteOrderByName");
+        q.setParameter(1, website);
+        return q.getResultList();
+    }
+
+    public void release() {}
+    
+}

Added: roller/trunk/src/org/apache/roller/business/jpa/JPAPropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/src/org/apache/roller/business/jpa/JPAPropertiesManagerImpl.java?view=auto&rev=541458
==============================================================================
--- roller/trunk/src/org/apache/roller/business/jpa/JPAPropertiesManagerImpl.java (added)
+++ roller/trunk/src/org/apache/roller/business/jpa/JPAPropertiesManagerImpl.java Thu May 24 15:25:10 2007
@@ -0,0 +1,213 @@
+
+/*
+ * 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.
+ */
+package org.apache.roller.business.jpa;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.roller.RollerException;
+
+import org.apache.roller.business.PropertiesManager;
+import org.apache.roller.business.Roller;
+import org.apache.roller.business.RollerFactory;
+import org.apache.roller.config.RollerRuntimeConfig;
+import org.apache.roller.config.runtime.ConfigDef;
+import org.apache.roller.config.runtime.DisplayGroup;
+import org.apache.roller.config.runtime.PropertyDef;
+import org.apache.roller.config.runtime.RuntimeConfigDefs;
+import org.apache.roller.pojos.RollerConfigData;
+import org.apache.roller.pojos.RollerPropertyData;
+import org.apache.roller.business.jpa.JPAPersistenceStrategy;
+
+
+/*
+ * JPAPropertiesManagerImpl.java
+ *
+ * Created on May 29, 2006, 2:06 PM
+ *
+ */
+public class JPAPropertiesManagerImpl implements PropertiesManager {
+    
+    /** The logger instance for this class. */
+    private static Log log = LogFactory.getLog(
+        JPAPropertiesManagerImpl.class);
+
+    private JPAPersistenceStrategy strategy;
+    
+    /**
+     * Creates a new instance of JPAPropertiesManagerImpl
+     */
+    public JPAPropertiesManagerImpl (
+            JPAPersistenceStrategy strategy) {
+        log.debug("Instantiating JPA Properties Manager");
+
+        this.strategy = strategy;
+
+        // TODO: and new method initialize(props)
+        init();
+    }
+
+    /**
+     * Retrieve a single property by name.
+     */
+    public RollerPropertyData getProperty(String name) throws RollerException {
+        return (RollerPropertyData) strategy
+            .load(RollerPropertyData.class,name);
+    }
+
+
+    /**
+     * Retrieve all properties.
+     *
+     * Properties are returned in a Map to make them easy to lookup.  The Map
+     * uses the property name as the key and the RollerPropertyData object
+     * as the value.
+     */
+    public Map getProperties() throws RollerException {
+
+        HashMap props = new HashMap();
+        List list = (List) strategy.getNamedQuery("RollerPropertyData.getAll").getResultList();
+        /*
+         * for convenience sake we are going to put the list of props
+         * into a map for users to access it.  The value element of the
+         * hash still needs to be the RollerPropertyData object so that
+         * we can save the elements again after they have been updated
+         */
+        RollerPropertyData prop = null;
+        Iterator it = list.iterator();
+        while(it.hasNext()) {
+            prop = (RollerPropertyData) it.next();
+            props.put(prop.getName(), prop);
+        }
+
+        return props;
+    }
+
+
+    /**
+     * Save a single property.
+     */
+    public void saveProperty(RollerPropertyData property) 
+            throws RollerException {
+        this.strategy.store(property);
+    }
+
+
+    /**
+     * Save all properties.
+     */
+    public void saveProperties(Map properties) throws RollerException {
+
+        // just go through the list and saveProperties each property
+        Iterator props = properties.values().iterator();
+        while (props.hasNext()) {
+            this.strategy.store((RollerPropertyData) props.next());
+        }
+    }
+
+
+    private void init() {
+        Map props = null;
+        try {
+            props = this.getProperties();
+
+            if(props.size() < 1) {
+                // empty props table ... load defaults
+                props = initializeMissingProps(props);
+            } else {
+                // found existing props ... check for new props
+                props = initializeMissingProps(props);
+            }
+
+            // save our changes
+            this.saveProperties(props);
+        } catch (Exception e) {
+            log.fatal("Failed to initialize runtime configuration properties."+
+                    "Please check that the database has been upgraded!", e);
+            throw new RuntimeException(e);
+        }
+
+    }
+
+    /**
+     * This method compares the property definitions in the RuntimeConfigDefs
+     * file with the properties in the given Map and initializes any properties
+     * that were not found in the Map.
+     *
+     * If the Map of props is empty/null then we will initialize all properties.
+     **/
+    private Map initializeMissingProps(Map props) {
+
+        if(props == null)
+            props = new HashMap();
+
+        // start by getting our runtimeConfigDefs
+        RuntimeConfigDefs runtimeConfigDefs =
+                RollerRuntimeConfig.getRuntimeConfigDefs();
+
+        // can't do initialization without our config defs
+        if(runtimeConfigDefs == null)
+            return props;
+
+        // iterator through all the definitions and add properties
+        // that are not already in our props map
+        ConfigDef configDef = null;
+        DisplayGroup dGroup = null;
+        PropertyDef propDef = null;
+        Iterator defs = runtimeConfigDefs.getConfigDefs().iterator();
+        while(defs.hasNext()) {
+            configDef = (ConfigDef) defs.next();
+
+            Iterator groups = configDef.getDisplayGroups().iterator();
+            while(groups.hasNext()) {
+                dGroup = (DisplayGroup) groups.next();
+
+                Iterator propdefs = dGroup.getPropertyDefs().iterator();
+                while(propdefs.hasNext()) {
+                    propDef = (PropertyDef) propdefs.next();
+
+                    // do we already have this prop?  if not then add it
+                    if(!props.containsKey(propDef.getName())) {
+                        RollerPropertyData newprop =
+                            new RollerPropertyData(
+                                propDef.getName(), propDef.getDefaultValue());
+
+                        props.put(propDef.getName(), newprop);
+
+                        log.info("Found uninitialized property " +
+                            propDef.getName() +
+                            " ... setting value to [" + 
+                            propDef.getDefaultValue() + "]");
+                    }
+                }
+            }
+        }
+
+        return props;
+    }
+
+
+    public void release() {}
+
+}



Mime
View raw message