org.apache.james.mailrepository.javamail
Class UIDPlusFolderMailRepository

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.mailrepository.javamail.AbstractJavamailStoreMailRepository
          extended by org.apache.james.mailrepository.javamail.UIDPlusFolderMailRepository
All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, FolderAdapterFactory, StoreGateKeeperAware, MailRepository

public class UIDPlusFolderMailRepository
extends AbstractJavamailStoreMailRepository

MailRepository implementation to store mail in a Javamail store which provides the UID Plus method public long[] addUIDMessages.

This implementation should be considered as EXPERIMENTAL. TODO examine for thread-safety


Field Summary
static int DELIVERY_MODE_CLOSED
           
static int DELIVERY_MODE_OPEN
           
static int DELIVERY_MODE_TRY
           
 
Fields inherited from class org.apache.james.mailrepository.javamail.AbstractJavamailStoreMailRepository
cacheMessages, DEEP_DEBUG, log
 
Fields inherited from interface org.apache.james.services.MailRepository
MAIL, ROLE
 
Constructor Summary
UIDPlusFolderMailRepository()
           
 
Method Summary
protected  long addUIDMessage(javax.mail.Message message)
           
 FolderInterface createAdapter(javax.mail.Folder folder)
          returns a UIDPlusFolderAdapter wrapper
protected  UidToKeyBidiMap getUidToKeyBidiMap()
          lazy loads UidToKeyBidiMap
 java.util.Iterator list()
          List string keys of messages in repository.
 void remove(java.lang.String key)
          Removes a message identified by key.
 org.apache.mailet.Mail retrieve(java.lang.String key)
          Retrieves a message given a key.
 void store(org.apache.mailet.Mail mc)
          Stores a message in this repository.
 
Methods inherited from class org.apache.james.mailrepository.javamail.AbstractJavamailStoreMailRepository
configure, enableLogging, getFolderGateKeeper, getLock, getRandom, getStore, initialize, lock, remove, remove, service, unlock
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELIVERY_MODE_CLOSED

public static final int DELIVERY_MODE_CLOSED
See Also:
Constant Field Values

DELIVERY_MODE_TRY

public static final int DELIVERY_MODE_TRY
See Also:
Constant Field Values

DELIVERY_MODE_OPEN

public static final int DELIVERY_MODE_OPEN
See Also:
Constant Field Values
Constructor Detail

UIDPlusFolderMailRepository

public UIDPlusFolderMailRepository()
Method Detail

addUIDMessage

protected long addUIDMessage(javax.mail.Message message)
                      throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

store

public void store(org.apache.mailet.Mail mc)
           throws javax.mail.MessagingException
Stores a message in this repository.

Parameters:
mc - the mail message to store
Throws:
javax.mail.MessagingException

getUidToKeyBidiMap

protected UidToKeyBidiMap getUidToKeyBidiMap()
lazy loads UidToKeyBidiMap


retrieve

public org.apache.mailet.Mail retrieve(java.lang.String key)
                                throws javax.mail.MessagingException
Retrieves a message given a key. At the moment, keys can be obtained from list() in superinterface Store.Repository

Parameters:
key - the key of the message to retrieve
Returns:
the mail corresponding to this key, null if none exists
Throws:
javax.mail.MessagingException

remove

public void remove(java.lang.String key)
            throws javax.mail.MessagingException
Removes a message identified by key.

Parameters:
key - the key of the message to be removed from the repository
Throws:
javax.mail.MessagingException

list

public java.util.Iterator list()
                        throws javax.mail.MessagingException
List string keys of messages in repository.

Returns:
an Iterator over the list of keys in the repository
Throws:
javax.mail.MessagingException

createAdapter

public FolderInterface createAdapter(javax.mail.Folder folder)
returns a UIDPlusFolderAdapter wrapper

Parameters:
folder - JavaMail folder
See Also:
UIDPlusFolderAdapter


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.