|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.james.mailrepository.MBoxMailRepository
public class MBoxMailRepository
Implementation of a MailRepository using UNIX mbox files.
Requires a configuration element in the .conf.xml file of the form:
<repository destinationURL="mbox://<directory>"
type="MAIL"
</directory> is where the individual mbox files are read from/written to
Type can ONLY be MAIL (SPOOL is NOT supported)
Requires a logger called MailRepository.
Implementation notes:
This class keeps an internal store of the mbox file When the internal mbox file is updated (added/deleted) then the file will be re-read from disk and then written back. This is a bit inefficent but means that the file on disk should be correct.
The mbox store is mainly meant to be used as a one-way street. Storing new emails is very fast (append to file) whereas reading them (via POP3) is slower (read from disk and parse). Therefore this implementation is best suited to people who wish to use the mbox format for taking data out of James and into something else (IMAP server or mail list displayer)
Nested Class Summary | |
---|---|
static interface |
MBoxMailRepository.MessageAction
A callback used when a message is read from the mbox file |
Field Summary |
---|
Fields inherited from interface org.apache.james.services.MailRepository |
---|
MAIL, ROLE |
Constructor Summary | |
---|---|
MBoxMailRepository()
|
Method Summary | |
---|---|
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
|
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(org.apache.mailet.Mail mail)
Removes a specified message |
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. |
boolean |
unlock(java.lang.String key)
Releases a lock on a message identified the key |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MBoxMailRepository()
Method Detail |
---|
public void store(org.apache.mailet.Mail mc)
MailRepository
store
in interface MailRepository
mc
- the mail message to storeMailRepository.store(Mail)
public java.util.Iterator list()
MailRepository
list
in interface MailRepository
Iterator
over the list of keys in the repositoryMailRepository.list()
public org.apache.mailet.Mail retrieve(java.lang.String key)
MailRepository
retrieve
in interface MailRepository
key
- the key of the message to retrieve
MailRepository.retrieve(String)
public void remove(org.apache.mailet.Mail mail)
MailRepository
remove
in interface MailRepository
mail
- the message to be removed from the repositoryMailRepository.remove(Mail)
public void remove(java.util.Collection mails)
MailRepository
remove
in interface MailRepository
mails
- The Collection of MailImpl
's to deleteMailRepository.remove(Collection)
public void remove(java.lang.String key)
MailRepository
remove
in interface MailRepository
key
- the key of the message to be removed from the repositoryMailRepository.remove(String)
public boolean lock(java.lang.String key)
MailRepository
lock
in interface MailRepository
key
- the key of the message to be locked
MailRepository.lock(String)
public boolean unlock(java.lang.String key)
MailRepository
unlock
in interface MailRepository
key
- the key of the message to be unlocked
MailRepository.unlock(String)
public void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
org.apache.avalon.framework.configuration.ConfigurationException
Configurable.configure(Configuration)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |