roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r542883 - in /roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger: business/RollerFactory.java business/hibernate/HibernateRollerImpl.java business/jpa/JPARollerImpl.java config/PingConfig.java ui/core/RollerContext.java
Date Wed, 30 May 2007 17:23:56 GMT
Author: agilliland
Date: Wed May 30 10:23:55 2007
New Revision: 542883

URL: http://svn.apache.org/viewvc?view=rev&rev=542883
Log:
a little bit of reorg on Weblogger bootstrap process which was causing some issues.  this
commit introduces a new bootstrap() method to the RollerFactory class which contains the handful
of specialized initialization steps done by some of the Weblogger backend managers.  this
method is then called from the RollerContext contextInitialized() method at app init time.


Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/RollerFactory.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPARollerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/PingConfig.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/RollerContext.java

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=542883&r1=542882&r2=542883
==============================================================================
--- 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
Wed May 30 10:23:55 2007
@@ -20,15 +20,17 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.config.PingConfig;
 import org.apache.roller.weblogger.config.RollerConfig;
 
 
 /**
  * Provides access to the Roller instance.
  */
-public abstract class RollerFactory {
+public final class RollerFactory {
     
-    private static Log log = LogFactory.getLog(RollerFactory.class);
+    private static final Log log = LogFactory.getLog(RollerFactory.class);
     
     private static final String DEFAULT_IMPL =
         "org.apache.roller.weblogger.business.jpa.JPARollerImpl";
@@ -38,7 +40,6 @@
     private static Roller rollerInstance = null;
     
     
-    
     // non-instantiable
     private RollerFactory() {
         // hello all you beautiful people
@@ -46,9 +47,53 @@
     
     
     /**
+     * Bootstrap the Roller Weblogger business tier.
+     */
+    public static final void bootstrap() {
+        
+        // This will cause instantiation and initialziation of Roller impl
+        Roller roller = getRoller();
+        
+        // TODO: this initialization process should probably be controlled by
+        // a more generalized application lifecycle event framework
+        
+        // Now that Roller has been instantiated, initialize individual managers
+        roller.getPropertiesManager();
+        roller.getIndexManager();
+        roller.getThemeManager();
+        
+        // And this will schedule all configured tasks
+        roller.getThreadManager().startTasks();
+        
+        // Initialize ping systems
+        try {
+            // Initialize common targets from the configuration
+            PingConfig.initializeCommonTargets();
+            
+            // Initialize ping variants
+            PingConfig.initializePingVariants();
+            
+            // Remove custom ping targets if they have been disallowed
+            if (PingConfig.getDisallowCustomTargets()) {
+                log.info("Custom ping targets have been disallowed.  Removing any existing
custom targets.");
+                RollerFactory.getRoller().getPingTargetManager().removeAllCustomPingTargets();
+            }
+            
+            // Remove all autoping configurations if ping usage has been disabled.
+            if (PingConfig.getDisablePingUsage()) {
+                log.info("Ping usage has been disabled.  Removing any existing auto ping
configurations.");
+                RollerFactory.getRoller().getAutopingManager().removeAllAutoPings();
+            }
+        } catch (RollerException e) {
+            log.error("ERROR configing ping managers", e);
+        }
+    }
+    
+    
+    /**
      * Static accessor for the instance of Roller.
      */
-    public static Roller getRoller() {
+    public static final Roller getRoller() {
         
         // check to see if we need to instantiate
         if(rollerInstance == null) {

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=542883&r1=542882&r2=542883
==============================================================================
--- 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
Wed May 30 10:23:55 2007
@@ -80,13 +80,7 @@
      */
     public static Roller instantiate() throws RollerException {
         mLogger.debug("Instantiating HibernateRollerImpl");
-        Roller roller = new HibernateRollerImpl();
-
-        // Now that Roller has been instantiated, initialize individual managers
-        roller.getPropertiesManager();
-        roller.getIndexManager();
-        roller.getThemeManager();          
-        return roller;
+        return new HibernateRollerImpl();
     }
     
     

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPARollerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPARollerImpl.java?view=diff&rev=542883&r1=542882&r2=542883
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPARollerImpl.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPARollerImpl.java
Wed May 30 10:23:55 2007
@@ -127,13 +127,7 @@
      */
     public static Roller instantiate() throws RollerException {
         logger.debug("Instantiating JPARollerImpl");
-        Roller roller = new JPARollerImpl();
-
-        // Now that Roller has been instantiated, initialize individual managers
-        roller.getPropertiesManager();
-        roller.getIndexManager();
-        roller.getThemeManager();          
-        return roller;
+        return new JPARollerImpl();
     }
     
     public void flush() throws RollerException {

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/PingConfig.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/PingConfig.java?view=diff&rev=542883&r1=542882&r2=542883
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/PingConfig.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/PingConfig.java
Wed May 30 10:23:55 2007
@@ -98,28 +98,6 @@
     // targets that implement minor variants of the WeblogUpdates.ping call.
     // This is initialized once at startup, and referenced when pings are made.
     private static final Map configuredVariants = new HashMap();
-    
-    
-    static {
-        try {
-            // Initialize common targets from the configuration
-            initializeCommonTargets();
-            // Initialize ping variants
-            initializePingVariants();
-            // Remove custom ping targets if they have been disallowed
-            if (getDisallowCustomTargets()) {
-                logger.info("Custom ping targets have been disallowed.  Removing any existing
custom targets.");
-                RollerFactory.getRoller().getPingTargetManager().removeAllCustomPingTargets();
-            }
-            // Remove all autoping configurations if ping usage has been disabled.
-            if (PingConfig.getDisablePingUsage()) {
-                logger.info("Ping usage has been disabled.  Removing any existing auto ping
configurations.");
-                RollerFactory.getRoller().getAutopingManager().removeAllAutoPings();
-            }
-        } catch (RollerException e) {
-            logger.error("ERROR configing ping managers", e);
-        }
-    }
 
 
     // Inhibit construction

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/RollerContext.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/RollerContext.java?view=diff&rev=542883&r1=542882&r2=542883
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/RollerContext.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/RollerContext.java
Wed May 30 10:23:55 2007
@@ -121,17 +121,14 @@
             // Parts of database upgrade are not included in migration scripts
             upgradeDatabaseIfNeeded();
             
-            // Initialize Aceigy based on Roller configuration
+            // trigger bootstrapping process
+            RollerFactory.bootstrap();
+            
+            // Initialize Acegi based on Roller configuration
             initializeSecurityFeatures(servletContext);
             
             // Setup Velocity template engine
             setupVelocity();
-            
-            // This will cause instantiation and initialziation of Roller impl
-            Roller roller = RollerFactory.getRoller();
-            
-            // And this will schedule all configured tasks
-            roller.getThreadManager().startTasks();
             
         } catch (Throwable t) {
             log.fatal("Roller Weblogger initialization failed", t);



Mime
View raw message