|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.tigris.eyebrowse.EyebrowseDb
EyebrowseDb This class implements the object-relational mapping between the MySQL database and the Java objects used to represents elements in the database. All access to the database is done through the EyebrowseDb classes. The methods in this class affect the database only; they do not affect files outside the database (such as the text search index or the mailbox files.) EyebrowseDb connections are obtained through the static getConnection method and returned through the release method. The parameters used to find the database path, user name, password, etc, are obtained through the eyebrowse.properties file (or through the system properties) so that callers do not need to do anything to set up access to the eyebrowse database. This class also defines several classes for describing objects in the database, such as ListInfo, MessageInfo, etc.
Inner Class Summary | |
static class |
EyebrowseDb.ListFileInfo
ListFileInfo Describes the properties of a mailbox file in Eyebrowse |
static class |
EyebrowseDb.ListInfo
ListInfo Describes the properties of a mailing list in Eyebrowse |
static class |
EyebrowseDb.ListSummaryInfo
ListSummaryInfo Describes the results of a query summarizing a list by date, sender, subject, or thread |
static class |
EyebrowseDb.MessageInfo
MessageInfo Describes the properties of a mail message in Eyebrowse. |
Field Summary | |
protected static org.tigris.eyebrowse.util.EyebrowseLogger |
log
|
protected static int |
message_fieldCount
|
protected static java.lang.String |
message_fields
|
protected static java.lang.String |
messageExt_fields
|
protected static java.lang.String |
messageExt_joinCriteria
|
protected static java.lang.String |
messageExt_tables
|
protected static java.lang.String |
subjectMatchInterval
|
Method Summary | |
int |
Author_add(int listId,
java.lang.String name)
Add an author to the database |
int |
Author_find(int listId,
java.lang.String name)
Find an author by name. |
java.lang.String |
Author_get(int authorId)
Get the name of the author associated with a specific authorId. |
void |
close()
|
void |
DateSummaryCache_update(int listId)
|
protected void |
finalize()
|
static EyebrowseDb |
getConnection()
Static method used to obtain an EyebrowseDb connection. |
java.sql.Connection |
getJDBCConnection()
|
int |
List_add(java.lang.String listName,
java.lang.String listDescription)
Add a new list to the eyebrowse database. |
int |
List_add(java.lang.String listName,
java.lang.String listDescription,
int ID)
Add a new list to the eyebrowse database. |
void |
List_addIndex(int listId,
java.lang.String listFile)
Mark the list as indexed, and associate the list with the specified index file. |
int |
List_countAuthors(int listId)
Count the number of authors in the list. |
int |
List_countSubjects(int listId)
Count the number of subjects in the list. |
int |
List_countThreads(int listId)
Count the number of threads in the specified list. |
void |
List_delete(int listId)
Delete a list from the database. |
void |
List_deleteIndex(int listId)
Mark the list as nonindexed. |
int |
List_find(java.lang.String listName)
Find a list by name. |
EyebrowseDb.ListInfo |
List_get(int listId)
Get the ListInfo object for the specified list. |
EyebrowseDb.ListInfo |
List_get(java.lang.String listName)
Get the ListInfo object for the specified list. |
EyebrowseDb.ListInfo[] |
List_getAll()
|
EyebrowseDb.ListSummaryInfo[] |
List_summarizeByAuthor(int listId,
int startAt,
int max)
Summarize the specified list by author. |
EyebrowseDb.ListSummaryInfo[] |
List_summarizeByDate(int listId)
Summarize the specified list by date ranges. |
EyebrowseDb.ListSummaryInfo[] |
List_summarizeBySubject(int listId,
int startAt,
int max)
Summarize the specified list by subject. |
EyebrowseDb.ListSummaryInfo[] |
List_summarizeByThread(int listId,
int startAt,
int max)
Summarize the specified list by thread. |
void |
List_updateDescription(int listId,
java.lang.String description)
Updates description by listId |
void |
List_updateIndex(int listId,
int lastMsg)
Update the last-message-indexed value for the specified list. |
int |
ListFile_add(int listId,
java.lang.String fileName,
int firstMessageNumber,
int fileIndex,
boolean isActive)
Add a mailbox file to the specified list. |
int |
ListFile_find(java.lang.String filePath)
Find the fileId associated with the specified file. |
int |
ListFile_findActive(int listId)
Find the active file associated with a specific list. |
int |
ListFile_findLast(int listId)
Find the last file associated with a list. |
EyebrowseDb.ListFileInfo |
ListFile_get(int fileId)
Get information about a mailbox file. |
java.util.ArrayList |
ListFile_getAllFilePaths(int listId)
Creates a String array of all the list files for a given list id This is used if someone wants to remove the lists programmatically |
void |
ListFile_setActive(int fileId,
boolean active)
Mark the specified list file as being the active file in the list. |
int |
ListFile_updateMsgInfo(int fileId,
int messageCount,
int fileSize)
Update information related to which messages in this file have been processed. |
int |
Message_add(EyebrowseDb.MessageInfo mi)
Add a message to the database. |
int |
Message_countByAuthor(int listId,
int authorId)
Count the number of messages by a particular author in a particular list. |
int |
Message_countBySubject(int listId,
int subjectId)
Count the number of messages with a given subject in a list. |
int |
Message_countByThread(int listId,
int threadId)
Count the number of messages in the list in a particular thread. |
void |
Message_delete(int msgId)
Marks given msgId as dead in the db by setting its isDeleted field to 1 . |
EyebrowseDb.MessageInfo |
Message_get(int msgId)
Get the MessageInfo object associated with a particular message |
EyebrowseDb.MessageInfo |
Message_getByIdString(java.lang.String idString)
Find a message by it's MIME Message-ID string |
EyebrowseDb.MessageInfo |
Message_getSubjectRoot(EyebrowseDb.MessageInfo mi)
Find the first message whose subject matches the specified message (for purposes of creating threads.) |
java.util.Date |
Message_guessDate(int listId)
Attempt to guess a reasonable date for a new message in a list when the date in the message cannot be determined. |
void |
Message_setThread(int msgId,
int threadId)
Associate a message with a thread. |
EyebrowseDb.MessageInfo |
MessageExt_get(int msgId)
Get all the information associated with a particular message. |
EyebrowseDb.MessageInfo[] |
MessageExt_getAll(int listId,
int startAt,
int max)
Get information about all messages in a list. |
EyebrowseDb.MessageInfo[] |
MessageExt_getByAuthor(int listId,
int authorId,
int startAt,
int max)
Get information about messages with the specified author. |
EyebrowseDb.MessageInfo[] |
MessageExt_getByDate(int listId,
java.sql.Date fromDate,
java.sql.Date toDate,
int startAt,
int max)
Get information about messages from a specified date range. |
EyebrowseDb.MessageInfo |
MessageExt_getByNo(int listId,
int msgNo)
Retrieve information about a specific message. |
EyebrowseDb.MessageInfo[] |
MessageExt_getBySubject(int listId,
int subjectId,
int startAt,
int max)
Get information about messages with the specified subject. |
EyebrowseDb.MessageInfo[] |
MessageExt_getByThread(int threadId,
int startAt,
int max)
Get information about messages with the specified thread. |
EyebrowseDb.MessageInfo |
MessageExt_getByThreadNo(int threadId,
int msgNo)
Retrieve message information for the message with a specified threadId and msgNo |
EyebrowseDb.MessageInfo[] |
MessageExt_getChildren(EyebrowseDb.MessageInfo mi)
Get information about the messages which are direct replies to a specified message |
EyebrowseDb.MessageInfo |
MessageExt_getNext(EyebrowseDb.MessageInfo mi)
Get information about the next message in a list. |
EyebrowseDb.MessageInfo |
MessageExt_getPrev(EyebrowseDb.MessageInfo mi)
Get information about the previous message in the list |
EyebrowseDb.MessageInfo |
MessageExt_getThreadNext(EyebrowseDb.MessageInfo mi)
Retrieve information about the next message in a thread. |
EyebrowseDb.MessageInfo |
MessageExt_getThreadPrev(EyebrowseDb.MessageInfo mi)
Get information about the previous message in a thread |
void |
MessageId_add(int listId,
int messageId,
java.lang.String idString)
Associate a message with a Message-ID string |
int |
MessageId_find(java.lang.String idString,
int listId)
Find a message by it's Message-ID string |
void |
release()
To be called when a task is finished with the connection, so the connection can be closed or returned to the pool. |
int |
Subject_add(int listId,
java.lang.String subject)
Add a subject to the database |
int |
Subject_find(int listId,
java.lang.String subject)
Find a subject by text. |
java.lang.String |
Subject_get(int subjectId)
Get the subject text associated with a specific subject. |
int |
Thread_add(int listId,
int firstMsg)
Add a thread to the database |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String subjectMatchInterval
protected static org.tigris.eyebrowse.util.EyebrowseLogger log
protected static final java.lang.String message_fields
protected static final int message_fieldCount
protected static final java.lang.String messageExt_fields
protected static final java.lang.String messageExt_tables
protected static final java.lang.String messageExt_joinCriteria
Method Detail |
public java.sql.Connection getJDBCConnection()
public void close() throws java.sql.SQLException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
public static EyebrowseDb getConnection() throws java.sql.SQLException
java.sql.SQLException
- public void release()
public int List_add(java.lang.String listName, java.lang.String listDescription) throws java.sql.SQLException
listName
- listDescription
- java.sql.SQLException
- public int List_add(java.lang.String listName, java.lang.String listDescription, int ID) throws java.sql.SQLException
listName
- listDescription
- java.sql.SQLException
- public void List_addIndex(int listId, java.lang.String listFile) throws java.sql.SQLException
listId
- listFile
- java.sql.SQLException
- public void List_updateIndex(int listId, int lastMsg) throws java.sql.SQLException
listId
- lastMsg
- java.sql.SQLException
- public void List_deleteIndex(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public int List_find(java.lang.String listName) throws java.sql.SQLException
listName
- java.sql.SQLException
- public EyebrowseDb.ListInfo List_get(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public EyebrowseDb.ListInfo List_get(java.lang.String listName) throws java.sql.SQLException
listName
- java.sql.SQLException
- public EyebrowseDb.ListInfo[] List_getAll() throws java.sql.SQLException
public void DateSummaryCache_update(int listId) throws java.sql.SQLException
public EyebrowseDb.ListSummaryInfo[] List_summarizeByDate(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public EyebrowseDb.ListSummaryInfo[] List_summarizeByAuthor(int listId, int startAt, int max) throws java.sql.SQLException
listId
- startAt
- If it is desired to access the summaries in pages,
the index into the list of authors at which to start summarizing.max
- If it is desired to access the summaries in pages, the
maximum number of summaries to return.java.sql.SQLException
- public EyebrowseDb.ListSummaryInfo[] List_summarizeBySubject(int listId, int startAt, int max) throws java.sql.SQLException
listId
- startAt
- If it is desired to access the summaries in pages,
the index into the list of authors at which to start summarizing.max
- If it is desired to access the summaries in pages, the
maximum number of summaries to return.java.sql.SQLException
- public EyebrowseDb.ListSummaryInfo[] List_summarizeByThread(int listId, int startAt, int max) throws java.sql.SQLException
listId
- startAt
- If it is desired to access the summaries in pages,
the index into the list of threads at which to start summarizing.max
- If it is desired to access the summaries in pages, the
maximum number of summaries to return.java.sql.SQLException
- public int List_countThreads(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public int List_countAuthors(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public int List_countSubjects(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public void List_delete(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public int ListFile_find(java.lang.String filePath) throws java.sql.SQLException
filePath
- java.sql.SQLException
- public int ListFile_findActive(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public int ListFile_findLast(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public void ListFile_setActive(int fileId, boolean active) throws java.sql.SQLException
fileId
- active
- java.sql.SQLException
- public EyebrowseDb.ListFileInfo ListFile_get(int fileId) throws java.sql.SQLException
fileId
- null
if the file
could not be found in the database.java.sql.SQLException
- public int ListFile_add(int listId, java.lang.String fileName, int firstMessageNumber, int fileIndex, boolean isActive) throws java.sql.SQLException
listId
- The list to which we are adding the file.fileName
- The absolute path to the new file.firstMessageNumber
- The message number that will be
associated with the first message in this file.fileIndex
- The index of the file into the list of files
associated with this list.isActive
- Whether or not this file should be marked active.
Only mark a new file as active if you have ensured that no other
file is active.java.sql.SQLException
- public int ListFile_updateMsgInfo(int fileId, int messageCount, int fileSize) throws java.sql.SQLException
fileId
- The mailbox file for which we are updating informationmessageCount
- The total number of messages in this mailbox
we have already processedfileSize
- The offset, in bytes, of the last byte of the
last message we have processed.java.sql.SQLException
- public java.util.ArrayList ListFile_getAllFilePaths(int listId) throws java.sql.SQLException
public void List_updateDescription(int listId, java.lang.String description) throws java.sql.SQLException
listId
- list to updatedescription
- new value for fieldjava.sql.SQLException
- public int Author_find(int listId, java.lang.String name) throws java.sql.SQLException
listId
- The list which we are searching (authors are
defined on a per-list basis)name
- The name of the author we are searching for (must
match exactly)java.sql.SQLException
- public int Author_add(int listId, java.lang.String name) throws java.sql.SQLException
listId
- The list with which to associate this author
(authors are defined on a per-list basis)name
- The name of this authorjava.sql.SQLException
- public java.lang.String Author_get(int authorId) throws java.sql.SQLException
authorId
- java.sql.SQLException
- public int Subject_find(int listId, java.lang.String subject) throws java.sql.SQLException
listId
- The list which we are searching (subjects are
defined on a per-list basis)name
- The text of the subject we are searching for (must
match exactly)java.sql.SQLException
- public int Subject_add(int listId, java.lang.String subject) throws java.sql.SQLException
listId
- The list with which to associate this subject
(subjects are defined on a per-list basis)subject
- The text of this subjectjava.sql.SQLException
- public java.lang.String Subject_get(int subjectId) throws java.sql.SQLException
subjectId
- java.sql.SQLException
- public int Thread_add(int listId, int firstMsg) throws java.sql.SQLException
listId
- firstMsg
- The messageId of the first message in this threadjava.sql.SQLException
- public int MessageId_find(java.lang.String idString, int listId) throws java.sql.SQLException
idString
- java.sql.SQLException
- public void MessageId_add(int listId, int messageId, java.lang.String idString) throws java.sql.SQLException
listId
- The list this message comes frommessageId
- The messageId (database identifer) of the messageidString
- The Message-ID (from the Message-ID MIME
headeroken) of the messagejava.sql.SQLException
- public int Message_add(EyebrowseDb.MessageInfo mi) throws java.sql.SQLException
mi
- A MessageInfo object describing the message. Only the
'basic' fields of the MessageInfo object are added.java.sql.SQLException
- public EyebrowseDb.MessageInfo Message_get(int msgId) throws java.sql.SQLException
msgId
- java.sql.SQLException
- public EyebrowseDb.MessageInfo Message_getByIdString(java.lang.String idString) throws java.sql.SQLException
idString
- java.sql.SQLException
- public void Message_setThread(int msgId, int threadId) throws java.sql.SQLException
msgId
- threadId
- java.sql.SQLException
- public EyebrowseDb.MessageInfo Message_getSubjectRoot(EyebrowseDb.MessageInfo mi) throws java.sql.SQLException
mi
- MessageInfo object describing a message whose subject
we want to match.java.sql.SQLException
- public java.util.Date Message_guessDate(int listId) throws java.sql.SQLException
listId
- java.sql.SQLException
- public int Message_countByThread(int listId, int threadId) throws java.sql.SQLException
listId
- threadId
- java.sql.SQLException
- public int Message_countByAuthor(int listId, int authorId) throws java.sql.SQLException
listId
- authorId
- java.sql.SQLException
- public int Message_countBySubject(int listId, int subjectId) throws java.sql.SQLException
listId
- subjectId
- java.sql.SQLException
- public EyebrowseDb.MessageInfo MessageExt_get(int msgId) throws java.sql.SQLException
msgId
- java.sql.SQLException
- public EyebrowseDb.MessageInfo[] MessageExt_getByDate(int listId, java.sql.Date fromDate, java.sql.Date toDate, int startAt, int max) throws java.sql.SQLException
listId
- The list we are interested infromDate
- The beginning date of the date range we are interested intoDate
- The ending date of the date range we are interested instartAt
- For paging. The index into the query results of
the first message we want to retrieve.max
- For paging. The maximum number of messages to return.java.sql.SQLException
- public EyebrowseDb.MessageInfo[] MessageExt_getByAuthor(int listId, int authorId, int startAt, int max) throws java.sql.SQLException
listId
- The list we are interested inauthorId
- The author we are interested instartAt
- For paging. The index into the query results of
the first message we want to retrieve.max
- For paging. The maximum number of messages to return.java.sql.SQLException
- public EyebrowseDb.MessageInfo[] MessageExt_getBySubject(int listId, int subjectId, int startAt, int max) throws java.sql.SQLException
listId
- The list we are interested insubjectId
- The subject we are interested instartAt
- For paging. The index into the query results of
the first message we want to retrieve.max
- For paging. The maximum number of messages to return.java.sql.SQLException
- public EyebrowseDb.MessageInfo[] MessageExt_getByThread(int threadId, int startAt, int max) throws java.sql.SQLException
listId
- The list we are interested inthreadId
- The thread we are interested instartAt
- For paging. The index into the query results of
the first message we want to retrieve.max
- For paging. The maximum number of messages to return.java.sql.SQLException
- public EyebrowseDb.MessageInfo MessageExt_getByNo(int listId, int msgNo) throws java.sql.SQLException
listId
- msgNo
- java.sql.SQLException
- public EyebrowseDb.MessageInfo[] MessageExt_getAll(int listId, int startAt, int max) throws java.sql.SQLException
listId
- The list we are interested instartAt
- For paging. The index into the query results of
the first message we want to retrieve.max
- For paging. The maximum number of messages to return.java.sql.SQLException
- public EyebrowseDb.MessageInfo MessageExt_getNext(EyebrowseDb.MessageInfo mi) throws java.sql.SQLException
mi
- A MessageInfo object describing the messagejava.sql.SQLException
- public EyebrowseDb.MessageInfo MessageExt_getPrev(EyebrowseDb.MessageInfo mi) throws java.sql.SQLException
mi
- A MessageInfo object describing a messagejava.sql.SQLException
- public EyebrowseDb.MessageInfo MessageExt_getByThreadNo(int threadId, int msgNo) throws java.sql.SQLException
threadId
- msgNo
- java.sql.SQLException
- public EyebrowseDb.MessageInfo MessageExt_getThreadNext(EyebrowseDb.MessageInfo mi) throws java.sql.SQLException
mi
- A MessageInfo object describing the messagejava.sql.SQLException
- public EyebrowseDb.MessageInfo MessageExt_getThreadPrev(EyebrowseDb.MessageInfo mi) throws java.sql.SQLException
mi
- A MessageInfo object describing the messagejava.sql.SQLException
- public EyebrowseDb.MessageInfo[] MessageExt_getChildren(EyebrowseDb.MessageInfo mi) throws java.sql.SQLException
mi
- A MessageInfo object describing the messagejava.sql.SQLException
- public void Message_delete(int msgId) throws java.sql.SQLException
1
. Before the isDeleted field was added,
this was accomplished by setting the msgNo to -1
.
Messages which were deleted using that method are only viewable
by msgId.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |