roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r550055 [2/4] - in /roller/trunk: apps/planet/ apps/planet/nbproject/ apps/planet/src/java/org/apache/roller/planet/business/ apps/planet/src/java/org/apache/roller/planet/business/hibernate/ apps/planet/src/java/org/apache/roller/planet/bu...
Date Sat, 23 Jun 2007 15:27:59 GMT
Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/TestUtils.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/TestUtils.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/TestUtils.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/TestUtils.java Sat Jun 23 08:27:55 2007
@@ -18,9 +18,9 @@
 
 package org.apache.roller.planet;
 
-import org.apache.roller.planet.PlanetException;
 import org.apache.roller.planet.business.PlanetFactory;
 import org.apache.roller.planet.business.PlanetManager;
+import org.apache.roller.planet.business.startup.PlanetStartup;
 import org.apache.roller.planet.pojos.PlanetData;
 import org.apache.roller.planet.pojos.PlanetEntryData;
 import org.apache.roller.planet.pojos.PlanetGroupData;
@@ -31,6 +31,27 @@
  * Utility class for unit test classes.
  */
 public final class TestUtils {
+    
+    
+    public static void setupPlanet() throws Exception {
+        
+        if(!PlanetFactory.isBootstrapped()) {
+            
+            // do core services preparation
+            PlanetStartup.prepare();
+            
+            // do application bootstrapping and init
+            PlanetFactory.bootstrap();
+            PlanetFactory.getPlanet().initialize();
+        }
+    }
+    
+    
+    public static void shutdownPlanet() throws Exception {
+        
+        // trigger shutdown
+        PlanetFactory.getPlanet().shutdown();
+    }
     
     
     /**

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryBasicTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryBasicTests.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryBasicTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryBasicTests.java Sat Jun 23 08:27:55 2007
@@ -32,6 +32,9 @@
     
     
     protected void setUp() throws Exception {
+        // setup planet
+        TestUtils.setupPlanet();
+        
         testSub = TestUtils.setupSubscription("entryBasicTest");
     }
     

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/EntryFunctionalTests.java Sat Jun 23 08:27:55 2007
@@ -44,6 +44,9 @@
     
     
     protected void setUp() throws Exception {
+        // setup planet
+        TestUtils.setupPlanet();
+
         log.info("ENTERED");
         
         testPlanet = TestUtils.setupPlanet("entryFuncTestPlanet");

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/GroupBasicTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/GroupBasicTests.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/GroupBasicTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/GroupBasicTests.java Sat Jun 23 08:27:55 2007
@@ -32,6 +32,9 @@
     
     
     protected void setUp() throws Exception {
+        // setup planet
+        TestUtils.setupPlanet();
+
         testPlanet = TestUtils.setupPlanet("groupBasicTest");
     }
     

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/GroupFunctionalTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/GroupFunctionalTests.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/GroupFunctionalTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/GroupFunctionalTests.java Sat Jun 23 08:27:55 2007
@@ -34,6 +34,9 @@
     
     
     protected void setUp() throws Exception {
+        // setup planet
+        TestUtils.setupPlanet();
+
         testPlanet = TestUtils.setupPlanet("groupFuncTest");
         testGroup1 = TestUtils.setupGroup(testPlanet, "groupFuncTest1");
         testGroup2 = TestUtils.setupGroup(testPlanet, "groupFuncTest2");

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetBasicTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetBasicTests.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetBasicTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetBasicTests.java Sat Jun 23 08:27:55 2007
@@ -34,6 +34,9 @@
     
     public void testPlanetCRUD() throws Exception {
         
+        // setup planet
+        TestUtils.setupPlanet();
+
         PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
         
         PlanetData testPlanet = new PlanetData("testPlanet", "testPlanet", "testPlanet");

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetFunctionalTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetFunctionalTests.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetFunctionalTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PlanetFunctionalTests.java Sat Jun 23 08:27:55 2007
@@ -35,6 +35,9 @@
     
     
     protected void setUp() throws Exception {
+        // setup planet
+        TestUtils.setupPlanet();
+
         testPlanet = TestUtils.setupPlanet("planetFuncTest");
     }
     

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PropertiesTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PropertiesTest.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PropertiesTest.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/PropertiesTest.java Sat Jun 23 08:27:55 2007
@@ -38,7 +38,11 @@
     public static Log log = LogFactory.getLog(PropertiesTest.class);
     
     
-    public void setUp() throws Exception {}
+    public void setUp() throws Exception {
+        // setup planet
+        TestUtils.setupPlanet();
+
+    }
     
     public void tearDown() throws Exception {}
     

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/RomeFeedFetcherTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/RomeFeedFetcherTest.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/RomeFeedFetcherTest.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/RomeFeedFetcherTest.java Sat Jun 23 08:27:55 2007
@@ -41,6 +41,9 @@
     
     
     protected void setUp() throws Exception {
+        // setup planet
+        TestUtils.setupPlanet();
+
         testPlanet = TestUtils.setupPlanet("fetcherTestPlanet");
         testGroup = TestUtils.setupGroup(testPlanet, "fetcherTestGroup");
         

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionBasicTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionBasicTests.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionBasicTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionBasicTests.java Sat Jun 23 08:27:55 2007
@@ -29,6 +29,9 @@
     
     public void testSubscriptionCRUD() throws Exception {
         
+        // setup planet
+        TestUtils.setupPlanet();
+
         PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
         
         PlanetSubscriptionData testSub = new PlanetSubscriptionData();

Modified: roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java (original)
+++ roller/trunk/apps/planet/test/java/org/apache/roller/planet/business/SubscriptionFunctionalTests.java Sat Jun 23 08:27:55 2007
@@ -37,6 +37,9 @@
     
     
     protected void setUp() throws Exception {
+        // setup planet
+        TestUtils.setupPlanet();
+
         testPlanet = TestUtils.setupPlanet("subFuncTest");
         testGroup1 = TestUtils.setupGroup(testPlanet, "subFuncTest1");
         testGroup2 = TestUtils.setupGroup(testPlanet, "subFuncTest2");

Modified: roller/trunk/apps/planet/testdata/planet-custom.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/testdata/planet-custom.properties?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/testdata/planet-custom.properties (original)
+++ roller/trunk/apps/planet/testdata/planet-custom.properties Sat Jun 23 08:27:55 2007
@@ -1,6 +1,6 @@
-persistence.planet.classname=org.apache.roller.planet.business.jpa.JPAPlanetImpl
-#persistence.planet.classname=org.apache.roller.planet.business.datamapper.jpa.JPAPlanetImpl
-#persistence.planet.classname=org.apache.roller.planet.business.hibernate.HibernatePlanetImpl
+
+# Pluggable backend
+#guice.backend.module=org.apache.roller.planet.business.hibernate.PlanetModule
 
 database.configurationType=jdbc
 

Modified: roller/trunk/apps/planet/web/WEB-INF/classes/planet.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/planet/web/WEB-INF/classes/planet.properties?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/planet/web/WEB-INF/classes/planet.properties (original)
+++ roller/trunk/apps/planet/web/WEB-INF/classes/planet.properties Sat Jun 23 08:27:55 2007
@@ -66,28 +66,19 @@
 hibernate.dialect=org.hibernate.dialect.MySQLDialect
 
 
+
 #----------------------------------------------------
 # Optional properties
 
+# Pluggable backend
+guice.backend.module=org.apache.roller.planet.business.jpa.PlanetModule
 
 # Number of Technorati queries allowed per day
 planet.aggregator.technorati.limit=500
 
-# Business layer implementation to be used - don't touch unless you are customizing Planet
-persistence.planet.classname=\
-org.apache.roller.planet.business.jpa.JPAPlanetImpl
-
 # Connection provider to be used - don't touch unless you are customizing Planet
 hibernate.connectionProvider=\
 org.apache.roller.planet.business.hibernate.HibernateConnectionProvider
-
-# choose a url strategy
-urlstrategy.classname=\
-org.apache.roller.planet.business.MultiPlanetURLStrategy
-
-# choose a feed fetcher
-feedfetcher.classname=\
-org.apache.roller.planet.business.RomeFeedFetcher
 
 # The set of default Roller renderer factories.
 rendering.rollerRendererFactories=\

Modified: roller/trunk/apps/weblogger/nbproject/project.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/nbproject/project.xml?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/nbproject/project.xml (original)
+++ roller/trunk/apps/weblogger/nbproject/project.xml Sat Jun 23 08:27:55 2007
@@ -10,11 +10,6 @@
             </properties>
             <folders>
                 <source-folder>
-                    <label>web</label>
-                    <type>doc_root</type>
-                    <location>web</location>
-                </source-folder>
-                <source-folder>
                     <label>src</label>
                     <type>java</type>
                     <location>src/java</location>
@@ -24,6 +19,11 @@
                     <type>java</type>
                     <location>test/java</location>
                 </source-folder>
+                <source-folder>
+                    <label>web</label>
+                    <type>doc_root</type>
+                    <location>web</location>
+                </source-folder>
             </folders>
             <ide-actions>
                 <action name="build">
@@ -103,14 +103,13 @@
             <compilation-unit>
                 <package-root>src/java</package-root>
                 <package-root>test/java</package-root>
-                <classpath mode="compile">../../tools/lib/commons-betwixt-1.0-beta-1.jar:../../tools/lib/commons-codec-1.3.jar:../../tools/lib/commons-collections-3.2.jar:../../tools/lib/commons-httpclient-2.0.2.jar:../../tools/lib/commons-id-0.1-SNAPSHOT.jar:../../tools/lib/commons-lang-2.1.jar:../../tools/lib/commons-logging-1.0.4.jar:../../tools/lib/jaxen-full.jar:../../tools/lib/jdom.jar:../../tools/lib/log4j-1.2.11.jar:../../tools/lib/lucene-1.4.3.jar:../../tools/lib/rome-0.9.jar:../../tools/lib/rome-fetcher-0.9.jar:../../tools/lib/saxpath.jar:../../tools/lib/velocity-1.5.jar:../../tools/lib/taglibs-string.jar:../../tools/struts-1.2.4/lib/antlr.jar:../../tools/struts-1.2.4/lib/commons-beanutils.jar:../../tools/struts-1.2.4/lib/commons-digester.jar:../../tools/struts-1.2.4/lib/commons-validator.jar:../../tools/struts-1.2.4/lib/jakarta-oro.jar:../../tools/struts-1.2.4/lib/struts-el.jar:../../tools/struts-1.2.4/lib/struts.jar:../../tools/struts-2.0.6/lib/antlr-2.7.2.jar:..
 /../tools/struts-2.0.6/lib/commons-beanutils-1.6.jar:../../tools/struts-2.0.6/lib/commons-chain-1.1.jar:../../tools/struts-2.0.6/lib/commons-fileupload-1.2.jar:../../tools/struts-2.0.6/lib/commons-io-1.3.1.jar:../../tools/struts-2.0.6/lib/commons-validator-1.3.0.jar:../../tools/struts-2.0.6/lib/freemarker-2.3.8.jar:../../tools/struts-2.0.6/lib/ognl-2.6.11.jar:../../tools/struts-2.0.6/lib/oro-2.0.8.jar:../../tools/struts-2.0.6/lib/struts2-core-2.0.6.jar:../../tools/struts-2.0.6/lib/struts2-spring-plugin-2.0.6.jar:../../tools/struts-2.0.6/lib/struts2-tiles-plugin-2.0.6.jar:../../tools/struts-2.0.6/lib/tiles-api-2.0-20070207.130156-4.jar:../../tools/struts-2.0.6/lib/tiles-core-2.0-20070207.130156-4.jar:../../tools/struts-2.0.6/lib/xwork-2.0.1.jar:../../tools/buildtime/tomcat-5.0.28/jsp-api.jar:../../tools/buildtime/tomcat-5.0.28/servlet-api.jar:../../tools/buildtime/activation.jar:../../tools/buildtime/mail.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/jstl.jar:../../tools
 /jakarta-taglibs-standard-1.1.2/lib/serializer.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/standard.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/xalan.jar:../../tools/hibernate-3.1/hibernate3.jar:../../tools/hibernate-3.1/lib/asm-attrs.jar:../../tools/hibernate-3.1/lib/asm.jar:../../tools/hibernate-3.1/lib/cglib-2.1.3.jar:../../tools/hibernate-3.1/lib/dom4j-1.6.1.jar:../../tools/hibernate-3.1/lib/ehcache-1.1.jar:../../tools/hibernate-3.1/lib/jdbc2_0-stdext.jar:../../tools/hibernate-3.1/lib/jta.jar:../../tools/openjpa-0.9.7/geronimo-j2ee-connector_1.5_spec-1.0.1.jar:../../tools/openjpa-0.9.7/geronimo-jpa_3.0_spec-1.0.jar:../../tools/openjpa-0.9.7/geronimo-jta_1.0.1B_spec-1.0.1.jar:../../tools/openjpa-0.9.7/openjpa-0.9.7-incubating.jar:../../tools/openjpa-0.9.7/serp-1.11.0.jar:../../tools/spring-1.2/acegi-security-1.0.3.jar:../../tools/spring-1.2/spring.jar:../../tools/roller-core/roller-core.jar:../../tools/roller-planet/roller-planet-business.jar:../../tools/xml
 rpc-3.0/lib/ws-commons-util-1.0.1.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-client-3.0.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-common-3.0.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-server-3.0.jar:../../tools/buildtime/junit-4.1.jar</classpath>
+                <classpath mode="compile">../../tools/lib/commons-betwixt-1.0-beta-1.jar:../../tools/lib/commons-codec-1.3.jar:../../tools/lib/commons-collections-3.2.jar:../../tools/lib/commons-digester-1.6.jar:../../tools/lib/commons-httpclient-2.0.2.jar:../../tools/lib/commons-id-0.1-SNAPSHOT.jar:../../tools/lib/commons-lang-2.1.jar:../../tools/lib/commons-logging-1.0.4.jar:../../tools/lib/concurrent-1.3.2.jar:../../tools/lib/guice-1.0.jar:../../tools/lib/jaxen-full.jar:../../tools/lib/jdom.jar:../../tools/lib/log4j-1.2.11.jar:../../tools/lib/lucene-1.4.3.jar:../../tools/lib/rome-0.9.jar:../../tools/lib/rome-fetcher-0.9.jar:../../tools/lib/saxpath.jar:../../tools/lib/taglibs-string.jar:../../tools/lib/velocity-1.5.jar:../../tools/hibernate-3.1/hibernate3.jar:../../tools/struts-2.0.6/lib/antlr-2.7.2.jar:../../tools/struts-2.0.6/lib/commons-beanutils-1.6.jar:../../tools/struts-2.0.6/lib/commons-chain-1.1.jar:../../tools/struts-2.0.6/lib/commons-fileupload-1.2.jar:../../tool
 s/struts-2.0.6/lib/commons-io-1.3.1.jar:../../tools/struts-2.0.6/lib/commons-validator-1.3.0.jar:../../tools/struts-2.0.6/lib/freemarker-2.3.8.jar:../../tools/struts-2.0.6/lib/ognl-2.6.11.jar:../../tools/struts-2.0.6/lib/oro-2.0.8.jar:../../tools/struts-2.0.6/lib/struts2-core-2.0.6.jar:../../tools/struts-2.0.6/lib/struts2-spring-plugin-2.0.6.jar:../../tools/struts-2.0.6/lib/struts2-tiles-plugin-2.0.6.jar:../../tools/struts-2.0.6/lib/tiles-api-2.0-20070207.130156-4.jar:../../tools/struts-2.0.6/lib/tiles-core-2.0-20070207.130156-4.jar:../../tools/struts-2.0.6/lib/xwork-2.0.1.jar:../../tools/openjpa-0.9.7/geronimo-j2ee-connector_1.5_spec-1.0.1.jar:../../tools/openjpa-0.9.7/geronimo-jpa_3.0_spec-1.0.jar:../../tools/openjpa-0.9.7/geronimo-jta_1.0.1B_spec-1.0.1.jar:../../tools/openjpa-0.9.7/openjpa-0.9.7-incubating.jar:../../tools/openjpa-0.9.7/serp-1.11.0.jar:../../tools/xmlrpc-3.0/lib/ws-commons-util-1.0.1.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-client-3.0.jar:../../tools/xmlrpc-3
 .0/lib/xmlrpc-common-3.0.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-server-3.0.jar:../../tools/spring-1.2/acegi-security-1.0.3.jar:../../tools/spring-1.2/spring.jar:../../tools/roller-core/roller-core.jar:../../tools/roller-planet/roller-planet-business.jar:../../tools/struts-1.2.4/lib/antlr.jar:../../tools/struts-1.2.4/lib/commons-beanutils.jar:../../tools/struts-1.2.4/lib/commons-digester.jar:../../tools/struts-1.2.4/lib/commons-validator.jar:../../tools/struts-1.2.4/lib/jakarta-oro.jar:../../tools/struts-1.2.4/lib/struts-el.jar:../../tools/struts-1.2.4/lib/struts.jar:../../tools/buildtime/tomcat-5.0.28/jsp-api.jar:../../tools/buildtime/tomcat-5.0.28/servlet-api.jar:../../tools/buildtime/activation.jar:../../tools/buildtime/mail.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/jstl.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/serializer.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/standard.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/xalan.jar:../../tools/hi
 bernate-3.1/lib/asm-attrs.jar:../../tools/hibernate-3.1/lib/asm.jar:../../tools/hibernate-3.1/lib/cglib-2.1.3.jar:../../tools/hibernate-3.1/lib/dom4j-1.6.1.jar:../../tools/hibernate-3.1/lib/ehcache-1.1.jar:../../tools/hibernate-3.1/lib/jdbc2_0-stdext.jar:../../tools/hibernate-3.1/lib/jta.jar:../../tools/buildtime/junit-4.1.jar</classpath>
                 <source-level>1.5</source-level>
             </compilation-unit>
         </java-data>
         <web-data xmlns="http://www.netbeans.org/ns/freeform-project-web/1">
             <web-module>
                 <doc-root>web</doc-root>
-                <classpath/>
                 <context-path>/roller</context-path>
                 <j2ee-spec-level>1.5</j2ee-spec-level>
             </web-module>

Modified: roller/trunk/apps/weblogger/properties.xmlf
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/properties.xmlf?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/properties.xmlf (original)
+++ roller/trunk/apps/weblogger/properties.xmlf Sat Jun 23 08:27:55 2007
@@ -107,6 +107,7 @@
     <include name="rome-0.9.jar"/>
     <include name="rome-fetcher-0.9.jar"/>
     <include name="velocity-1.5.jar"/>
+    <include name="guice-1.0.jar"/>
 </fileset>
 
 <fileset id="presentation.jars" dir="${ro.tools}/lib">
@@ -187,6 +188,7 @@
     <fileset refid="mail.jars"/>
     <fileset refid="roller-core.jars" />
     <fileset refid="xmlrpc.jars"/>
+    <fileset refid="roller-planet.jars" />
     <!-- JPA bytecode enhancement apparently wants JPA classes everywhere -->
     <fileset refid="jpa.jars" />
 </path>
@@ -200,7 +202,6 @@
 <path id="presentation.path">
     <path refid="base.path"/>
     <fileset refid="presentation.jars"/>
-    <fileset refid="roller-planet.jars" />
     <fileset refid="struts.jars"/>
     <fileset refid="struts2.jars"/>
     <fileset refid="servlet.jars"/>

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerFactory.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerFactory.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerFactory.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerFactory.java Sat Jun 23 08:27:55 2007
@@ -1,113 +1,123 @@
-/*
- * 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.weblogger.business;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.roller.weblogger.business.startup.WebloggerStartup;
-import org.apache.roller.weblogger.config.RollerConfig;
-
-
-/**
- * Provides access to the Roller instance.
- */
-public final class RollerFactory {
-    
-    private static final Log log = LogFactory.getLog(RollerFactory.class);
-    
-    // a reference to the bootstrapped Roller instance
-    private static Roller rollerInstance = null;
-    
-    
-    // non-instantiable
-    private RollerFactory() {
-        // hello all you beautiful people
-    }
-    
-    
-    /**
-     * True if bootstrap process was completed, False otherwise.
-     */
-    public static boolean isBootstrapped() {
-        return (rollerInstance != null);
-    }
-    
-    
-    /**
-     * Accessor to the Roller Weblogger business tier.
-     *
-     * @return Roller An instance of Roller.
-     * @throws IllegalStateException If the app has not been properly bootstrapped yet.
-     */
-    public static final Roller getRoller() {
-        if(rollerInstance == null) {
-            throw new IllegalStateException("Roller Weblogger has not been bootstrapped yet");
-        }
-        
-        return rollerInstance;
-    }
-    
-    
-    /**
-     * Bootstrap the Roller Weblogger business tier.
-     *
-     * Bootstrapping the application effectively instantiates all the necessary
-     * pieces of the business tier and wires them together so that the app is 
-     * ready to run.
-     *
-     * @throws IllegalStateException If the app has not been properly prepared yet.
-     * @throws BootstrapException If an error happens during the bootstrap process.
-     */
-    public static final void bootstrap() throws BootstrapException {
-        
-        // if the app hasn't been properly started so far then bail
-        if (!WebloggerStartup.isPrepared()) {
-            throw new IllegalStateException("Cannot bootstrap until application has been properly prepared");
-        }
-        
-        log.info("Bootstrapping Roller Weblogger business tier");
-        
-        // bootstrap Roller Weblogger business tier
-        
-        // lookup value for the roller classname to use
-        String roller_classname =
-                RollerConfig.getProperty("persistence.roller.classname");
-        if(roller_classname == null || roller_classname.trim().length() < 1) {
-            throw new BootstrapException("Invalid roller classname - "+roller_classname);
-        } else {
-            log.info("Using Roller Impl: " + roller_classname);
-        }
-        
-        try {
-            Class rollerClass = Class.forName(roller_classname);
-            java.lang.reflect.Method instanceMethod =
-                    rollerClass.getMethod("instantiate", (Class[])null);
-            
-            // do the invocation
-            rollerInstance = (Roller) instanceMethod.invoke(rollerClass, (Object[])null);
-            
-        } catch (Throwable ex) {
-            // bootstrapping failed
-            throw new BootstrapException("Exception doing bootstrapping", ex);
-        }
-        
-        log.info("Roller Weblogger business tier successfully bootstrapped");
-    }
-
-}
+/*
+ * 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.weblogger.business;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.business.startup.WebloggerStartup;
+import org.apache.roller.weblogger.config.PingConfig;
+import org.apache.roller.weblogger.config.RollerConfig;
+
+
+/**
+ * Provides access to the Roller instance.
+ */
+public final class RollerFactory {
+    
+    private static final Log log = LogFactory.getLog(RollerFactory.class);
+    
+    // have we been bootstrapped yet?
+    private static boolean bootstrapped = false;
+    
+    // a reference to the bootstrapped Roller instance
+    private static Roller rollerInstance = null;
+    
+    private static Injector injector = null;
+  
+    
+    static {
+        String moduleClassname = RollerConfig.getProperty("guice.backend.module");
+        try {
+            Class moduleClass = Class.forName(moduleClassname);
+            Module module = (Module)moduleClass.newInstance();
+            injector = Guice.createInjector(module);
+        } catch (Throwable e) {
+            // Fatal misconfiguration, cannot recover
+            throw new RuntimeException("Error instantiating backend module" + moduleClassname, e);
+        }
+    } 
+    
+    
+    // non-instantiable
+    private RollerFactory() {
+        // hello all you beautiful people
+    }
+    
+    
+    /**
+     * True if bootstrap process was completed, False otherwise.
+     */
+    public static boolean isBootstrapped() {
+        return bootstrapped;
+    }
+    
+    
+    /**
+     * Accessor to the Roller Weblogger business tier.
+     *
+     * @return Roller An instance of Roller.
+     * @throws IllegalStateException If the app has not been properly bootstrapped yet.
+     */
+    public static final Roller getRoller() {
+        if (rollerInstance == null) {
+            throw new IllegalStateException("Roller Weblogger has not been bootstrapped yet");
+        }
+        
+        return rollerInstance;
+    }
+    
+    
+    /**
+     * Access to Guice injector so that developers can add new injected objects.
+     */
+    public static Injector getInjector() {
+        return injector;
+    }
+    
+    
+    /**
+     * Bootstrap the Roller Weblogger business tier.
+     *
+     * Bootstrapping the application effectively instantiates all the necessary
+     * pieces of the business tier and wires them together so that the app is 
+     * ready to run.
+     *
+     * @throws IllegalStateException If the app has not been properly prepared yet.
+     * @throws BootstrapException If an error happens during the bootstrap process.
+     */
+    public static final void bootstrap() throws BootstrapException {
+        
+        // if the app hasn't been properly started so far then bail
+        if (!WebloggerStartup.isPrepared()) {
+            throw new IllegalStateException("Cannot bootstrap until application has been properly prepared");
+        }
+        
+        log.info("Bootstrapping Roller Weblogger business tier");
+        
+        rollerInstance = injector.getInstance(Roller.class);
+            
+        // note that we've now been bootstrapped
+        bootstrapped = true;
+            
+        log.info("Roller Weblogger business tier successfully bootstrapped");
+    }    
+}

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerImpl.java Sat Jun 23 08:27:55 2007
@@ -25,40 +25,77 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.business.pings.AutoPingManager;
+import org.apache.roller.weblogger.business.pings.PingQueueManager;
+import org.apache.roller.weblogger.business.pings.PingTargetManager;
+import org.apache.roller.weblogger.business.referrers.RefererManager;
 import org.apache.roller.weblogger.business.referrers.ReferrerQueueManager;
 import org.apache.roller.weblogger.business.referrers.ReferrerQueueManagerImpl;
-import org.apache.roller.weblogger.business.runnable.ThreadManagerImpl;
-import org.apache.roller.weblogger.business.search.IndexManagerImpl;
 import org.apache.roller.weblogger.business.search.IndexManager;
 import org.apache.roller.weblogger.business.runnable.ThreadManager;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
-import org.apache.roller.weblogger.business.themes.ThemeManagerImpl;
 import org.apache.roller.weblogger.config.PingConfig;
 
-
 /**
  * The abstract version of the Roller implementation.
  *
  * Here we put code that pertains to *all* implementations of the Roller
  * interface, regardless of their persistence strategy.
  */
+@com.google.inject.Singleton
 public abstract class RollerImpl implements Roller {
-    
     private static Log mLogger = LogFactory.getLog(RollerImpl.class);
     
-    private FileManager   fileManager = null;
-    private IndexManager  indexManager = null;
-    private ThreadManager threadManager = null;
-    private ThemeManager  themeManager = null;
-    private PluginManager pluginManager = null;
+    private AutoPingManager      autoPingManager = null;
+    private BookmarkManager      bookmarkManager = null;
+    private FileManager          fileManager = null;
+    private IndexManager         indexManager = null;
+    private PingQueueManager     pingQueueManager = null;
+    private PingTargetManager    pingTargetManager = null;
+    private PluginManager        pluginManager = null;
+    private PropertiesManager    propertiesManager = null;
+    private RefererManager       refererManager = null;
+    private ReferrerQueueManager refererQueueManager = null;
+    private ThemeManager         themeManager = null;
+    private ThreadManager        threadManager = null;
+    private UserManager          userManager = null;
+    private WeblogManager        weblogManager = null;
             
     private String version = null;
     private String buildTime = null;
     private String buildUser = null;
     
-    
-    public RollerImpl() {
+    protected RollerImpl(
+        AutoPingManager      autoPingManager,
+        BookmarkManager      bookmarkManager,
+        FileManager          fileManager,
+        IndexManager         indexManager,
+        PingQueueManager     pingQueueManager,
+        PingTargetManager    pingTargetManager,
+        PluginManager        pluginManager,
+        PropertiesManager    propertiesManager,
+        RefererManager       refererManager,
+        ReferrerQueueManager refererQueueManager, 
+        ThemeManager         themeManager,
+        ThreadManager        threadManager,
+        UserManager          userManager,
+        WeblogManager        weblogManager) throws WebloggerException { 
                 
+        this.autoPingManager     = autoPingManager;
+        this.bookmarkManager     = bookmarkManager;
+        this.fileManager         = fileManager;
+        this.indexManager        = indexManager;
+        this.pingQueueManager    = pingQueueManager;
+        this.pingTargetManager   = pingTargetManager;
+        this.pluginManager       = pluginManager;
+        this.propertiesManager   = propertiesManager;
+        this.refererManager      = refererManager;
+        this.refererQueueManager = refererQueueManager;
+        this.themeManager        = themeManager;
+        this.threadManager       = threadManager;
+        this.userManager         = userManager;
+        this.weblogManager       = weblogManager;
+            
         Properties props = new Properties();
         try {
             props.load(getClass().getResourceAsStream("/version.properties"));
@@ -76,9 +113,6 @@
      * @see org.apache.roller.weblogger.model.Roller#getFileManager()
      */
     public FileManager getFileManager() {
-        if (fileManager == null) {
-            fileManager = new FileManagerImpl();
-        }
         return fileManager;
     }
     
@@ -87,9 +121,6 @@
      * @see org.apache.roller.weblogger.model.Roller#getThreadManager()
      */
     public ThreadManager getThreadManager() {
-        if (threadManager == null) {
-            threadManager = new ThreadManagerImpl();
-        }
         return threadManager;
     }
     
@@ -98,9 +129,6 @@
      * @see org.apache.roller.weblogger.model.Roller#getIndexManager()
      */
     public IndexManager getIndexManager() {
-        if (indexManager == null) {
-            indexManager = new IndexManagerImpl();
-        }
         return indexManager;
     }
     
@@ -109,9 +137,6 @@
      * @see org.apache.roller.weblogger.model.Roller#getThemeManager()
      */
     public ThemeManager getThemeManager() {
-        if (themeManager == null) {
-            themeManager = new ThemeManagerImpl();
-        }
         return themeManager;
     }
     
@@ -120,7 +145,72 @@
      * @see org.apache.roller.weblogger.business.referrers.ReferrerQueueManager
      */
     public ReferrerQueueManager getReferrerQueueManager() {
-        return ReferrerQueueManagerImpl.getInstance();
+        return refererQueueManager;
+    }
+    
+    
+    
+    /**
+     * @see org.apache.roller.weblogger.model.Roller#getUserManager()
+     */
+    public UserManager getUserManager() {
+        return userManager;
+    }
+    
+    
+    /**
+     * @see org.apache.roller.weblogger.model.Roller#getBookmarkManager()
+     */
+    public BookmarkManager getBookmarkManager() {
+        return bookmarkManager;
+    }
+    
+    
+    /**
+     * @see org.apache.roller.weblogger.model.Roller#getWeblogManager()
+     */
+    public WeblogManager getWeblogManager() {
+        return weblogManager;
+    }
+    
+    
+    /**
+     * @see org.apache.roller.weblogger.model.Roller#getRefererManager()
+     */
+    public RefererManager getRefererManager() {
+        return refererManager;
+    }
+    
+    
+    /**
+     * @see org.apache.roller.weblogger.model.Roller#getPropertiesManager()
+     */
+    public PropertiesManager getPropertiesManager() {
+        return propertiesManager;
+    }
+    
+    
+    /**
+     * @see org.apache.roller.weblogger.model.Roller#getPingTargetManager()
+     */
+    public PingQueueManager getPingQueueManager() {
+        return pingQueueManager;
+    }
+    
+    
+    /**
+     * @see org.apache.roller.weblogger.model.Roller#getPingTargetManager()
+     */
+    public AutoPingManager getAutopingManager() {
+        return autoPingManager;
+    }
+    
+    
+    /**
+     * @see org.apache.roller.weblogger.model.Roller#getPingTargetManager()
+     */
+    public PingTargetManager getPingTargetManager() {
+        return pingTargetManager;
     }
     
     
@@ -128,23 +218,30 @@
      * @see org.apache.roller.weblogger.model.Roller#getPluginManager()
      */
     public PluginManager getPagePluginManager() {
-        if (pluginManager == null) {
-            pluginManager = new PluginManagerImpl();
-        }
         return pluginManager;
     }
     
     
     public void release() {
         try {
-            if (fileManager != null) fileManager.release();
-            if (threadManager != null) threadManager.release();
-            if (pluginManager != null) pluginManager.release();
+            autoPingManager.release();
+            bookmarkManager.release();
+            fileManager.release();
+            pingTargetManager.release();
+            pingQueueManager.release();
+            pluginManager.release();
+            refererManager.release();
+            threadManager.release();
+            userManager.release();
+            weblogManager.release();
         } catch(Throwable e) {
             mLogger.error("Error calling Roller.release()", e);
         }
     }
     
+
+    
+    
     
     /**
      * @inheritDoc
@@ -191,7 +288,7 @@
             flush();
         } catch(WebloggerException ex) {
             throw new InitializationException("Error flushing after initialization", ex);
-        }
+        } 
         
         mLogger.info("Roller Weblogger business tier successfully initialized");
     }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateAutoPingManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateAutoPingManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateAutoPingManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateAutoPingManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -16,7 +16,7 @@
  * directory of this distribution.
  */
 
-package org.apache.roller.weblogger.business.hibernate;
+package org.apache.roller.weblogger.business.hibernate; 
 
 import org.hibernate.Criteria;
 import org.hibernate.HibernateException;
@@ -31,12 +31,13 @@
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;  
+import org.apache.commons.logging.LogFactory;  
+import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.business.Roller;
 import org.apache.roller.weblogger.config.PingConfig;
 import org.apache.roller.weblogger.business.pings.AutoPingManager;
 import org.apache.roller.weblogger.business.pings.PingQueueManager;
-import org.apache.roller.weblogger.business.RollerFactory;
 
 
 /**
@@ -44,16 +45,20 @@
  *
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
  */
+@com.google.inject.Singleton
 public class HibernateAutoPingManagerImpl implements AutoPingManager {
     
+    private Roller roller;
+    
     static final long serialVersionUID = 5420615676256979199L;
     
     private static Log log = LogFactory.getLog(HibernateAutoPingManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
     
-    
-    public HibernateAutoPingManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject    
+    protected HibernateAutoPingManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
+        this.roller = roller;
         this.strategy = strat;
     }
     
@@ -122,7 +127,7 @@
         }
         
         // TODO: new manager method for addQueueEntries(list)?
-        PingQueueManager pingQueueMgr = RollerFactory.getRoller().getPingQueueManager();
+        PingQueueManager pingQueueMgr = roller.getPingQueueManager();
         List applicableAutopings = getApplicableAutoPings(changedWeblogEntry);
         for (Iterator i = applicableAutopings.iterator(); i.hasNext(); ) {
             AutoPing autoPing = (AutoPing) i.next();

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateBookmarkManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateBookmarkManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateBookmarkManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateBookmarkManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -28,7 +28,6 @@
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
 import org.apache.roller.weblogger.pojos.Weblog;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -36,13 +35,13 @@
 import org.jdom.Element;
 import org.jdom.input.SAXBuilder;
 import org.apache.roller.weblogger.business.BookmarkManager;
-import org.apache.roller.weblogger.business.RollerFactory;
-import org.apache.roller.weblogger.util.Utilities;
+import org.apache.roller.weblogger.business.Roller;
 
 
 /**
  * Hibernate implementation of the BookmarkManager.
  */
+@com.google.inject.Singleton
 public class HibernateBookmarkManagerImpl implements BookmarkManager {
     
     static final long serialVersionUID = 5286654557062382772L;
@@ -50,16 +49,18 @@
     private static Log log = LogFactory.getLog(HibernateBookmarkManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     
     /**
      * @param pstrategy
      * @param roller
      */
-    public HibernateBookmarkManagerImpl(HibernatePersistenceStrategy strat) {
-        log.debug("Instantiating Hibernate Bookmark Manager");
-        
+    @com.google.inject.Inject    
+    protected HibernateBookmarkManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
+        this.roller = roller;
         this.strategy = strat;
+        log.debug("Instantiating Hibernate Bookmark Manager");
     }
     
     
@@ -67,7 +68,7 @@
         this.strategy.store(bookmark);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(bookmark.getWebsite());
+        roller.getUserManager().saveWebsite(bookmark.getWebsite());
     }
     
     
@@ -86,8 +87,7 @@
         //Now remove it from database
         this.strategy.remove(bookmark);
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager()
-                .saveWebsite(bookmark.getWebsite());
+        roller.getUserManager().saveWebsite(bookmark.getWebsite());
     }
     
     
@@ -101,7 +101,7 @@
         this.strategy.store(folder);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(folder.getWebsite());
+        roller.getUserManager().saveWebsite(folder.getWebsite());
     }
     
     
@@ -110,7 +110,7 @@
         this.strategy.remove(folder);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(folder.getWebsite());
+        roller.getUserManager().saveWebsite(folder.getWebsite());
     }
     
     

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePersistenceStrategy.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePersistenceStrategy.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePersistenceStrategy.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePersistenceStrategy.java Sat Jun 23 08:27:55 2007
@@ -28,6 +28,7 @@
 import org.hibernate.Transaction;
 import org.hibernate.cfg.Configuration;
 import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.config.RollerConfig;
 import org.hibernate.cfg.Environment;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
@@ -40,14 +41,12 @@
  * manager implementations by providing a set of basic persistence methods
  * that can be easily reused.
  */
+@com.google.inject.Singleton
 public class HibernatePersistenceStrategy {
-    
-    static final long serialVersionUID = 2561090040518169098L;
+    private static Log log = LogFactory.getLog(HibernatePersistenceStrategy.class);
     
     protected static SessionFactory sessionFactory = null;
     
-    private static Log log = LogFactory.getLog(HibernatePersistenceStrategy.class);
-    
     /** No-op so XML parser doesn't hit the network looking for Hibernate DTDs */
     private EntityResolver noOpEntityResolver = new EntityResolver() {
         public InputSource resolveEntity(String publicId, String systemId) {
@@ -61,11 +60,18 @@
      * 'hibernate.dialect' - the classname of the Hibernate dialect to be used,
      * 'hibernate.connectionProvider - the classname of Roller's connnection provider impl.
      */
-    public HibernatePersistenceStrategy(String configResource, String dialect, String connectionProvider) {
-        
-        // Read Hibernate config file specified by Roller config
+    protected HibernatePersistenceStrategy() throws WebloggerException {        
+        String dialect =  
+            RollerConfig.getProperty("hibernate.dialect");
+        String connectionProvider = 
+            RollerConfig.getProperty("hibernate.connectionProvider");        
+        String configuration = "hibernate.cfg.xml";
+        init(dialect, connectionProvider, configuration);
+    }   
+    
+    protected void init(String dialect, String connectionProvider, String configuration) {
         Configuration config = new Configuration();
-        config.configure(configResource);
+        config.configure(configuration);
 
         // Add dialect specified by Roller config and our connection provider
         Properties props = new Properties();

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingQueueManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingQueueManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingQueueManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingQueueManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -39,6 +39,7 @@
  *
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
  */
+@com.google.inject.Singleton
 public class HibernatePingQueueManagerImpl implements PingQueueManager {
     
     static final long serialVersionUID = -7660638707453106615L;
@@ -48,7 +49,8 @@
     private HibernatePersistenceStrategy strategy = null;
     
     
-    public HibernatePingQueueManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject    
+    protected HibernatePingQueueManagerImpl(HibernatePersistenceStrategy strat) {
         this.strategy = strat;
     }
     

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingTargetManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingTargetManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingTargetManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingTargetManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -35,9 +35,9 @@
 import java.util.Collection;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.business.Roller;
 import org.apache.roller.weblogger.business.pings.AutoPingManager;
 import org.apache.roller.weblogger.business.pings.PingTargetManager;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.pojos.AutoPing;
 import org.apache.roller.weblogger.pojos.PingQueueEntry;
 
@@ -47,6 +47,7 @@
  *
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
  */
+@com.google.inject.Singleton
 public class HibernatePingTargetManagerImpl implements PingTargetManager {
     
     static final long serialVersionUID = 121008492583382718L;
@@ -54,9 +55,12 @@
     private static Log log = LogFactory.getLog(HibernatePingTargetManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     
-    public HibernatePingTargetManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject    
+    protected HibernatePingTargetManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
+        this.roller = roller;
         this.strategy = strat;
     }
     
@@ -87,7 +91,7 @@
         }
         
         // Remove the website's auto ping configurations
-        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
+        AutoPingManager autoPingMgr = roller.getAutopingManager();
         List autopings = autoPingMgr.getAutoPingsByTarget(ping);
         Iterator it = autopings.iterator();
         while(it.hasNext()) {

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePropertiesManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePropertiesManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePropertiesManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -35,12 +35,14 @@
 import org.apache.roller.weblogger.config.runtime.PropertyDef;
 import org.apache.roller.weblogger.config.runtime.RuntimeConfigDefs;
 import org.apache.roller.weblogger.business.PropertiesManager;
+import org.apache.roller.weblogger.business.Roller;
 import org.apache.roller.weblogger.pojos.RuntimeConfigProperty;
 
 
 /**
  * Hibernate implementation of the PropertiesManager.
- */
+ */ 
+@com.google.inject.Singleton
 public class HibernatePropertiesManagerImpl implements PropertiesManager {
     
     public static final long serialVersionUID = -4326713177137796936L;
@@ -48,15 +50,17 @@
     private static Log log = LogFactory.getLog(HibernatePropertiesManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     
     /** 
      * Creates a new instance of HibernatePropertiesManagerImpl
      */
-    public HibernatePropertiesManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject
+    protected HibernatePropertiesManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
         
         log.debug("Instantiating Hibernate Properties Manager");
-        
+        this.roller = roller;        
         this.strategy = strat;
     }
     

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRefererManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRefererManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRefererManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRefererManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -46,7 +46,6 @@
 import org.hibernate.engine.SessionFactoryImplementor;
 import org.hibernate.dialect.Dialect;
 import org.apache.roller.weblogger.business.Roller;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogManager;
 import org.apache.roller.weblogger.pojos.StatCount;
@@ -58,6 +57,7 @@
 /**
  * Hibernate implementation of the RefererManager.
  */
+@com.google.inject.Singleton
 public class HibernateRefererManagerImpl implements RefererManager {
     
     static final long serialVersionUID = -4966091850482256435L;
@@ -68,14 +68,18 @@
     protected static final String TOTALHITS = "totalHits";
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
+
     private Date mRefDate = new Date();
     
         
-    public HibernateRefererManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject    
+    protected HibernateRefererManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
         
         log.debug("Instantiating Hibernate Referer Manager");
         
-        strategy = strat;
+        this.strategy = strat;
+        this.roller = roller;
     }
     
     public void saveReferer(WeblogReferrer referer) throws WebloggerException {
@@ -527,13 +531,13 @@
         
         // lookup the weblog now
         try {
-            UserManager userMgr = RollerFactory.getRoller().getUserManager();
+            UserManager userMgr = roller.getUserManager();
             weblog = userMgr.getWebsiteByHandle(weblogHandle);
             if (weblog == null) return;
             
             // now lookup weblog entry if possible
             if (entryAnchor != null) {
-                WeblogManager weblogMgr = RollerFactory.getRoller().getWeblogManager();
+                WeblogManager weblogMgr = roller.getWeblogManager();
                 entry = weblogMgr.getWeblogEntryByAnchor(weblog, entryAnchor);
             }
         } catch (WebloggerException re) {
@@ -629,8 +633,7 @@
                     // Launch thread to extract referer linkback
                     
                     try {
-                        Roller mRoller = RollerFactory.getRoller();
-                        mRoller.getThreadManager().executeInBackground(
+                        roller.getThreadManager().executeInBackground(
                                 new LinkbackExtractorRunnable(ref));
                     } catch (InterruptedException e) {
                         log.warn("Interrupted during linkback extraction",e);

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java Sat Jun 23 08:27:55 2007
@@ -22,199 +22,70 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.RollerImpl;
-import org.apache.roller.weblogger.config.RollerConfig;
 import org.apache.roller.weblogger.business.BookmarkManager;
+import org.apache.roller.weblogger.business.FileManager;
 import org.apache.roller.weblogger.business.pings.AutoPingManager;
 import org.apache.roller.weblogger.business.pings.PingQueueManager;
 import org.apache.roller.weblogger.business.pings.PingTargetManager;
 import org.apache.roller.weblogger.business.PropertiesManager;
 import org.apache.roller.weblogger.business.referrers.RefererManager;
-import org.apache.roller.weblogger.business.Roller;
+import org.apache.roller.weblogger.business.referrers.ReferrerQueueManager;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogManager;
+import org.apache.roller.weblogger.business.plugins.PluginManager;
 import org.apache.roller.weblogger.business.runnable.ThreadManager;
-import org.apache.roller.weblogger.business.hibernate.HibernatePersistenceStrategy;
+import org.apache.roller.weblogger.business.search.IndexManager;
+import org.apache.roller.weblogger.business.themes.ThemeManager;
+
 
 /**
  * A Hibernate specific implementation of the Roller business layer.
  */
-public class HibernateRollerImpl extends RollerImpl {
-    
-    static final long serialVersionUID = 5256135928578074652L;
-    
+@com.google.inject.Singleton
+public class HibernateRollerImpl extends RollerImpl {    
     private static Log mLogger = LogFactory.getLog(HibernateRollerImpl.class);    
     
     // a persistence utility class
     private HibernatePersistenceStrategy strategy = null;
     
-    // references to the managers we maintain
-    private BookmarkManager   bookmarkManager = null;
-    private PropertiesManager propertiesManager = null;
-    private RefererManager    refererManager = null;
-    private UserManager       userManager = null;
-    private WeblogManager     weblogManager = null;
-    private PingQueueManager  pingQueueManager = null;
-    private AutoPingManager   autoPingManager = null;
-    private PingTargetManager pingTargetManager = null;
-    private ThreadManager     threadManager = null;
-    
-    
-    protected HibernateRollerImpl() throws WebloggerException {
-        try {
-            String dialect =  
-                RollerConfig.getProperty("hibernate.dialect");
-            String connectionProvider = 
-                RollerConfig.getProperty("hibernate.connectionProvider");
-            strategy = new HibernatePersistenceStrategy(
-                "/hibernate.cfg.xml", dialect, connectionProvider);
-        } catch(Throwable t) {
-            // if this happens then we are screwed
-            mLogger.fatal("Error initializing Hibernate", t);
-            throw new WebloggerException(t);
-        }
-    }
-    
-    
-    /**
-     * Instantiates and returns an instance of HibernateRollerImpl.
-     */
-    public static Roller instantiate() throws WebloggerException {
-        mLogger.debug("Instantiating HibernateRollerImpl");
-        return new HibernateRollerImpl();
-    }
-    
-    
-    public void flush() throws WebloggerException {
-        this.strategy.flush();
-    }
-    
-    
-    public void release() {
-        
-        // release our own stuff first
-        if (bookmarkManager != null) bookmarkManager.release();
-        if (refererManager != null) refererManager.release();
-        if (userManager != null) userManager.release();
-        if (weblogManager != null) weblogManager.release();
-        if (pingTargetManager != null) pingTargetManager.release();
-        if (pingQueueManager != null) pingQueueManager.release();
-        if (autoPingManager != null) autoPingManager.release();
-        if( threadManager != null) threadManager.release();
-        
-        // tell Hibernate to close down
-        this.strategy.release();
+    @com.google.inject.Inject
+    protected HibernateRollerImpl(
+        HibernatePersistenceStrategy strategy,
+        AutoPingManager      autoPingManager,
+        BookmarkManager      bookmarkManager,
+        FileManager          fileManager,
+        IndexManager         indexManager,
+        PingQueueManager     pingQueueManager,
+        PingTargetManager    pingTargetManager,
+        PluginManager        pluginManager,
+        PropertiesManager    propertiesManager,
+        RefererManager       refererManager,
+        ReferrerQueueManager refererQueueManager,
+        ThemeManager         themeManager,
+        ThreadManager        threadManager,
+        UserManager          userManager,
+        WeblogManager        weblogManager) throws WebloggerException {
         
-        // then let parent do its thing
-        super.release();
+        super(
+            autoPingManager,
+            bookmarkManager,
+            fileManager,
+            indexManager,
+            pingQueueManager,
+            pingTargetManager,
+            pluginManager,
+            propertiesManager,
+            refererManager,
+            refererQueueManager,
+            themeManager,
+            threadManager,
+            userManager,
+            weblogManager); 
+        this.strategy = strategy;
     }
-    
-    
-    public void shutdown() {
-        
-        // do our own shutdown first
-        this.release();
         
-        // then let parent do its thing
-        super.shutdown();
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getUserManager()
-     */
-    public UserManager getUserManager() {
-        if ( userManager == null ) {
-            userManager = new HibernateUserManagerImpl(strategy);
-        }
-        return userManager;
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getBookmarkManager()
-     */
-    public BookmarkManager getBookmarkManager() {
-        if ( bookmarkManager == null ) {
-            bookmarkManager = new HibernateBookmarkManagerImpl(strategy);
-        }
-        return bookmarkManager;
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getWeblogManager()
-     */
-    public WeblogManager getWeblogManager() {
-        if ( weblogManager == null ) {
-            weblogManager = new HibernateWeblogManagerImpl(strategy);
-        }
-        return weblogManager;
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getRefererManager()
-     */
-    public RefererManager getRefererManager() {
-        if ( refererManager == null ) {
-            refererManager = new HibernateRefererManagerImpl(strategy);
-        }
-        return refererManager;
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getPropertiesManager()
-     */
-    public PropertiesManager getPropertiesManager() {
-        if (propertiesManager == null) {
-            propertiesManager = new HibernatePropertiesManagerImpl(strategy);
-        }
-        return propertiesManager;
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getPingTargetManager()
-     */
-    public PingQueueManager getPingQueueManager() {
-        if (pingQueueManager == null) {
-            pingQueueManager = new HibernatePingQueueManagerImpl(strategy);
-        }
-        return pingQueueManager;
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getPingTargetManager()
-     */
-    public AutoPingManager getAutopingManager() {
-        if (autoPingManager == null) {
-            autoPingManager = new HibernateAutoPingManagerImpl(strategy);
-        }
-        return autoPingManager;
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getPingTargetManager()
-     */
-    public PingTargetManager getPingTargetManager() {
-        if (pingTargetManager == null) {
-            pingTargetManager = new HibernatePingTargetManagerImpl(strategy);
-        }
-        return pingTargetManager;
-    }
-    
-    
-    /**
-     * @see org.apache.roller.weblogger.model.Roller#getThreadManager()
-     */
-    public ThreadManager getThreadManager() {
-        if (threadManager == null) {
-            threadManager = new HibernateThreadManagerImpl(strategy);
-        }
-        return threadManager;
-    }
-    
+    public void flush() throws WebloggerException {
+        this.strategy.flush();
+    }    
 }
+

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateThreadManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateThreadManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateThreadManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateThreadManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -22,9 +22,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.business.Roller;
 import org.apache.roller.weblogger.business.runnable.ThreadManagerImpl;
 import org.apache.roller.weblogger.business.runnable.RollerTask;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.pojos.TaskLock;
 import org.hibernate.Criteria;
 import org.hibernate.HibernateException;
@@ -39,18 +39,21 @@
  * This implementation extends the base ThreadManagerImpl class and provides
  * leasing abilities which are managed through the database.
  */
+@com.google.inject.Singleton
 public class HibernateThreadManagerImpl extends ThreadManagerImpl {
     
     private static Log log = LogFactory.getLog(HibernateThreadManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     
-    public HibernateThreadManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject    
+    protected HibernateThreadManagerImpl(HibernatePersistenceStrategy strat) {
         super();
         
         log.debug("Instantiating Hibernate Thread Manager");
-        
+        this.roller = roller;        
         this.strategy = strat;
     }
     
@@ -75,7 +78,7 @@
                 
                 // save it and flush
                 this.saveTaskLock(taskLock);
-                RollerFactory.getRoller().flush();
+                roller.flush();
             }
             
         } catch (WebloggerException ex) {
@@ -105,7 +108,7 @@
             int result = query.executeUpdate();
             
             // this may not be needed
-            RollerFactory.getRoller().flush();
+            roller.flush();
             
             if(result == 1) {
                 return true;
@@ -151,7 +154,7 @@
             int result = query.executeUpdate();
             
             // this may not be needed
-            RollerFactory.getRoller().flush();
+            roller.flush();
             
             if(result == 1) {
                 return true;

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateUserManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateUserManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateUserManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -20,7 +20,6 @@
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
@@ -42,8 +41,8 @@
 import org.apache.roller.weblogger.config.RollerConfig;
 import org.apache.roller.weblogger.business.pings.AutoPingManager;
 import org.apache.roller.weblogger.business.BookmarkManager;
+import org.apache.roller.weblogger.business.Roller;
 import org.apache.roller.weblogger.business.pings.PingTargetManager;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogManager;
 import org.apache.roller.weblogger.pojos.AutoPing;
@@ -66,22 +65,25 @@
 
 /**
  * Hibernate implementation of the UserManager.
- */
+ */    
+@com.google.inject.Singleton
 public class HibernateUserManagerImpl implements UserManager {
     
     static final long serialVersionUID = -5128460637997081121L;    
     private static Log log = LogFactory.getLog(HibernateUserManagerImpl.class);    
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     // cached mapping of weblogHandles -> weblogIds
     private Map weblogHandleToIdMap = new Hashtable();
     
     // cached mapping of userNames -> userIds
     private Map userNameToIdMap = new Hashtable();
-        
-    public HibernateUserManagerImpl(HibernatePersistenceStrategy strat) {
+   
+    @com.google.inject.Inject
+    protected HibernateUserManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
         log.debug("Instantiating Hibernate User Manager");
-        
+        this.roller = roller;       
         this.strategy = strat;
     }
     
@@ -113,8 +115,8 @@
         
         Session session = this.strategy.getSession();
         
-        BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
-        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
+        BookmarkManager bmgr = roller.getBookmarkManager();
+        WeblogManager wmgr = roller.getWeblogManager();
         
         // remove tags
         Criteria tagQuery = session.createCriteria(WeblogEntryTag.class)
@@ -147,7 +149,7 @@
         List queueEntries = criteria.list();
         
         // Remove the website's auto ping configurations
-        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
+        AutoPingManager autoPingMgr = roller.getAutopingManager();
         List autopings = autoPingMgr.getAutoPingsByWebsite(website);
         Iterator it = autopings.iterator();
         while(it.hasNext()) {
@@ -155,7 +157,7 @@
         }
         
         // Remove the website's custom ping targets
-        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
+        PingTargetManager pingTargetMgr = roller.getPingTargetManager();
         List pingtargets = pingTargetMgr.getCustomPingTargets(website);
         it = pingtargets.iterator();
         while(it.hasNext()) {
@@ -238,14 +240,14 @@
         this.strategy.store(page);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(page.getWebsite());
+        roller.getUserManager().saveWebsite(page.getWebsite());
     }
         
     public void removePage(WeblogTemplate page) throws WebloggerException {
         this.strategy.remove(page);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(page.getWebsite());
+        roller.getUserManager().saveWebsite(page.getWebsite());
     }
         
     public void addUser(User newUser) throws WebloggerException {
@@ -287,8 +289,8 @@
         
     private void addWeblogContents(Weblog newWeblog) throws WebloggerException {
         
-        UserManager umgr = RollerFactory.getRoller().getUserManager();
-        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();
+        UserManager umgr = roller.getUserManager();
+        WeblogManager wmgr = roller.getWeblogManager();
         
         // grant weblog creator ADMIN permissions
         WeblogPermission perms = new WeblogPermission();
@@ -358,8 +360,8 @@
         }
         
         // add any auto enabled ping targets
-        PingTargetManager pingTargetMgr = RollerFactory.getRoller().getPingTargetManager();
-        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
+        PingTargetManager pingTargetMgr = roller.getPingTargetManager();
+        AutoPingManager autoPingMgr = roller.getAutopingManager();
         
         Iterator pingTargets = pingTargetMgr.getCommonPingTargets().iterator();
         PingTarget pingTarget = null;

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateWeblogManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateWeblogManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateWeblogManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -36,7 +36,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
-import org.apache.roller.weblogger.business.RollerFactory;
+import org.apache.roller.weblogger.business.Roller;
 import org.apache.roller.weblogger.business.WeblogManager;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
 import org.apache.roller.weblogger.pojos.WeblogHitCount;
@@ -65,6 +65,7 @@
 /**
  * Hibernate implementation of the WeblogManager.
  */
+@com.google.inject.Singleton
 public class HibernateWeblogManagerImpl implements WeblogManager {
     
     static final long serialVersionUID = -3730860865389981439L;
@@ -72,6 +73,7 @@
     private static Log log = LogFactory.getLog(HibernateWeblogManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     // cached mapping of entryAnchors -> entryIds
     private Hashtable entryAnchorToIdMap = new Hashtable();
@@ -81,9 +83,10 @@
     
     private Comparator tagStatComparator = new TagStatComparator();
     
-    public HibernateWeblogManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject    
+    protected HibernateWeblogManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
         log.debug("Instantiating Hibernate Weblog Manager");
-        
+        this.roller = roller;        
         this.strategy = strat;
     }
     
@@ -95,7 +98,7 @@
         }
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(cat.getWebsite());
+        roller.getUserManager().saveWebsite(cat.getWebsite());
         
         this.strategy.store(cat);
     }
@@ -124,7 +127,7 @@
         }
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(cat.getWebsite());
+        roller.getUserManager().saveWebsite(cat.getWebsite());
     }
     
     
@@ -196,7 +199,7 @@
         this.strategy.store(comment);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(comment.getWeblogEntry().getWebsite());
+        roller.getUserManager().saveWebsite(comment.getWeblogEntry().getWebsite());
     }
     
     
@@ -204,7 +207,7 @@
         this.strategy.remove(comment);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(comment.getWeblogEntry().getWebsite());
+        roller.getUserManager().saveWebsite(comment.getWeblogEntry().getWebsite());
     }
     
     
@@ -240,12 +243,12 @@
         
         // update weblog last modified date.  date updated by saveWebsite()
         if(entry.isPublished()) {
-            RollerFactory.getRoller().getUserManager().saveWebsite(entry.getWebsite());
+            roller.getUserManager().saveWebsite(entry.getWebsite());
         }
         
         if(entry.isPublished()) {
             // Queue applicable pings for this update.
-            RollerFactory.getRoller().getAutopingManager().queueApplicableAutoPings(entry);
+            roller.getAutopingManager().queueApplicableAutoPings(entry);
         }
     }
     
@@ -292,7 +295,7 @@
         
         // update weblog last modified date.  date updated by saveWebsite()
         if(entry.isPublished()) {
-            RollerFactory.getRoller().getUserManager().saveWebsite(entry.getWebsite());
+            roller.getUserManager().saveWebsite(entry.getWebsite());
         }
         
         // remove entry from cache mapping

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/RollerModule.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/RollerModule.java?view=auto&rev=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/RollerModule.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/RollerModule.java Sat Jun 23 08:27:55 2007
@@ -0,0 +1,74 @@
+/*
+ * 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.weblogger.business.hibernate;
+
+import com.google.inject.Binder;
+import com.google.inject.Module;
+import org.apache.roller.weblogger.business.BookmarkManager;
+import org.apache.roller.weblogger.business.FileManager;
+import org.apache.roller.weblogger.business.FileManagerImpl;
+import org.apache.roller.weblogger.business.PropertiesManager;
+import org.apache.roller.weblogger.business.Roller;
+import org.apache.roller.weblogger.business.UserManager;
+import org.apache.roller.weblogger.business.WeblogManager;
+import org.apache.roller.weblogger.business.pings.AutoPingManager;
+import org.apache.roller.weblogger.business.pings.PingQueueManager;
+import org.apache.roller.weblogger.business.pings.PingTargetManager;
+import org.apache.roller.weblogger.business.plugins.PluginManager;
+import org.apache.roller.weblogger.business.plugins.PluginManagerImpl;
+import org.apache.roller.weblogger.business.referrers.RefererManager;
+import org.apache.roller.weblogger.business.referrers.ReferrerQueueManager;
+import org.apache.roller.weblogger.business.referrers.ReferrerQueueManagerImpl;
+import org.apache.roller.weblogger.business.runnable.ThreadManager;
+import org.apache.roller.weblogger.business.runnable.ThreadManagerImpl;
+import org.apache.roller.weblogger.business.search.IndexManager;
+import org.apache.roller.weblogger.business.search.IndexManagerImpl;
+import org.apache.roller.weblogger.business.themes.ThemeManager;
+import org.apache.roller.weblogger.business.themes.ThemeManagerImpl;
+
+/**
+ * Guice module for configuring Hibernate as Roller-backend.
+ */
+public class RollerModule implements Module {
+    
+    public void configure(Binder binder) {
+        
+        binder.bind(Roller.class).to(HibernateRollerImpl.class);
+        
+        binder.bind(HibernatePersistenceStrategy.class);
+        binder.bind(org.apache.roller.weblogger.planet.business.hibernate.HibernateRollerPlanetPersistenceStrategy.class);
+        
+        binder.bind(AutoPingManager.class).to(     HibernateAutoPingManagerImpl.class);
+        binder.bind(BookmarkManager.class).to(     HibernateBookmarkManagerImpl.class);
+        binder.bind(PingQueueManager.class).to(    HibernatePingQueueManagerImpl.class);
+        binder.bind(PingTargetManager.class).to(   HibernatePingTargetManagerImpl.class);
+        binder.bind(PropertiesManager.class).to(   HibernatePropertiesManagerImpl.class);
+        binder.bind(RefererManager.class).to(      HibernateRefererManagerImpl.class);
+        binder.bind(ThreadManager.class).to(       HibernateThreadManagerImpl.class);
+        binder.bind(UserManager.class).to(         HibernateUserManagerImpl.class);
+        binder.bind(WeblogManager.class).to(       HibernateWeblogManagerImpl.class);
+                
+        binder.bind(ReferrerQueueManager.class).to(ReferrerQueueManagerImpl.class);
+        binder.bind(FileManager.class).to(         FileManagerImpl.class);
+        binder.bind(IndexManager.class).to(        IndexManagerImpl.class);
+        binder.bind(PluginManager.class).to(       PluginManagerImpl.class);
+        binder.bind(ThemeManager.class).to(        ThemeManagerImpl.class);
+    }
+}
+

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAAutoPingManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAAutoPingManagerImpl.java?view=diff&rev=550055&r1=550054&r2=550055
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAAutoPingManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAAutoPingManagerImpl.java Sat Jun 23 08:27:55 2007
@@ -21,7 +21,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.business.pings.AutoPingManager;
 import org.apache.roller.weblogger.business.pings.PingQueueManager;
 import org.apache.roller.weblogger.config.PingConfig;
@@ -36,6 +35,7 @@
 import java.util.List;
 import javax.persistence.Query;
 import org.apache.roller.weblogger.business.jpa.JPAPersistenceStrategy;
+import org.apache.roller.weblogger.business.Roller;
 
 /*
  * JPAAutoPingManagerImpl.java
@@ -43,21 +43,24 @@
  * Created on May 29, 2006, 11:29 AM
  *
  */
+@com.google.inject.Singleton
 public class JPAAutoPingManagerImpl implements AutoPingManager {
 
     private JPAPersistenceStrategy strategy;
+    private Roller roller = null;
     
     /**
      * The logger instance for this class.
      */
-    private static Log logger = LogFactory
-            .getFactory().getInstance(JPAAutoPingManagerImpl.class);
+    private static Log logger = 
+        LogFactory.getFactory().getInstance(JPAAutoPingManagerImpl.class);
 
     /**
      * Creates a new instance of JPAAutoPingManagerImpl
      */
-    public JPAAutoPingManagerImpl
-            (JPAPersistenceStrategy strategy) {
+    @com.google.inject.Inject
+    protected JPAAutoPingManagerImpl(Roller roller, JPAPersistenceStrategy strategy) {
+        this.roller = roller;
         this.strategy = strategy;
     }
 
@@ -101,7 +104,7 @@
             return;
         }
 
-        PingQueueManager pingQueueMgr = RollerFactory.getRoller().
+        PingQueueManager pingQueueMgr = roller.
             getPingQueueManager();
         List applicableAutopings = getApplicableAutoPings(changedWeblogEntry);
         for (Iterator i = applicableAutopings.iterator(); i.hasNext(); ) {



Mime
View raw message