org.apache.james.services
Interface MailRepository

All Known Subinterfaces:
SpoolRepository
All Known Implementing Classes:
AvalonMailRepository, AvalonSpoolRepository, JDBCMailRepository, JDBCSpoolRepository, MailStoreSpoolRepository, MBoxMailRepository

public interface MailRepository

Interface for a Repository to store Mails.

Version:
1.0.0, 24/04/1999

Field Summary
static java.lang.String MAIL
          Define a MAIL repository.
static java.lang.String ROLE
          The component role used by components implementing this service
 
Method Summary
 java.util.Iterator list()
          List string keys of messages in repository.
 boolean lock(java.lang.String key)
          Obtains a lock on a message identified by key
 void remove(java.util.Collection mails)
          Remove an Collection of mails from the repository
 void remove(Mail mail)
          Removes a specified message
 void remove(java.lang.String key)
          Removes a message identified by key.
 Mail retrieve(java.lang.String key)
          Retrieves a message given a key.
 void store(Mail mc)
          Stores a message in this repository.
 boolean unlock(java.lang.String key)
          Releases a lock on a message identified the key
 

Field Detail

ROLE

static final java.lang.String ROLE
The component role used by components implementing this service

See Also:
Constant Field Values

MAIL

static final java.lang.String MAIL
Define a MAIL repository. MAILS are stored in the specified destination.

See Also:
Constant Field Values
Method Detail

store

void store(Mail mc)
           throws javax.mail.MessagingException
Stores a message in this repository. Shouldn't this return the key under which it is stored?

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

list

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

retrieve

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

void remove(Mail mail)
            throws javax.mail.MessagingException
Removes a specified message

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

remove

void remove(java.util.Collection mails)
            throws javax.mail.MessagingException
Remove an Collection of mails from the repository

Parameters:
mails - The Collection of MailImpl's to delete
Throws:
javax.mail.MessagingException
Since:
2.2.0

remove

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

lock

boolean lock(java.lang.String key)
             throws javax.mail.MessagingException
Obtains a lock on a message identified by key

Parameters:
key - the key of the message to be locked
Returns:
true if successfully obtained the lock, false otherwise
Throws:
javax.mail.MessagingException

unlock

boolean unlock(java.lang.String key)
               throws javax.mail.MessagingException
Releases a lock on a message identified the key

Parameters:
key - the key of the message to be unlocked
Returns:
true if successfully released the lock, false otherwise
Throws:
javax.mail.MessagingException


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.