com.knowgate.hipermail
Class DBStore

java.lang.Object
  extended by javax.mail.Store
      extended by com.knowgate.hipermail.DBStore

public class DBStore
extends javax.mail.Store

Manages local storage of mail messages at RDBMS and MBOX files


Constructor Summary
DBStore(javax.mail.Session session, URLName url)
           
 
Method Summary
 void close()
           
 void commit()
           
 void connect()
           
 void connect(java.lang.String host, java.lang.String user, java.lang.String password)
           
 JDCConnection getConnection()
           
 DBFolder getDBFolder(java.lang.String sFolderName)
          Same as getFolder() but casting result to DBFolder
 Folder getDefaultFolder()
          Get inbox Folder
 Folder getFolder(java.lang.String sFolderName)
          Get folder by guid or name
 Folder getFolder(URLName oURL)
          Calls getFolder(oURL.getFile());
 Folder[] getPersonalNamespaces()
           
 Session getSession()
           
 Folder[] getSharedNamespaces()
           
 URLName getURLName()
           
 ACLUser getUser()
           
 Folder[] getUserNamespaces(java.lang.String sUserId)
           
 boolean isConnected()
           
static java.lang.String MBoxDirectory(java.lang.String sProfile, int iDomainId, java.lang.String sWorkAreaGu)
           
static DBStore open(Session oMailSession, java.lang.String sProfile, java.lang.String sMBoxDir, java.lang.String sGuUser, java.lang.String sPwd)
          Create new DBStore instance and open connection to the database
 DBFolder openDBFolder(java.lang.String sFolderName, int iMode)
          Get DBFolder and open it in the specified mode
 DBMimeMessage preFetchMessage(Folder oIncomingFldr, int iMsgNum)
          Fetch a message from a POP3 or other remote folder into de local cache
protected  boolean protocolConnect(java.lang.String host, int port, java.lang.String user, java.lang.String password)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBStore

public DBStore(javax.mail.Session session,
               URLName url)
        throws MessagingException
Throws:
MessagingException
Method Detail

open

public static DBStore open(Session oMailSession,
                           java.lang.String sProfile,
                           java.lang.String sMBoxDir,
                           java.lang.String sGuUser,
                           java.lang.String sPwd)
                    throws MessagingException
Create new DBStore instance and open connection to the database

Parameters:
oMailSession - Session
sProfile - String
sMBoxDir - String
sGuUser - String
sPwd - String
Returns:
DBStore
Throws:
MessagingException

getConnection

public JDCConnection getConnection()
                            throws java.sql.SQLException,
                                   MessagingException
Throws:
java.sql.SQLException
MessagingException

getSession

public Session getSession()

isConnected

public boolean isConnected()

protocolConnect

protected boolean protocolConnect(java.lang.String host,
                                  int port,
                                  java.lang.String user,
                                  java.lang.String password)
                           throws AuthenticationFailedException,
                                  MessagingException
Parameters:
host - Name of profile file without extension { hipergate, real, test, demo }
port - Not used, must be -1
user - GUID of user to be authenticated
password - User password in clear text
Returns:
true
Throws:
MessagingException
AuthenticationFailedException

connect

public void connect(java.lang.String host,
                    java.lang.String user,
                    java.lang.String password)
             throws MessagingException
Throws:
MessagingException

commit

public void commit()
            throws MessagingException
Throws:
MessagingException

connect

public void connect()
             throws MessagingException
Throws:
MessagingException

close

public void close()
           throws MessagingException
Throws:
MessagingException

getFolder

public Folder getFolder(URLName oURL)
                 throws StoreClosedException,
                        FolderNotFoundException,
                        MessagingException
Calls getFolder(oURL.getFile());

Parameters:
oURL - URLName
Returns:
DBFolder instance
Throws:
StoreClosedException
FolderNotFoundException
MessagingException

getFolder

public Folder getFolder(java.lang.String sFolderName)
                 throws StoreClosedException,
                        FolderNotFoundException,
                        MessagingException

Get folder by guid or name

Parameters:
sFolderName - String This parameter may be either the folder GUID or its name valid folder names are {inbox, outbox, drafts, sent, spam, deleted, received}
Returns:
DBFolder instance
Throws:
StoreClosedException
FolderNotFoundException
MessagingException

getDBFolder

public DBFolder getDBFolder(java.lang.String sFolderName)
                     throws StoreClosedException,
                            FolderNotFoundException,
                            MessagingException
Same as getFolder() but casting result to DBFolder

Parameters:
sFolderName - String
Returns:
DBFolder
Throws:
StoreClosedException
FolderNotFoundException
MessagingException

openDBFolder

public DBFolder openDBFolder(java.lang.String sFolderName,
                             int iMode)
                      throws StoreClosedException,
                             FolderNotFoundException,
                             MessagingException
Get DBFolder and open it in the specified mode

Parameters:
sFolderName - String
iMode - int {DBFolder.READ_ONLY | DBFolder.READ_WRITE}
Returns:
DBFolder
Throws:
StoreClosedException
FolderNotFoundException
MessagingException

getDefaultFolder

public Folder getDefaultFolder()
                        throws StoreClosedException,
                               FolderNotFoundException,
                               MessagingException
Get inbox Folder

Returns:
DBFolder
Throws:
StoreClosedException
FolderNotFoundException
MessagingException

getPersonalNamespaces

public Folder[] getPersonalNamespaces()
                               throws StoreClosedException,
                                      FolderNotFoundException,
                                      MessagingException
Throws:
StoreClosedException
FolderNotFoundException
MessagingException

getSharedNamespaces

public Folder[] getSharedNamespaces()

getUserNamespaces

public Folder[] getUserNamespaces(java.lang.String sUserId)
                           throws StoreClosedException,
                                  FolderNotFoundException,
                                  MessagingException
Throws:
StoreClosedException
FolderNotFoundException
MessagingException

getURLName

public URLName getURLName()

getUser

public ACLUser getUser()

preFetchMessage

public DBMimeMessage preFetchMessage(Folder oIncomingFldr,
                                     int iMsgNum)
                              throws MessagingException
Fetch a message from a POP3 or other remote folder into de local cache

Parameters:
oIncomingFldr - Incoming Folder (POP3, IMAP, or other)
iMsgNum - int Message number
Returns:
DBMimeMessage
Throws:
MessagingException

MBoxDirectory

public static java.lang.String MBoxDirectory(java.lang.String sProfile,
                                             int iDomainId,
                                             java.lang.String sWorkAreaGu)
                                      throws java.net.ProtocolException
Throws:
java.net.ProtocolException