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

Field Detail

ROLE

public static final String ROLE
The component role used by components implementing this service

See Also:
Constant Field Values

MAIL

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

See Also:
Constant Field Values
Method Detail

store

public void store(Mail mc)
           throws 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:
MessagingException

list

public Iterator list()
              throws MessagingException
List string keys of messages in repository.

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

retrieve

public Mail retrieve(String key)
              throws 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:
MessagingException

remove

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

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

remove

public void remove(Collection mails)
            throws MessagingException
Remove an Collection of mails from the repository

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

remove

public void remove(String key)
            throws MessagingException
Removes a message identified by key.

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

lock

public boolean lock(String key)
             throws 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:
MessagingException

unlock

public boolean unlock(String key)
               throws 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:
MessagingException


"Copyright © 1999-2006 Apache Jakarta Project. All Rights Reserved."