/**
* $RCSfile: DbForum.java,v $
* $Revision: 1.1.1.1 $
* $Date: 2002/09/09 13:50:52 $
*
* New Jive from Jdon.com.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
*/
package com.jivesoftware.forum.database;
import java.util.*;
import java.util.Date;
import java.sql.*;
import java.io.*;
import com.jivesoftware.forum.*;
import com.jivesoftware.util.*;
/**
* Database implementation of the Forum interface. It loads and stores forum
* information from a a database.
*
* @see Forum
*/
public class DbForum implements Forum, Cacheable {
/** DATABASE QUERIES **/
private static final String ALL_THREADS =
"SELECT threadID from jiveThread WHERE forumID=?";
private static final String ADD_THREAD =
"UPDATE jiveThread set forumID=? WHERE threadID=?";
private static final String MOVE_MESSAGES =
"UPDATE jiveMessage set forumID=? WHERE threadID=?";
protected static final String DELETE_THREAD =
"DELETE FROM jiveThread WHERE threadID=?";
private static final String DELETE_THREAD_PROPERTIES =
"DELETE FROM jiveThreadProp WHERE threadID=?";
private static final String LOAD_PROPERTIES =
"SELECT name, propValue FROM jiveForumProp WHERE forumID=?";
private static final String DELETE_PROPERTY =
"DELETE FROM jiveForumProp WHERE forumID=? AND name=?";
private static final String DELETE_PROPERTIES =
"DELETE FROM jiveForumProp WHERE forumID=?";
private static final String INSERT_PROPERTY =
"INSERT INTO jiveForumProp(forumID,name,propValue) VALUES(?,?,?)";
private static final String LOAD_FORUM =
"SELECT forumID, name, description, modDefaultThreadVal, " +
"modDefaultMsgVal, modMinThreadVal, modMinMsgVal, modifiedDate, " +
"creationDate FROM jiveForum WHERE forumID=?";
private static final String ADD_FORUM =
"INSERT INTO jiveForum(forumID, name, description, modDefaultThreadVal, " +
"modDefaultMsgVal, modMinThreadVal, modMinMsgVal, modifiedDate, creationDate)" +
" VALUES (?,?,?,?,?,?,?,?,?)";
private static final String SAVE_FORUM =
"UPDATE jiveForum SET name=?, description=?, modDefaultThreadVal=?, " +
"modDefaultMsgVal=?, modMinThreadVal=?, modMinMsgVal=?, " +
"modifiedDate=?, creationDate=? WHERE forumID=?";
private static final String UPDATE_FORUM_MODIFIED_DATE =
"UPDATE jiveForum SET modifiedDate=? WHERE forumID=?";
private static final String POPULAR_THREADS =
"SELECT threadID, count(1) AS msgCount FROM jiveMessage WHERE " +
"modifiedDate > ? AND forumID=? GROUP BY threadID ORDER BY msgCount DESC";
private static final String POPULAR_THREADS_ORACLE =
"SELECT /*+ INDEX (jiveMessage jiveMessage_mDate_idx) */ threadID, " +
"count(1) AS msgCount FROM jiveMessage WHERE modifiedDate > ? " +
"AND forumID=? GROUP BY threadID ORDER BY msgCount DESC";
/*
// Note, the above query includes hints for Oracle, which are necessary
// so that modified date index will always be used. This is a great
// tradeoff when the time window you're looking at is not excessively
// large. MySQL also handles the query very quickly. If your own db
// needs a hint, you may want to edit the sql logic to add it.
*/
/**
* Controls whether extended properties should be lazily loaded (not loaded
* until requested). If the properties are infrequently used, this provides
* a great speedup in initial object loading time. However, if your
* application does use extended properties all the time, you may wish to
* turn lazy loading off, as it's actually faster in total db lookup time
* to load everything at once.
*/
private static final boolean LAZY_PROP_LOADING = true;
/**
* Number of threadID's per cache block.
*/
public static final int THREAD_BLOCK_SIZE = 200;
/**
* Number of messageID's per cache block.
*/
public static final int MESSAGE_BLOCK_SIZE = 100;
// Constant for an empty bock. This is returned in the case that there are
// no results when trying to load a thread or message block.
private static final long[] EMPTY_BLOCK = new long[0];
// A ResultFilter is used to filter and sort the values that are returned
// from the threads() and messages() methods. We use a default
private static final ResultFilter DEFAULT_THREAD_FILTER =
ResultFilter.createDefaultThreadFilter();
private static final ResultFilter DEFAULT_MESSAGE_FILTER =
ResultFilter.createDefaultMessageFilter();
/**
* Cache for lists of thread id's. The default size is 16K, which should
* let us hold about 2000 thread id's in memory at once. If you have a lot
* of memory and very large forums, you may wish to make the size of this
* cache considerably larger.
*/
protected Cache threadListCache = new Cache(16*1024, JiveGlobals.HOUR * 6);
/**
* Cache for lists of message id's. The default size is 8K, which should
* let us hold about 100 message id's in memory at once. If you have a lot
* of memory and very large forums, you may wish to make the size of this
* cache considerably larger.
*/
protected Cache messageListCache = new Cache(8*1024, JiveGlobals.HOUR * 6);
/**
* Cache for thread counts. Default size is 256 bytes.
*/
protected Cache threadCountCache = new Cache(256, JiveGlobals.HOUR * 6);
/**
* Cache for message counts. Default size is 256 bytes.
*/
protected Cache messageCountCache = new Cache(256, JiveGlobals.HOUR * 6);
private long id = -1;
private String name;
private String description;
private java.util.Date creationDate;
private java.util.Date modifiedDate;
private int modDefaultThreadValue = 1;
private int modDefaultMessageValue = 1;
private int modMinThreadValue = 1 ;
private int modMinMessageValue = 1;
private Map properties;
private DbForumFactory factory;
private long[] popularThreads = null;
private DbFilterManager filterManager;
/**
* Creates a new forum with the specified name and description.
*
* @param name the name of the forum.
* @param description the description of the forum.
* @param factory the DbForumFactory the forum is a part of.
*/
protected DbForum(String name, String description, DbForumFactory factory) {
this.id = SequenceManager.nextID(JiveGlobals.FORUM);
this.name = name;
this.description = description;
long now = System.currentTimeMillis();
creationDate = new java.util.Date(now);
modifiedDate = new java.util.Date(now);
this.factory = factory;
insertIntoDb();
properties = new Hashtable();
init();
}
/**
* Loads a forum with the specified id.
*/
protected DbForum(long id, DbForumFactory factory)
throws ForumNotFoundException
{
this.id = id;
this.factory = factory;
loadFromDb();
init();
}
private void init() {
filterManager = new DbFilterManager(this.id, factory);
}
//FROM THE FORUM INTERFACE//
public long getID() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) throws ForumAlreadyExistsException {
// If the new name is the same as the current name, do nothing.
if (this.name.equals(name)) {
return;
}
// If a forum with the new name already exists, throw an exception.
try {
// Check to make sure that's
没有合适的资源?快使用搜索试试~ 我知道了~
Jive+源码+资料+使用
共725个文件
class:214个
java:169个
gif:122个
3星 · 超过75%的资源 需积分: 10 25 下载量 145 浏览量
2009-12-20
11:13:57
上传
评论 3
收藏 6.05MB RAR 举报
温馨提示
Jive 是一个开放源码,服务器端的 Java 论坛软件 允许在展点上进行线程化的讨论,它提供了性能优秀的用户定义的 JSP 文件(用Jive的外壳)来完全改变论坛的外观、形象和功能。并提供了一个可植入的 API;
资源推荐
资源详情
资源评论
收起资源包目录
Jive+源码+资料+使用 (725个子文件)
click.aspx 2KB
click.aspx 2KB
click.aspx 2KB
click.aspx 2KB
click.aspx 2KB
click.aspx 2KB
click.aspx 2KB
click.aspx 2KB
CA0D67CX 10KB
CA0HU3GP 10KB
CA2ZW9YR 10KB
CA32OBJX 10KB
CACX4DWV 12KB
CAO56PRK 10KB
CAT4YDLJ 10KB
CAYZ2FYD 10KB
StudyJive.chm 1.83MB
DbForum.class 35KB
DbForumThread.class 26KB
DbForumFactory.class 20KB
DbGroup.class 19KB
DbForumMessage.class 16KB
DbPermissionsManager.class 16KB
DbUser.class 16KB
DbSearchManager.class 15KB
SkinUtils.class 15KB
DbDataImport.class 14KB
DbDataExport.class 14KB
DbWatchManager.class 13KB
JavaCodeViewer.class 13KB
JavaCodeViewer.class 12KB
JavaCodeHighlighter.class 11KB
DbUserManager.class 11KB
DbFilterManager.class 10KB
DefaultConnectionProvider$ConnectionPool.class 10KB
StringUtils.class 10KB
DbRewardManager.class 10KB
LongHashMap.class 9KB
ForumFactoryProxy.class 8KB
ProfiledConnection.class 8KB
ForumProxy.class 8KB
DbGroupManager.class 8KB
ConnectionManager.class 8KB
DbDataImport$MessageHandler.class 8KB
DbQuery.class 8KB
DisplayUtil.class 8KB
CodeViewer.class 7KB
DbTreeWalker.class 7KB
QuoteFilter.class 6KB
DbDataImport$ForumHandler.class 6KB
RandomStrg.class 6KB
PreparedStatementAdapter.class 6KB
DbDataImport$UserHandler.class 6KB
ForumThreadProxy.class 6KB
DefaultConnectionProvider.class 6KB
ConnectionAdapter.class 6KB
DatabaseCacheManager.class 6KB
JNDIDataSourceProvider.class 5KB
Emoticon.class 5KB
UploadImg.class 5KB
WatchManagerProxy.class 5KB
StatementAdapter.class 5KB
XMLProperties.class 5KB
MultipartFormHandle.class 5KB
ForumMessageProxy.class 5KB
EmailWatchUpdateTask.class 5KB
LongTree.class 5KB
BeanUtils.class 5KB
ImgHandle.class 5KB
JiveGlobals.class 5KB
ForumMessageBlockIterator.class 5KB
ParamUtils.class 5KB
UserProxy.class 5KB
Cache.class 5KB
ContextSecurityFilter.class 4KB
JulianDate.class 4KB
ForumThreadBlockIterator.class 4KB
ResultFilter.class 4KB
LongCache.class 4KB
CodeHighlighter.class 4KB
GroupProxy.class 4KB
DbDataImport$ThreadHandler.class 4KB
PermissionsManagerProxy.class 4KB
DbDataImport$UserPermissionListHandler.class 4KB
ForumFactory.class 4KB
DbWatchManager$DeleteWatchesTask.class 4KB
UserManagerProxy.class 4KB
TextStyle.class 4KB
EmailTask.class 4KB
ProfiledConnection$TimedPreparedStatement.class 4KB
JiveBeanInfo.class 4KB
ForumMessageFilter.class 3KB
DbDataImport$GroupPermissionListHandler.class 3KB
Profanity.class 3KB
SequenceManager.class 3KB
FileDeal.class 3KB
RewardManagerProxy.class 3KB
DataUnformatFilter.class 3KB
MultipartFormServ.class 3KB
Upload.class 3KB
共 725 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- ifm4442012-05-08可惜不是window版本的
- godspeed_wxw2012-03-12资料挺全的,不过可惜不是window版本的,去linux上试试看吧,不过还是感谢提供
然月枕流君
- 粉丝: 31
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功