KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > business > RollerImpl


1 /*
2  * RollerImpl.java
3  *
4  * Created on April 29, 2005, 5:33 PM
5  */

6
7 package org.roller.business;
8
9 import org.apache.commons.logging.Log;
10 import org.apache.commons.logging.LogFactory;
11 import org.roller.RollerException;
12 import org.roller.config.RollerConfig;
13 import org.roller.model.FileManager;
14 import org.roller.model.IndexManager;
15 import org.roller.model.Roller;
16 import org.roller.model.ThreadManager;
17 import org.roller.util.StringUtils;
18
19
20 /**
21  * The abstract version of the Roller implementation.
22  * Here we put code that pertains to *all* implementations of the Roller
23  * interface, regardless of their persistence strategy.
24  *
25  * @author Allen Gilliland
26  */

27 public abstract class RollerImpl implements Roller {
28     
29     private static Log mLogger =
30         LogFactory.getFactory().getInstance(RollerImpl.class);
31     
32     protected FileManager mFileManager = null;
33     protected IndexManager mIndexManager = null;
34     protected ThreadManager mThreadManager = null;
35     
36     
37     /** Creates a new instance of RollerImpl */
38     public RollerImpl() {
39         // nothing to do here yet
40
}
41     
42     
43     /**
44      * @see org.roller.model.Roller#getFileManager()
45      */

46     public FileManager getFileManager() throws RollerException
47     {
48         if (mFileManager == null)
49         {
50                 mFileManager = new FileManagerImpl();
51         }
52         return mFileManager;
53     }
54
55     /**
56      * @see org.roller.model.Roller#getThreadManager()
57      */

58     public ThreadManager getThreadManager() throws RollerException
59     {
60         if (mThreadManager == null)
61         {
62             mThreadManager = new ThreadManagerImpl();
63         }
64         return mThreadManager;
65     }
66
67     /**
68      * @see org.roller.model.Roller#getIndexManager()
69      */

70     public IndexManager getIndexManager() throws RollerException
71     {
72         if (mIndexManager == null)
73         {
74             mIndexManager = new IndexManagerImpl();
75         }
76         return mIndexManager;
77     }
78     
79     
80     public void release()
81     {
82         if (mFileManager != null) mFileManager.release();
83         if (mThreadManager != null) mThreadManager.release();
84     }
85     
86     
87     public void shutdown()
88     {
89         try
90         {
91             if (mIndexManager != null) mIndexManager.shutdown();
92             if (mThreadManager != null) mThreadManager.shutdown();
93         }
94         catch(Exception JavaDoc e)
95         {
96             mLogger.warn(e);
97         }
98     }
99 }
100
Popular Tags