Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.hipermail
Class DBFolder

    java.lang.Object
      Folder
          com.knowgate.hipermail.DBFolder

    public class DBFolder

extends 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.Category
Category behaviour is obtained by delegation to a private Category instance.
For each DBFolder there is a corresponding row at k_categories database table.

Field Summary
`static short` | `ClassId`
`static int` | `MODE_BLOB`
`static int` | `MODE_MBOX`

Constructor Summary
`protected` | `DBFolder(Store oStor, java.lang.String sName)`

Method Summary
`java.lang.String` | `appendMessage(MimeMessage oMsg)`
`void` | `appendMessages(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()`
`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
`protected JDCConnection` | `getConnection()`
`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
`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.
`Message` | `getMessage(int msgnum)`
`protected Message` | `getMessage(java.lang.String sMsgId, int IdType)`
`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
`Folder` | `getParent()`
`Flags` | `getPermanentFlags()`
`char` | `getSeparator()`
`int` | `getType()`
`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
`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(Folder f)`
`void` | `wipe()` Delete all messages from this folder and clear MBOX file

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MODE_MBOX

    public static final int MODE_MBOX

See Also:
  Constant Field Values

### MODE_BLOB

    public static final int MODE_BLOB

See Also:
  Constant Field Values

### ClassId

    public static final short ClassId

See Also:
  Constant Field Values

Constructor Detail

### DBFolder

    protected DBFolder(Store oStor,
                       java.lang.String sName)

Method Detail

### getConnection

    protected JDCConnection getConnection()
                                   throws java.sql.SQLException,
                                          MessagingException

  Throws:
    `java.sql.SQLException`
    `MessagingException`

### getCategory

    public Category getCategory()

  Get instance of com.knowgate.hipergate.Category object

### getCategoryGuid

    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_categories

  Returns:
    String Category GUID or null if category is not set

### keySet

    public DBKeySet keySet()
                    throws java.sql.SQLException

  Get set of identifiers for messages at this folder

  Set entries are the mime identifiers for each message

  Returns:
    DBKeySet
  Throws:
    `java.sql.SQLException`

### appendMessages

    public void appendMessages(Message[] msgs)
                        throws MessagingException,
                               java.lang.ArrayIndexOutOfBoundsException

  Append messages to this DBFolder

  Parameters:
    `msgs` - Array of mime messages to be appended
  Throws:
    `MessagingException`
    `java.lang.ArrayIndexOutOfBoundsException`

### copyMessage

    public java.lang.String copyMessage(DBMimeMessage oSrcMsg)
                                 throws MessagingException

  Copy a DBMimeMessage from another DBFolder to this DBFolder

  Parameters:
    `oSrcMsg` - Source message.
  Returns:
    GUID of new message
  Throws:
    `MessagingException`

### moveMessage

    public void moveMessage(DBMimeMessage oSrcMsg)
                     throws MessagingException

  Move a DBMimeMessage from another DBFolder to this DBFolder

  Parameters:
    `oSrcMsg` - Source message
  Throws:
    `MessagingException`

### create

    public boolean create(int type)
                   throws MessagingException

  This method is not implemented and will always raise UnsupportedOperationException

  Throws:
    `java.lang.UnsupportedOperationException`
    `MessagingException`

### create

    public boolean create(java.lang.String sFolderName)
                   throws MessagingException

  Create DBFolder with given name under current user mailroot Category

  Parameters:
    `sFolderName` - Folder Name
  Returns:
    true
  Throws:
    `MessagingException`

### open

    public void open(int mode)
              throws MessagingException

  Open this DBFolder

  Parameters:
    `mode` - {READ_ONLY|READ_WRITE}
  Throws:
    `MessagingException`

### close

    public void close(boolean expunge)
               throws MessagingException

  Close this folder

  Parameters:
    `expunge` -
  Throws:
    `MessagingException`

### delete

    public boolean delete(boolean recurse)
                   throws MessagingException

  Wipe all messages and delete this folder

  Parameters:
    `recurse` - boolean
  Returns:
    boolean
  Throws:
    `MessagingException`

### getFolder

    public Folder getFolder(java.lang.String name)
                     throws MessagingException

  Get folder by name or GUID

  Parameters:
    `name` - String Folder name or GUID
  Returns:
    Folder
  Throws:
    `MessagingException`

### hasNewMessages

    public boolean hasNewMessages()
                           throws MessagingException

  This method is not implemented and will always raise UnsupportedOperationException

  Throws:
    `java.lang.UnsupportedOperationException`
    `MessagingException`

### renameTo

    public boolean renameTo(Folder f)
                     throws MessagingException,
                            StoreClosedException,
                            java.lang.NullPointerException

  Throws:
    `MessagingException`
    `StoreClosedException`
    `java.lang.NullPointerException`

### exists

    public boolean exists()
                   throws MessagingException,
                          StoreClosedException

  Throws:
    `MessagingException`
    `StoreClosedException`

### expunge

    public Message[] expunge()
                      throws MessagingException

  Expunge deleted messages

  This method removes from the database and the MBOX file those messages flagged as deleted at k_mime_msgs table

  Returns:
    null
  Throws:
    `MessagingException`

### wipe

    public void wipe()
              throws MessagingException

  Delete all messages from this folder and clear MBOX file

  Throws:
    `MessagingException`

### getFullName

    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_categories

  Returns:
    String

### getDirectoryPath

    public java.lang.String getDirectoryPath()

  Get path to directory containing files belonging to this folder

  Returns:
    String

### getFilePath

    public java.lang.String getFilePath()

  Get full path to MBOX file containing mime messages

  Returns:
    String

### getFile

    public java.io.File getFile()

  Get MBOX file that holds messages for this DBFolder

  Returns:
    java.io.File object representing MBOX file.

### getName

    public java.lang.String getName()

  Get column nm_category from table k_categories for this folder

  Returns:
    String

### getURLName

    public URLName getURLName()
                       throws MessagingException,
                              StoreClosedException

  Throws:
    `MessagingException`
    `StoreClosedException`

### getMessage

    protected Message getMessage(java.lang.String sMsgId,
                                 int IdType)
                          throws MessagingException

  Throws:
    `MessagingException`

### appendMessage

    public java.lang.String appendMessage(MimeMessage oMsg)
                                   throws FolderClosedException,
                                          StoreClosedException,
                                          MessagingException,
                                          java.lang.ArrayIndexOutOfBoundsException,
                                          java.lang.NullPointerException

  Parameters:
    `oMsg` - MimeMessage
  Returns:
    String
  Throws:
    `FolderClosedException`
    `StoreClosedException`
    `MessagingException`
    `java.lang.ArrayIndexOutOfBoundsException`
    `java.lang.NullPointerException` - if oMsg is null

### getMessage

    public Message getMessage(int msgnum)
                       throws MessagingException

  Throws:
    `MessagingException`

### getMessageByGuid

    public DBMimeMessage getMessageByGuid(java.lang.String sMsgGuid)
                                   throws MessagingException

  Throws:
    `MessagingException`

### getMessageByID

    public DBMimeMessage getMessageByID(java.lang.String sMsgId)
                                 throws MessagingException

  Throws:
    `MessagingException`

### getMessageCount

    public int getMessageCount()
                        throws FolderClosedException,
                               MessagingException

  Throws:
    `FolderClosedException`
    `MessagingException`

### getParent

    public Folder getParent()
                     throws MessagingException

  Throws:
    `MessagingException`

### getPermanentFlags

    public Flags getPermanentFlags()

### getSeparator

    public char getSeparator()
                      throws MessagingException

  Throws:
    `MessagingException`

### list

    public Folder[] list(java.lang.String pattern)
                  throws MessagingException

  Throws:
    `MessagingException`

### listMessages

    public java.lang.String[] listMessages()
                                    throws java.sql.SQLException,
                                           MessagingException

  Get a list of all messages in this folder which are not deleted

  Returns:
    An array of strings with format <msg> <num>[1..n]</num> <id>message unique identifier</id> <len>message length in bytes</len> <type>message content-type</type> <disposition>message content-disposition</disposition> <priority>X-Priority header</priority> <spam>X-Spam-Flag header</spam> <subject><![CDATA[message subject]]></subject> <sent>yyy-mm-dd hh:mi:ss</sent> <received>yyy-mm-dd hh:mi:ss</received> <from><![CDATA[personal name of sender]]></from> <to><![CDATA[personal name or e-mail of receiver]]></to> <size>integer size in kilobytes</size> <err>error description (if any)</err> </msg>
  Throws:
    `java.sql.SQLException`
    `MessagingException`
  Since:
    4.0

### getType

    public int getType()
                throws MessagingException

  Throws:
    `MessagingException`

### isOpen

    public boolean isOpen()

### getMessageHeaders

    public java.util.Properties getMessageHeaders(java.lang.String sMsgId)
                                           throws 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.

  Parameters:
    `sMsgId` - String GUID or Id of message to be rerieved
  Returns:
    Properties {gu_mimemsg, id_message, pg_message, tx_subject, tx_email_from, tx_email_reply, nm_from } or null if no message with such sMsgId was found referenced at k_mime_msgs for current folder
  Throws:
    `FolderClosedException`
    `java.sql.SQLException`

### importMbox

    public int importMbox(java.lang.String sMboxFilePath)
                   throws java.io.FileNotFoundException,
                          java.io.IOException,
                          MessagingException

  Throws:
    `java.io.FileNotFoundException`
    `java.io.IOException`
    `MessagingException`

### reindexMbox

    public void reindexMbox(java.lang.String sMboxFilePath)
                     throws java.io.FileNotFoundException,
                            java.io.IOException,
                            MessagingException,
                            java.sql.SQLException

  Delete every message from the index and rebuild it by re-reading the specified MBOX file

  Parameters:
    `sMboxFilePath` - String Full path to MBOX file
  Throws:
    `java.io.FileNotFoundException`
    `java.io.IOException`
    `MessagingException`
    `java.sql.SQLException`

### reindexMbox

    public void reindexMbox()
                     throws java.io.FileNotFoundException,
                            java.io.IOException,
                            MessagingException,
                            java.sql.SQLException

  Delete very message from th eindex and rebuild it by reading the default MBOX file for this folder

  Throws:
    `java.io.FileNotFoundException`
    `java.io.IOException`
    `MessagingException`
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD