|
||||||||||
| 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)
Configure the component |
void |
initialize()
Initialise the component |
java.util.Iterator |
list()
Return the list of the current messages' keys |
boolean |
lock(java.lang.String key)
Not implemented |
static void |
main(java.lang.String[] args)
|
void |
remove(java.util.Collection mails)
Remove a list of messages from disk The collection is simply a list of mails to delete |
void |
remove(Mail mail)
Remove an existing message |
void |
remove(java.lang.String key)
Remove a mail from the mbox file |
Mail |
retrieve(java.lang.String key)
Get a message from the backing store (disk) |
void |
service(org.apache.avalon.framework.service.ServiceManager componentManager)
|
void |
store(Mail mc)
Store the given email in the current mbox file |
boolean |
unlock(java.lang.String key)
Not implemented |
| 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(Mail mc)
store in interface MailRepositorymc - The mail to storepublic java.util.Iterator list()
list in interface MailRepositorypublic Mail retrieve(java.lang.String key)
retrieve in interface MailRepositorykey -
public void remove(Mail mail)
remove in interface MailRepositorymail - public void remove(java.util.Collection mails)
remove in interface MailRepositorymails - public void remove(java.lang.String key)
remove in interface MailRepositorykey - The key of the mail to deletepublic boolean lock(java.lang.String key)
lock in interface MailRepositorykey -
public boolean unlock(java.lang.String key)
unlock in interface MailRepositorykey -
public void service(org.apache.avalon.framework.service.ServiceManager componentManager)
throws org.apache.avalon.framework.service.ServiceException
service in interface org.apache.avalon.framework.service.Serviceableorg.apache.avalon.framework.service.ServiceExceptionorg.apache.avalon.framework.service.Serviceable#compose(ServiceManager )
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.Configurableconf -
org.apache.avalon.framework.configuration.ConfigurationException
public void initialize()
throws java.lang.Exception
initialize in interface org.apache.avalon.framework.activity.Initializablejava.lang.Exceptionpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||