001: /*
002: * Copyright (c) JForum Team
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms,
006: * with or without modification, are permitted provided
007: * that the following conditions are met:
008: *
009: * 1) Redistributions of source code must retain the above
010: * copyright notice, this list of conditions and the
011: * following disclaimer.
012: * 2) Redistributions in binary form must reproduce the
013: * above copyright notice, this list of conditions and
014: * the following disclaimer in the documentation and/or
015: * other materials provided with the distribution.
016: * 3) Neither the name of "Rafael Steil" nor
017: * the names of its contributors may be used to endorse
018: * or promote products derived from this software without
019: * specific prior written permission.
020: *
021: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
022: * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
023: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
024: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
025: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR
026: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
027: * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
028: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
029: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES
030: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
031: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
032: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
033: * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
034: * IN CONTRACT, STRICT LIABILITY, OR TORT
035: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
036: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
037: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
038: *
039: * This file creation date: Mar 3, 2003 / 1:37:05 PM
040: * The JForum Project
041: * http://www.jforum.net
042: */
043: package net.jforum.dao;
044:
045: /**
046: * The class that every driver class must implement.
047: * JForum implementation provides a simple and extremely
048: * configurable way to use diferent database engines without
049: * any modification to the core source code.
050: * <br>
051: * For example, if you want to use the Database "XYZ" as
052: * backend, all you need to do is to implement <code>DataAccessDriver</code>,
053: * all *Model classes and a specific file with the SQL queries.
054: * <br>
055: * The default implementation was written to support MySQL, so if you want a base code to
056: * analise, look at <code>net.jforum.drivers.generic</code> package.
057: *
058: * @author Rafael Steil
059: * @version $Id: DataAccessDriver.java,v 1.20 2007/07/28 20:07:18 rafaelsteil Exp $
060: */
061: public abstract class DataAccessDriver {
062: private static DataAccessDriver driver;
063:
064: protected DataAccessDriver() {
065: }
066:
067: /**
068: * Starts the engine.
069: * This method should be called when the system
070: * is starting.
071: *
072: * @param implementation The dao.driver implementation
073: */
074: public static void init(DataAccessDriver implementation) {
075: driver = implementation;
076: }
077:
078: /**
079: * Gets a driver implementation instance.
080: * You MUST use this method when you want a instance
081: * of a valid <code>DataAccessDriver</code>. Never access
082: * the driver implementation directly.
083: *
084: * @return <code>DataAccessDriver</code> instance
085: */
086: public static DataAccessDriver getInstance() {
087: return driver;
088: }
089:
090: /**
091: * Gets a {@link net.jforum.dao.ForumDAO} instance.
092: *
093: * @return <code>net.jforum.model.ForumModel</code> instance
094: */
095: public abstract ForumDAO newForumDAO();
096:
097: /**
098: * Gets a {@link net.jforum.dao.GroupDAO} instance
099: *
100: * @return <code>net.jforum.model.GroupModel</code> instance.
101: */
102: public abstract GroupDAO newGroupDAO();
103:
104: /**
105: * Gets a {@link net.jforum.dao.PostDAO} instance.
106: *
107: * @return <code>net.jforum.model.PostModel</code> instance.
108: */
109: public abstract PostDAO newPostDAO();
110:
111: /**
112: * Gets a {@link net.jforum.dao.PollDAO} instance.
113: *
114: * @return <code>net.jforum.model.PollModel</code> instance.
115: */
116: public abstract PollDAO newPollDAO();
117:
118: /**
119: * Gets a {@link net.jforum.dao.RankingDAO} instance.
120: *
121: * @return <code>net.jforum.model.RankingModel</code> instance
122: */
123: public abstract RankingDAO newRankingDAO();
124:
125: /**
126: * Gets a {@link net.jforum.dao.TopicDAO} instance.
127: *
128: * @return <code>net.jforum.model.TopicModel</code> instance.
129: */
130: public abstract TopicDAO newTopicDAO();
131:
132: /**
133: * Gets an {@link net.jforum.dao.UserDAO} instance.
134: *
135: * @return <code>net.jforum.model.UserModel</code> instance.
136: */
137: public abstract UserDAO newUserDAO();
138:
139: /**
140: * Gets an {@link net.jforum.dao.CategoryDAO} instance.
141: *
142: * @return <code>net.jforum.model.CategoryModel</code> instance.
143: */
144: public abstract CategoryDAO newCategoryDAO();
145:
146: /**
147: * Gets an {@link net.jforum.dao.TreeGroupDAO} instance
148: *
149: * @return <code>net.jforum.model.TreeGroupModel</code> instance.
150: */
151: public abstract TreeGroupDAO newTreeGroupDAO();
152:
153: /**
154: * Gets a {@link net.jforum.dao.SmilieDAO} instance
155: *
156: * @return <code>net.jforum.model.SmilieModel</code> instance.
157: */
158: public abstract SmilieDAO newSmilieDAO();
159:
160: /**
161: * Gets a {@link net.jforum.dao.GroupSecurityDAO} instance
162: *
163: * @return <code>net.jforum.model.security.GroupSecurityModel</code> instance
164: */
165: public abstract GroupSecurityDAO newGroupSecurityDAO();
166:
167: /**
168: * Gets a {@link net.jforum.dao.PrivateMessageDAO} instance
169: *
170: * @return <code>link net.jforum.model.security.PrivateMessageModel</code> instance
171: */
172: public abstract PrivateMessageDAO newPrivateMessageDAO();
173:
174: /**
175: * Gets a {@link net.jforum.dao.UserSessionDAO} instance
176: *
177: * @return <code>link net.jforum.model.UserSessionModel</code> instance
178: */
179: public abstract UserSessionDAO newUserSessionDAO();
180:
181: /**
182: * Gets a {@link net.jforum.dao.ConfigDAO} instance
183: *
184: * @return <code>link net.jforum.model.ConfigModel</code> instance
185: */
186: public abstract ConfigDAO newConfigDAO();
187:
188: /**
189: * Gets a {@link net.jforum.dao.KarmaDAO} instance
190: *
191: * @return <code>link net.jforum.model.KarmaModel</code> instance
192: */
193: public abstract KarmaDAO newKarmaDAO();
194:
195: /**
196: * Gets a {@link net.jforum.dao.BookmarkDAO} instance
197: *
198: * @return <code>link net.jforum.model.BookmarkModel</code> instance
199: */
200: public abstract BookmarkDAO newBookmarkDAO();
201:
202: /**
203: * Gets a {@link net.jforum.dao.AttachmentDAO} instance
204: *
205: * @return <code>link net.jforum.model.AttachmentModel</code> instance
206: */
207: public abstract AttachmentDAO newAttachmentDAO();
208:
209: /**
210: * Gets a {@link net.jforum.dao.ModerationDAO} instance
211: *
212: * @return <code>link net.jforum.model.ModerationModel</code> instance
213: */
214: public abstract ModerationDAO newModerationDAO();
215:
216: /**
217: * Gets an {@link net.jforum.dao.BannerDAO} instance.
218: *
219: * @return <code>net.jforum.dao.BannerDAO</code> instance.
220: */
221: public abstract BannerDAO newBannerDAO();
222:
223: /**
224: * Gets an {@link net.jforum.dao.SummaryDAO} instance.
225: *
226: * @return <code>net.jforum.dao.SummaryDAO</code> instance.
227: */
228: public abstract SummaryDAO newSummaryDAO();
229:
230: /**
231: * Gets a {@link net.jforum.dao.MailIntegrationDAO} instance.
232: *
233: * @return <code>net.jforum.dao.MailIntegrationDAO</code> instance.
234: */
235: public abstract MailIntegrationDAO newMailIntegrationDAO();
236:
237: /**
238: * Gets a {@link net.jforum.dao.ApiDAO} instance.
239: *
240: * @return <code>net.jforum.dao.ApiDAO</code> instance.
241: */
242: public abstract ApiDAO newApiDAO();
243:
244: public abstract BanlistDAO newBanlistDAO();
245:
246: public abstract ModerationLogDAO newModerationLogDAO();
247:
248: public abstract LuceneDAO newLuceneDAO();
249: }
|