KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > jforum > dao > DataAccessDriver


1 /*
2  * Copyright (c) Rafael Steil
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms,
6  * with or without modification, are permitted provided
7  * that the following conditions are met:
8  *
9  * 1) Redistributions of source code must retain the above
10  * copyright notice, this list of conditions and the
11  * following disclaimer.
12  * 2) Redistributions in binary form must reproduce the
13  * above copyright notice, this list of conditions and
14  * the following disclaimer in the documentation and/or
15  * other materials provided with the distribution.
16  * 3) Neither the name of "Rafael Steil" nor
17  * the names of its contributors may be used to endorse
18  * or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
22  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
24  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
27  * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
32  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
34  * IN CONTRACT, STRICT LIABILITY, OR TORT
35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
37  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
38  *
39  * This file creation date: Mar 3, 2003 / 1:37:05 PM
40  * The JForum Project
41  * http://www.jforum.net
42  */

43 package net.jforum.dao;
44
45
46
47
48 /**
49  * The class that every driver class must implement.
50  * JForum implementation provides a simple and extremely
51  * configurable way to use diferent database engines without
52  * any modification to the core source code.
53  * <br>
54  * For example, if you want to use the Database "XYZ" as
55  * backend, all you need to do is to implement <code>DataAccessDriver</code>,
56  * all *Model classes and a specific file with the SQL queries.
57  * <br>
58  * The default implementation was written to support MySQL, so if you want a base code to
59  * analise, look at <code>net.jforum.drivers.generic</code> package.
60  *
61  * @author Rafael Steil
62  * @version $Id: DataAccessDriver.java,v 1.9 2005/11/10 18:30:02 almilli Exp $
63  */

64 public abstract class DataAccessDriver
65 {
66     private static DataAccessDriver driver;
67     
68     protected DataAccessDriver() {}
69     
70     /**
71      * Starts the engine.
72      * This method should be called when the system
73      * is starting.
74      *
75      * @param implementation The dao.driver implementation
76      */

77     public static final void init(DataAccessDriver implementation)
78     {
79         driver = implementation;
80     }
81     
82     /**
83      * Gets a driver implementation instance.
84      * You MUST use this method when you want a instance
85      * of a valid <code>DataAccessDriver</code>. Never access
86      * the driver implementation directly.
87      *
88      * @return <code>DataAccessDriver</code> instance
89      */

90     public final static DataAccessDriver getInstance()
91     {
92         return driver;
93     }
94     
95     /**
96      * Gets a {@link net.jforum.dao.ForumDAO} instance.
97      *
98      * @return <code>net.jforum.model.ForumModel</code> instance
99      */

100     public abstract net.jforum.dao.ForumDAO newForumDAO();
101     
102     /**
103      * Gets a {@link net.jforum.dao.GroupDAO} instance
104      *
105      * @return <code>net.jforum.model.GroupModel</code> instance.
106      */

107     public abstract net.jforum.dao.GroupDAO newGroupDAO();
108     
109     /**
110      * Gets a {@link net.jforum.dao.PostDAO} instance.
111      *
112      * @return <code>net.jforum.model.PostModel</code> instance.
113      */

114     public abstract net.jforum.dao.PostDAO newPostDAO();
115     
116     /**
117      * Gets a {@link net.jforum.dao.PollDAO} instance.
118      *
119      * @return <code>net.jforum.model.PollModel</code> instance.
120      */

121     public abstract net.jforum.dao.PollDAO newPollDAO();
122     
123     /**
124      * Gets a {@link net.jforum.dao.RankingDAO} instance.
125      *
126      * @return <code>net.jforum.model.RankingModel</code> instance
127      */

128     public abstract net.jforum.dao.RankingDAO newRankingDAO();
129     
130     /**
131      * Gets a {@link net.jforum.dao.TopicDAO} instance.
132      *
133      * @return <code>net.jforum.model.TopicModel</code> instance.
134      */

135     public abstract net.jforum.dao.TopicDAO newTopicDAO();
136     
137     /**
138      * Gets an {@link net.jforum.dao.UserDAO} instance.
139      *
140      * @return <code>net.jforum.model.UserModel</code> instance.
141      */

142     public abstract net.jforum.dao.UserDAO newUserDAO();
143     
144     /**
145      * Gets an {@link net.jforum.dao.CategoryDAO} instance.
146      *
147      * @return <code>net.jforum.model.CategoryModel</code> instance.
148      */

149     public abstract net.jforum.dao.CategoryDAO newCategoryDAO();
150     
151     /**
152      * Gets an {@link net.jforum.dao.TreeGroupDAO} instance
153      *
154      * @return <code>net.jforum.model.TreeGroupModel</code> instance.
155      */

156     public abstract net.jforum.dao.TreeGroupDAO newTreeGroupDAO();
157
158     /**
159      * Gets a {@link net.jforum.dao.SmilieDAO} instance
160      *
161      * @return <code>net.jforum.model.SmilieModel</code> instance.
162      */

163     public abstract net.jforum.dao.SmilieDAO newSmilieDAO();
164     
165     /**
166      * Gets a {@link net.jforum.dao.SearchDAO} instance
167      *
168      * @return <code>net.jforum.model.SearchModel</code> instance
169      */

170     public abstract net.jforum.dao.SearchDAO newSearchDAO();
171     
172     /**
173      * Gets a {@link net.jforum.dao.SearchIndexerDAO} instance
174      *
175      * @return <code>net.jforum.model.SearchIndexerModel</code> instance
176      */

177     public abstract net.jforum.dao.SearchIndexerDAO newSearchIndexerDAO();
178     
179     /**
180      * Gets a {@link net.jforum.dao.security.GroupSecurityDAO} instance
181      *
182      * @return <code>net.jforum.model.security.GroupSecurityModel</code> instance
183      */

184     public abstract net.jforum.dao.security.GroupSecurityDAO newGroupSecurityDAO();
185
186     /**
187      * Gets a {@link net.jforum.model.security.PrivateMessageDAO} instance
188      *
189      * @return <code>link net.jforum.model.security.PrivateMessageModel</code> instance
190      */

191     public abstract net.jforum.dao.PrivateMessageDAO newPrivateMessageDAO();
192     
193     /**
194      * Gets a {@link net.jforum.dao.UserSessionDAO} instance
195      *
196      * @return <code>link net.jforum.model.UserSessionModel</code> instance
197      */

198     public abstract net.jforum.dao.UserSessionDAO newUserSessionDAO();
199     
200     /**
201      * Gets a {@link net.jforum.dao.ConfigDAO} instance
202      *
203      * @return <code>link net.jforum.model.ConfigModel</code> instance
204      */

205     public abstract net.jforum.dao.ConfigDAO newConfigDAO();
206     /**
207      * Gets a {@link net.jforum.dao.KarmaDAO} instance
208      *
209      * @return <code>link net.jforum.model.KarmaModel</code> instance
210      */

211     public abstract net.jforum.dao.KarmaDAO newKarmaDAO();
212     
213     /**
214      * Gets a {@link net.jforum.dao.BookmarkDAO} instance
215      *
216      * @return <code>link net.jforum.model.BookmarkModel</code> instance
217      */

218     public abstract net.jforum.dao.BookmarkDAO newBookmarkDAO();
219     
220     /**
221      * Gets a {@link net.jforum.dao.AttachmentDAO} instance
222      *
223      * @return <code>link net.jforum.model.AttachmentModel</code> instance
224      */

225     public abstract net.jforum.dao.AttachmentDAO newAttachmentDAO();
226     
227     /**
228      * Gets a {@link net.jforum.dao.ModerationDAO} instance
229      *
230      * @return <code>link net.jforum.model.ModerationModel</code> instance
231      */

232     public abstract net.jforum.dao.ModerationDAO newModerationDAO();
233     
234     /**
235      * Gets a {@link net.jforum.dao.ScheduledSearchIndexerDAO} instance
236      *
237      * @return <code>link net.jforum.model.ScheduledSearchIndexerModel</code> instance
238      */

239     public abstract net.jforum.dao.ScheduledSearchIndexerDAO newScheduledSearchIndexerDAO();
240
241     /**
242      * Gets an {@link net.jforum.dao.BannerDAO} instance.
243      *
244      * @return <code>net.jforum.dao.BannerDAO</code> instance.
245      */

246     public abstract net.jforum.dao.BannerDAO newBannerDAO();
247     
248     /**
249      * Gets an {@link net.jforum.dao.SummaryDAO} instance.
250      *
251      * @return <code>net.jforum.dao.SummaryDAO</code> instance.
252      */

253     public abstract SummaryDAO newSummaryDAO();
254 }
255
Popular Tags