public class DBFolder
extends javax.mail.Folder
A subclass of javax.mail.Folder providing storage for MimeMessages at database LONGVARBINARY columns and MBOX files.
Folders are also a subclass of com.knowgate.hipergate.CategoryModifier and Type | Field and Description |
---|---|
static short |
ClassId |
static int |
MODE_BLOB |
static int |
MODE_MBOX |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
appendMessage(javax.mail.internet.MimeMessage oMsg) |
void |
appendMessages(javax.mail.Message[] msgs)
Append messages to this DBFolder
|
void |
close(boolean expunge)
Close this folder
|
java.lang.String |
copyMessage(DBMimeMessage oSrcMsg)
Copy a DBMimeMessage from another DBFolder to this DBFolder
|
boolean |
create(int type)
This method is not implemented and will always raise UnsupportedOperationException
|
boolean |
create(java.lang.String sFolderName)
Create DBFolder with given name under current user mailroot Category
|
boolean |
delete(boolean recurse)
Wipe all messages and delete this folder
|
boolean |
exists() |
javax.mail.Message[] |
expunge()
Expunge deleted messages
This method removes from the database and the MBOX file those messages flagged
as deleted at k_mime_msgs table
|
Category |
getCategory()
Get instance of com.knowgate.hipergate.Category object
|
java.lang.String |
getCategoryGuid()
Get Category GUID
Each folder has a Global Unique Identifier which is stored at column
gu_category of table k_categories
|
java.lang.String |
getDirectoryPath()
Get path to directory containing files belonging to this folder
|
java.io.File |
getFile()
Get MBOX file that holds messages for this DBFolder
|
java.lang.String |
getFilePath()
Get full path to MBOX file containing mime messages
|
javax.mail.Folder |
getFolder(java.lang.String name)
Get folder by name or GUID
|
java.lang.String |
getFullName()
Get category subpath to directory holding MBOX files for this folder
The category path is composed by concatenating the names of all the parent
folders separated by a slash.
|
javax.mail.Message |
getMessage(int msgnum) |
DBMimeMessage |
getMessageByGuid(java.lang.String sMsgGuid) |
DBMimeMessage |
getMessageByID(java.lang.String sMsgId) |
int |
getMessageCount() |
java.util.Properties |
getMessageHeaders(java.lang.String sMsgId)
Get message GUID, Id, Number, Subject, From and Reply-To from k_mime_msgs table
This method is mainly used for testing whether or not a message is already present at current folder.
|
java.lang.String |
getName()
Get column nm_category from table k_categories for this folder
|
javax.mail.Folder |
getParent() |
javax.mail.Flags |
getPermanentFlags() |
char |
getSeparator() |
int |
getType() |
javax.mail.URLName |
getURLName() |
boolean |
hasNewMessages()
This method is not implemented and will always raise UnsupportedOperationException
|
int |
importMbox(java.lang.String sMboxFilePath) |
boolean |
isOpen() |
DBKeySet |
keySet()
Get set of identifiers for messages at this folder
Set entries are the mime identifiers for each message
|
javax.mail.Folder[] |
list(java.lang.String pattern) |
java.lang.String[] |
listMessages()
Get a list of all messages in this folder which are not deleted
|
void |
moveMessage(DBMimeMessage oSrcMsg)
Move a DBMimeMessage from another DBFolder to this DBFolder
|
void |
open(int mode)
Open this DBFolder
|
void |
reindexMbox()
Delete very message from th eindex and rebuild it by reading the default MBOX file for this folder
|
void |
reindexMbox(java.lang.String sMboxFilePath)
Delete every message from the index and rebuild it by re-reading the specified MBOX file
|
boolean |
renameTo(javax.mail.Folder f) |
void |
wipe()
Delete all messages from this folder and clear MBOX file
|
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, fetch, getDeletedMessageCount, getMessages, getMessages, getMessages, getMode, getNewMessageCount, getStore, getUnreadMessageCount, isSubscribed, list, listSubscribed, listSubscribed, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, search, search, setFlags, setFlags, setFlags, setSubscribed, toString
public static final int MODE_MBOX
public static final int MODE_BLOB
public static final short ClassId
public Category getCategory()
public java.lang.String getCategoryGuid()
Get Category GUID
Each folder has a Global Unique Identifier which is stored at column gu_category of table k_categoriespublic DBKeySet keySet() throws java.sql.SQLException
Get set of identifiers for messages at this folder
Set entries are the mime identifiers for each messagejava.sql.SQLException
public void appendMessages(javax.mail.Message[] msgs) throws javax.mail.MessagingException, java.lang.ArrayIndexOutOfBoundsException
appendMessages
in class javax.mail.Folder
msgs
- Array of mime messages to be appendedjavax.mail.MessagingException
java.lang.ArrayIndexOutOfBoundsException
public java.lang.String copyMessage(DBMimeMessage oSrcMsg) throws javax.mail.MessagingException
oSrcMsg
- Source message.javax.mail.MessagingException
public void moveMessage(DBMimeMessage oSrcMsg) throws javax.mail.MessagingException
oSrcMsg
- Source messagejavax.mail.MessagingException
public boolean create(int type) throws javax.mail.MessagingException
create
in class javax.mail.Folder
java.lang.UnsupportedOperationException
javax.mail.MessagingException
public boolean create(java.lang.String sFolderName) throws javax.mail.MessagingException
sFolderName
- Folder Namejavax.mail.MessagingException
public void open(int mode) throws javax.mail.MessagingException
open
in class javax.mail.Folder
mode
- {READ_ONLY|READ_WRITE}javax.mail.MessagingException
public void close(boolean expunge) throws javax.mail.MessagingException
close
in class javax.mail.Folder
expunge
- javax.mail.MessagingException
public boolean delete(boolean recurse) throws javax.mail.MessagingException
delete
in class javax.mail.Folder
recurse
- booleanjavax.mail.MessagingException
public javax.mail.Folder getFolder(java.lang.String name) throws javax.mail.MessagingException
getFolder
in class javax.mail.Folder
name
- String Folder name or GUIDjavax.mail.MessagingException
public boolean hasNewMessages() throws javax.mail.MessagingException
hasNewMessages
in class javax.mail.Folder
java.lang.UnsupportedOperationException
javax.mail.MessagingException
public boolean renameTo(javax.mail.Folder f) throws javax.mail.MessagingException, javax.mail.StoreClosedException, java.lang.NullPointerException
renameTo
in class javax.mail.Folder
javax.mail.MessagingException
javax.mail.StoreClosedException
java.lang.NullPointerException
public boolean exists() throws javax.mail.MessagingException, javax.mail.StoreClosedException
exists
in class javax.mail.Folder
javax.mail.MessagingException
javax.mail.StoreClosedException
public javax.mail.Message[] expunge() throws javax.mail.MessagingException
Expunge deleted messages
This method removes from the database and the MBOX file those messages flagged as deleted at k_mime_msgs tableexpunge
in class javax.mail.Folder
javax.mail.MessagingException
public void wipe() throws javax.mail.MessagingException
javax.mail.MessagingException
public java.lang.String getFullName()
Get category subpath to directory holding MBOX files for this folder
The category path is composed by concatenating the names of all the parent folders separated by a slash. The name of a folder is stored at column nm_category of table k_categoriesgetFullName
in class javax.mail.Folder
public java.lang.String getDirectoryPath()
public java.lang.String getFilePath() throws java.lang.NullPointerException
java.lang.NullPointerException
public java.io.File getFile()
java.lang.NullPointerException
public java.lang.String getName()
getName
in class javax.mail.Folder
public javax.mail.URLName getURLName() throws javax.mail.MessagingException, javax.mail.StoreClosedException
getURLName
in class javax.mail.Folder
javax.mail.MessagingException
javax.mail.StoreClosedException
public java.lang.String appendMessage(javax.mail.internet.MimeMessage oMsg) throws javax.mail.FolderClosedException, javax.mail.StoreClosedException, javax.mail.MessagingException, java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
oMsg
- MimeMessagejavax.mail.FolderClosedException
javax.mail.StoreClosedException
javax.mail.MessagingException
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
- if oMsg is nullpublic javax.mail.Message getMessage(int msgnum) throws javax.mail.MessagingException
getMessage
in class javax.mail.Folder
javax.mail.MessagingException
public DBMimeMessage getMessageByGuid(java.lang.String sMsgGuid) throws javax.mail.MessagingException
javax.mail.MessagingException
public DBMimeMessage getMessageByID(java.lang.String sMsgId) throws javax.mail.MessagingException
javax.mail.MessagingException
public int getMessageCount() throws javax.mail.FolderClosedException, javax.mail.MessagingException
getMessageCount
in class javax.mail.Folder
javax.mail.FolderClosedException
javax.mail.MessagingException
public javax.mail.Folder getParent() throws javax.mail.MessagingException
getParent
in class javax.mail.Folder
javax.mail.MessagingException
public javax.mail.Flags getPermanentFlags()
getPermanentFlags
in class javax.mail.Folder
public char getSeparator() throws javax.mail.MessagingException
getSeparator
in class javax.mail.Folder
javax.mail.MessagingException
public javax.mail.Folder[] list(java.lang.String pattern) throws javax.mail.MessagingException
list
in class javax.mail.Folder
javax.mail.MessagingException
public java.lang.String[] listMessages() throws java.sql.SQLException, javax.mail.MessagingException
Get a list of all messages in this folder which are not deleted
java.sql.SQLException
javax.mail.MessagingException
public int getType() throws javax.mail.MessagingException
getType
in class javax.mail.Folder
javax.mail.MessagingException
public boolean isOpen()
isOpen
in class javax.mail.Folder
public java.util.Properties getMessageHeaders(java.lang.String sMsgId) throws javax.mail.FolderClosedException, java.sql.SQLException
Get message GUID, Id, Number, Subject, From and Reply-To from k_mime_msgs table
This method is mainly used for testing whether or not a message is already present at current folder.sMsgId
- String GUID or Id of message to be retrievedjavax.mail.FolderClosedException
java.sql.SQLException
public int importMbox(java.lang.String sMboxFilePath) throws java.io.FileNotFoundException, java.io.IOException, javax.mail.MessagingException
java.io.FileNotFoundException
java.io.IOException
javax.mail.MessagingException
public void reindexMbox(java.lang.String sMboxFilePath) throws java.io.FileNotFoundException, java.io.IOException, javax.mail.MessagingException, java.sql.SQLException
sMboxFilePath
- String Full path to MBOX filejava.io.FileNotFoundException
java.io.IOException
javax.mail.MessagingException
java.sql.SQLException
public void reindexMbox() throws java.io.FileNotFoundException, java.io.IOException, javax.mail.MessagingException, java.sql.SQLException
java.io.FileNotFoundException
java.io.IOException
javax.mail.MessagingException
java.sql.SQLException