roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r366267 - /incubator/roller/trunk/src/org/roller/business/RollerImpl.java
Date Thu, 05 Jan 2006 20:05:58 GMT
Author: snoopdave
Date: Thu Jan  5 12:05:56 2006
New Revision: 366267

URL: http://svn.apache.org/viewcvs?rev=366267&view=rev
Log:
Making manager fields common (so JDO implementation can share them)

Modified:
    incubator/roller/trunk/src/org/roller/business/RollerImpl.java

Modified: incubator/roller/trunk/src/org/roller/business/RollerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/RollerImpl.java?rev=366267&r1=366266&r2=366267&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/RollerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/RollerImpl.java Thu Jan  5 12:05:56 2006
@@ -5,15 +5,32 @@
  */
 package org.roller.business;
 
+import java.sql.Connection;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.roller.RollerException;
+
+import org.roller.business.utils.UpgradeDatabase;
+
+import org.roller.model.AutoPingManager;
+import org.roller.model.BookmarkManager;
+import org.roller.model.ConfigManager;
 import org.roller.model.FileManager;
 import org.roller.model.IndexManager;
 import org.roller.model.PagePluginManager;
+import org.roller.model.PingQueueManager;
+import org.roller.model.PingTargetManager;
+import org.roller.model.PlanetManager;
+import org.roller.model.PropertiesManager;
+import org.roller.model.RefererManager;
 import org.roller.model.Roller;
 import org.roller.model.ThemeManager;
 import org.roller.model.ThreadManager;
+import org.roller.pojos.UserData;
+import org.roller.model.UserManager;
+import org.roller.model.WeblogManager;
 
 /**
  * The abstract version of the Roller implementation.
@@ -32,6 +49,16 @@
     protected ThreadManager mThreadManager = null;
     protected ThemeManager  mThemeManager = null;
     protected PagePluginManager mPluginManager = null;
+    protected BookmarkManager mBookmarkManager;   
+    protected PropertiesManager mPropsManager = null;
+    protected PlanetManager   mPlanetManager = null;
+    protected RefererManager  mRefererManager;
+    protected UserManager     mUserManager;
+    protected WeblogManager   mWeblogManager;
+    protected PingQueueManager mPingQueueManager;
+    protected AutoPingManager mAutoPingManager;
+    protected PingTargetManager mPingTargetManager;
+    protected PersistenceStrategy mStrategy = null;
     
     /** Creates a new instance of RollerImpl */
     public RollerImpl() {
@@ -94,10 +121,204 @@
         if (mFileManager != null) mFileManager.release();
         if (mThreadManager != null) mThreadManager.release();
         if (mPluginManager != null) mPluginManager.release();
+        if (mBookmarkManager != null) mBookmarkManager.release();
+        if (mRefererManager != null) mRefererManager.release();
+        if (mUserManager != null) mUserManager.release();
+        if (mWeblogManager != null) mWeblogManager.release();
+        if (mPingTargetManager != null) mPingTargetManager.release();
+        if (mPingQueueManager != null) mPingQueueManager.release();
+        if (mAutoPingManager != null) mAutoPingManager.release();
+        
+        try
+        {
+            if (mStrategy != null) mStrategy.release(); 
+        }
+        catch (Throwable e)
+        {
+            mLogger.error(
+            "Exception with mSupport.release() [" + e + "]", e);
+        }
     }
     
+    public void begin() throws RollerException {
+        mStrategy.begin(UserData.ANONYMOUS_USER);
+    }
+    
+    public void begin(UserData user) throws RollerException {
+        mStrategy.begin(user);
+    }
     
-    public void shutdown() {
+    public UserData getUser() throws RollerException {
+        return mStrategy.getUser();
+    }
+
+    public void setUser(UserData user) throws RollerException {
+        mStrategy.setUser(user);
+    }
+
+    public void commit() throws RollerException {
+        mStrategy.commit();
+    }
+
+    public void rollback() {
+        try {
+            mStrategy.rollback();
+        } catch (Throwable e) {
+            mLogger.error(e);
+        }
+    }
+
+    /** */
+    protected UserManager createUserManager() {
+        throw new NullPointerException();
+    }
+
+    /** 
+     * @see org.roller.model.Roller#getUserManager()
+     */
+    public UserManager getUserManager() throws RollerException {
+        if (mUserManager == null) {
+            mUserManager = createUserManager();
+        }
+        return mUserManager;
+    }
+
+    /** */
+    protected BookmarkManager createBookmarkManager() {
+        throw new NullPointerException();
+    }
+
+    /** 
+     * @see org.roller.model.Roller#getBookmarkManager()
+     */
+    public BookmarkManager getBookmarkManager() throws RollerException {
+        if ( mBookmarkManager == null )  {
+            mBookmarkManager = createBookmarkManager();
+        }
+        return mBookmarkManager;
+    }
+
+    /** */
+    protected WeblogManager createWeblogManager() {
+        throw new NullPointerException();
+    }
+
+    /** 
+     * @see org.roller.model.Roller#getWeblogManager()
+     */
+    public WeblogManager getWeblogManager() throws RollerException {
+        if ( mWeblogManager == null )  {
+            mWeblogManager = createWeblogManager();
+        }
+        return mWeblogManager;
+    }
+
+    /** */
+    protected RefererManager createRefererManager() {
+        throw new NullPointerException();
+    }
+
+    /** 
+     * @see org.roller.model.Roller#getRefererManager()
+     */
+    public RefererManager getRefererManager() throws RollerException {
+        if (mRefererManager == null) {
+            mRefererManager = createRefererManager();
+        }
+        return mRefererManager;
+    }
+
+    /**
+     * @see org.roller.model.Roller#getConfigManager()
+     */
+    public ConfigManager getConfigManager() throws RollerException 
+    {
+        throw new RollerException("getConfigManager is Deprecated.");
+    }
+    
+    /** */
+    protected PropertiesManager createPropertiesManager() {
+        throw new NullPointerException();
+    }
+
+    /**
+     * @see org.roller.model.Roller#getPropertiesManager()
+     */
+    public PropertiesManager getPropertiesManager() throws RollerException {
+        if (mPropsManager == null) {
+            mPropsManager = createPropertiesManager();
+        }
+        return mPropsManager;
+    }
+
+    /** */
+    protected PingQueueManager createPingQueueManager() {
+        throw new NullPointerException();
+    }
+
+    /**
+     * @see org.roller.model.Roller#getPingTargetManager()
+     */
+    public PingQueueManager getPingQueueManager() throws RollerException {
+        if (mPingQueueManager == null) {
+            mPingQueueManager = createPingQueueManager();
+        }
+        return mPingQueueManager;
+    }
+
+    /** */
+    protected PlanetManager createPlanetManager() {
+        throw new NullPointerException();
+    }
+
+    /**
+     * @see org.roller.model.Roller#getPlanetManager()
+     */
+    public PlanetManager getPlanetManager() throws RollerException {
+        if ( mPlanetManager == null ) {
+            mPlanetManager = createPlanetManager();
+        }
+        return mPlanetManager;
+    }
+
+    /** */
+    protected  AutoPingManager createAutoPingManager() {
+        throw new NullPointerException();
+    }
+
+    /**
+     * @see org.roller.model.Roller#getPingTargetManager()
+     */
+    public AutoPingManager getAutopingManager() throws RollerException {
+        if (mAutoPingManager == null) {
+            mAutoPingManager = createAutoPingManager();
+        }
+        return mAutoPingManager;
+    }
+
+    /** */
+    protected PingTargetManager createPingTargetManager() {
+        throw new NullPointerException();
+    }
+
+    /**
+     * @see org.roller.model.Roller#getPingTargetManager()
+     */
+    public PingTargetManager getPingTargetManager() throws RollerException {
+        if (mPingTargetManager == null) {
+            mPingTargetManager = createPingTargetManager();
+        }
+        return mPingTargetManager;
+    }
+
+    /**
+     * @see org.roller.model.Roller#upgradeDatabase(java.sql.Connection)
+     */
+    public void upgradeDatabase(Connection con) throws RollerException {
+        UpgradeDatabase.upgradeDatabase(con);
+    }
+
+     public void shutdown() {
         try {
             if (mIndexManager != null) mIndexManager.shutdown();
             if (mThreadManager != null) mThreadManager.shutdown();



Mime
View raw message