1 18 23 package org.apache.roller.business; 24 25 import java.sql.Connection ; 26 import org.apache.commons.logging.Log; 27 import org.apache.commons.logging.LogFactory; 28 import org.apache.roller.RollerException; 29 import org.apache.roller.business.referrers.ReferrerQueueManager; 30 import org.apache.roller.business.referrers.ReferrerQueueManagerImpl; 31 import org.apache.roller.business.utils.UpgradeDatabase; 32 import org.apache.roller.model.FileManager; 33 import org.apache.roller.model.IndexManager; 34 import org.apache.roller.model.PluginManager; 35 import org.apache.roller.model.Roller; 36 import org.apache.roller.model.ThemeManager; 37 import org.apache.roller.model.ThreadManager; 38 39 40 47 public abstract class RollerImpl implements Roller { 48 49 private static Log mLogger = LogFactory.getLog(RollerImpl.class); 50 51 private FileManager fileManager = null; 52 private IndexManager indexManager = null; 53 private ThreadManager threadManager = null; 54 private ThemeManager themeManager = null; 55 private PluginManager pluginManager = null; 56 57 58 public RollerImpl() { 59 } 61 62 63 66 public FileManager getFileManager() throws RollerException { 67 if (fileManager == null) { 68 fileManager = new FileManagerImpl(); 69 } 70 return fileManager; 71 } 72 73 74 77 public ThreadManager getThreadManager() throws RollerException { 78 if (threadManager == null) { 79 threadManager = new ThreadManagerImpl(); 80 } 81 return threadManager; 82 } 83 84 85 88 public IndexManager getIndexManager() throws RollerException { 89 if (indexManager == null) { 90 indexManager = new IndexManagerImpl(); 91 } 92 return indexManager; 93 } 94 95 96 99 public ThemeManager getThemeManager() throws RollerException { 100 if (themeManager == null) { 101 themeManager = new ThemeManagerImpl(); 102 } 103 return themeManager; 104 } 105 106 107 110 public ReferrerQueueManager getReferrerQueueManager() { 111 return ReferrerQueueManagerImpl.getInstance(); 112 } 113 114 115 118 public PluginManager getPagePluginManager() throws RollerException { 119 if (pluginManager == null) { 120 pluginManager = new PluginManagerImpl(); 121 } 122 return pluginManager; 123 } 124 125 126 public void release() { 127 try { 128 if (fileManager != null) fileManager.release(); 129 if (threadManager != null) threadManager.release(); 130 if (pluginManager != null) pluginManager.release(); 131 } catch(Throwable e) { 132 mLogger.error("Error calling Roller.release()", e); 133 } 134 } 135 136 137 public void shutdown() { 138 try { 139 if (getReferrerQueueManager() != null) getReferrerQueueManager().shutdown(); 140 if (indexManager != null) indexManager.shutdown(); 141 if (threadManager != null) threadManager.shutdown(); 142 } catch(Throwable e) { 143 mLogger.error("Error calling Roller.shutdown()", e); 144 } 145 } 146 147 } 148 | Popular Tags |