|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MailboxManager
Central MailboxManager which creates, lists, provides, renames and deletes Mailboxes
An important goal is to be JavaMail feature compatible. That means JavaMail could be used in both directions: As a backend for e.g. accessing a Maildir JavaMail store or as a frontend to access a JDBC MailboxManager through JavaMail. This should be possible by not too complicated wrapper classes. Due to the complexity of JavaMail it might be impossible to avoid some limitations.
Internally MailboxManager deals with named repositories that could have different implementations. E.g. JDBC connections to different hosts or Maildir / Mbox like stores. These repositories are identified by their names and maybe are configured in config.xml. The names of the mailboxes have to be mapped to the corresponding repository name. For user mailboxes this could be done by a "User.getRepositoryName()" property. It is imaginable that repositories lookup further properties from the user object like a path name for a file based storage method. Until Milestone 6 there is only one named repository: "default".
The only operation that requires dealing with the named repositories directly is the quota management. It is probably really difficult to implement a quota system that spans multiple repository implementations. That is why quotas are created for a specific repository. To be able to administer, repositories and theier belonging mailboxes can be listet.
| Method Summary | |
|---|---|
void |
addListener(MailboxPath mailboxPath,
MailboxListener listener,
MailboxSession session)
Implementations of Mailbox may interpret the fact that someone is listening and do some caching and even postpone persistence until everyone has removed itself. |
void |
copyMessages(MessageRange set,
MailboxPath from,
MailboxPath to,
MailboxSession session)
this is done by the MailboxRepository because maybe this operation could be optimized in the corresponding store. |
void |
createMailbox(MailboxPath mailboxPath,
MailboxSession mailboxSession)
Creates a new mailbox. |
MailboxSession |
createSystemSession(java.lang.String userName,
org.apache.commons.logging.Log log)
Creates a new system session. |
void |
deleteMailbox(MailboxPath mailboxPath,
MailboxSession session)
Delete the mailbox with the name |
char |
getDelimiter()
Return the delimter to use for folders |
MessageManager |
getMailbox(MailboxPath mailboxPath,
MailboxSession session)
Gets an session suitable for IMAP. |
MailboxSession |
login(java.lang.String userid,
java.lang.String passwd,
org.apache.commons.logging.Log log)
Autenticates the given user against the given password. |
void |
logout(MailboxSession session,
boolean force)
Logs the session out, freeing any resources. |
boolean |
mailboxExists(MailboxPath mailboxPath,
MailboxSession session)
Does the given mailbox exist? |
void |
renameMailbox(MailboxPath from,
MailboxPath to,
MailboxSession session)
Renames a mailbox. |
java.util.List<MailboxMetaData> |
search(MailboxQuery expression,
MailboxSession session)
Searches for mailboxes matching the given query. |
| Methods inherited from interface org.apache.james.mailbox.RequestAware |
|---|
endProcessingRequest, startProcessingRequest |
| Method Detail |
|---|
char getDelimiter()
MessageManager getMailbox(MailboxPath mailboxPath,
MailboxSession session)
throws MailboxException
mailboxPath - the Path of the mailbox, not nullsession - the context for this call, not null
ImapMailboxSession, not null
MailboxException - when the mailbox cannot be opened
MailboxNotFoundException - when the given mailbox does not exist
void createMailbox(MailboxPath mailboxPath,
MailboxSession mailboxSession)
throws MailboxException
mailboxPath - mailboxSession - the context for this call, not null
MailboxException - when creation fails
void deleteMailbox(MailboxPath mailboxPath,
MailboxSession session)
throws MailboxException
mailboxPath - session -
MailboxException
void renameMailbox(MailboxPath from,
MailboxPath to,
MailboxSession session)
throws MailboxException
from - original mailboxto - new mailboxsession - the context for this call, not nul
MailboxException - otherwise
MailboxExistsException - when the to mailbox exists
MailboxNotFound - when the from mailbox does not exist
void copyMessages(MessageRange set,
MailboxPath from,
MailboxPath to,
MailboxSession session)
throws MailboxException
set - messages to copyfrom - name of the source mailboxto - name of the destination mailboxsession - MailboxSession, not null
MailboxException
java.util.List<MailboxMetaData> search(MailboxQuery expression,
MailboxSession session)
throws MailboxException
expression - not nullsession - the context for this call, not null
MailboxException
boolean mailboxExists(MailboxPath mailboxPath,
MailboxSession session)
throws MailboxException
mailboxName - not nullsession - the context for this call, not null
MailboxException
MailboxSession createSystemSession(java.lang.String userName,
org.apache.commons.logging.Log log)
throws BadCredentialsException,
MailboxException
login(String, String, Log) when accessing this API
from a protocol.
userName - the name of the user whose session is being createdlog - context sensitive log
MailboxSession, not null
BadCredentialsException - when system access is not allowed for the given user
MailboxException - when the creation fails for other reasons
MailboxSession login(java.lang.String userid,
java.lang.String passwd,
org.apache.commons.logging.Log log)
throws BadCredentialsException,
MailboxException
userid - user namepasswd - password suppliedlog - context sensitive log
MailboxSession when the user is authentic and authorized to access
BadCredentialsException - when system access is denighed for the given user
MailboxException - when the creation fails for other reasons
void logout(MailboxSession session,
boolean force)
throws MailboxException
Logs the session out, freeing any resources. Clients who open session should make best efforts to call this when the session is closed.
Note that clients may not always be able to call logout (whether forced or not).
Mailboxes that create sessions which are expensive to maintain
MUST retain a reference and periodically check MailboxSession.isOpen().
Note that implementations much be aware that it is possible that this method may be called more than once with the same session.
session - not nullforce - true when the session logout is forced by premature connection termination
MailboxException - when logout fails
void addListener(MailboxPath mailboxPath,
MailboxListener listener,
MailboxSession session)
throws MailboxException
Implementations of Mailbox may interpret the fact that someone is listening and do some caching and even postpone persistence until everyone has removed itself.
Listeners should return true from MailboxListener.isClosed()
when they are ready to be removed.
mailboxPath - not nulllistener - not nullsession - not null
MailboxException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||