|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for objects representing an IMAP4rev1 mailbox (folder). Contains logical information and provides a simple API. There should be one instance of this class for every open IMAP mailbox. Implementations may choose to store this object or recreate it on access. Storing is recommended.
Several methods throw AccessControlException. In normal use, these shouldn't get thrown because the Host will have checked access before returning a reference to this mailbox. However, having the methods here throw this exception allows the acl to be changed while a mailbox is selected. Mailbox Related Flags (rfc2060 name attributes) \Noinferiors It is not possible for any child levels of hierarchy to exist under this name; no child levels exist now and none can be created in the future. \Noselect It is not possible to use this name as a selectable mailbox. \Marked The mailbox has been marked "interesting" by the server; the mailbox probably contains messages that have been added since the last time the mailbox was selected. \Unmarked The mailbox does not contain any additional messages since the last time the mailbox was selected. Message related flags. The flags allowed per message are specific to each mailbox. The minimum list (rfc2060 system flags) is: \Seen Message has been read \Answered Message has been answered \Flagged Message is "flagged" for urgent/special attention \Deleted Message is "deleted" for removal by later EXPUNGE \Draft Message has not completed composition (marked as a draft). \Recent Message is "recently" arrived in this mailbox. This session is the first session to have been notified about this message; subsequent sessions will not see \Recent set for this message. This flag can not be altered by the client. If it is not possible to determine whether or not this session is the first session to be notified about a message, then that message SHOULD be considered recent. Reference: RFC 2060
Field Summary | |
static java.lang.String |
RECENT_FLAG
|
static java.lang.String |
SYSTEM_FLAGS
|
Method Summary | |
void |
addMailboxEventListener(MailboxEventListener mel)
Mailbox Events are used to inform registered listeners of events in the Mailbox. |
boolean |
allFlags(java.lang.String username)
Indicates if specified user can change any flag on a permanent basis, except for \Recent which can never be changed by a user. |
boolean |
checkpoint()
Returns true once this Mailbox has been checkpointed. |
boolean |
expunge(java.lang.String user)
Removes all messages marked Deleted. |
java.lang.String |
getAbsoluteName()
Returns absolute, that is user-independent, hierarchical name of mailbox (including namespace) Example: '#mail.fred.flintstone.apache.James.NewIdeas' |
int |
getExists()
Indicates number of messages in folder |
java.lang.String |
getFlags(int msn,
java.lang.String user)
Get the IMAP-formatted String of flags for specified message. |
java.lang.String |
getFlagsUID(int uid,
java.lang.String user)
Get the IMAP-formatted String of flags for specified message. |
boolean |
getInferiorsAllowed()
Indicates if child folders may be created. |
javax.mail.internet.InternetHeaders |
getInternetHeaders(int msn,
java.lang.String user)
Returns the Internet Headers for a message. |
javax.mail.internet.InternetHeaders |
getInternetHeadersUID(int uid,
java.lang.String user)
Returns the Internet Headers for a message. |
int |
getMailboxSize()
Returns mailbox size in octets. |
MessageAttributes |
getMessageAttributes(int msn,
java.lang.String user)
Returns the message attributes for a message. |
MessageAttributes |
getMessageAttributesUID(int uid,
java.lang.String user)
Returns the message attributes for a message. |
java.lang.String |
getName()
Returns name of this mailbox relative to its parent in the mailbox hierarchy. |
int |
getNextUID()
Returns the 32 bit uid available for the next message. |
int |
getOldestUnseen(java.lang.String user)
Indicates the oldest unseen message for the specified user. |
java.lang.String |
getPermanentFlags(java.lang.String username)
Indicates which flags this user can change permanently. |
int |
getRecent()
Indicates no of messages with \Recent flag set |
java.lang.String |
getSupportedFlags()
Returns all flags supported by this mailbox. |
int |
getUIDValidity()
Returns the current unique id validity value of this mailbox. |
int |
getUnseen(java.lang.String user)
Indicates the number of unseen messages for the specified user. |
java.util.Map |
getUnseenByUser()
Gets map of users to number of unseen messages. |
boolean |
hasCreateRights(java.lang.String user)
Establishes if specified user has create rights for this mailbox. |
boolean |
hasLookupRights(java.lang.String user)
Establishes if specified user has lookup rights for this mailbox. |
boolean |
isMarked()
Indicates that messages have been added since this mailbox was last selected by any user. |
boolean |
isNotSelectableByAnyone()
|
boolean |
isReadOnly(java.lang.String username)
Indicates state in which the mailbox will be opened by specified user. |
boolean |
isSelectable(java.lang.String username)
Indicates if this folder may be selected by the specified user. |
java.util.List |
listUIDs(java.lang.String user)
Lists uids of messages in mailbox indexed by MSN. |
boolean |
markDeleted(int msn,
java.lang.String user)
Marks a message for deletion given a message sequence number. |
boolean |
markDeletedUID(int uid,
java.lang.String user)
Marks a message for deletion given a unique identifier. |
boolean |
matchesName(java.lang.String name)
Returns true if the argument is the relative or absolute name of this mailbox |
void |
removeMailboxEventListener(MailboxEventListener mel)
|
MimeMessageWrapper |
retrieve(int msn,
java.lang.String user)
Retrieves a message given a message sequence number. |
MimeMessageWrapper |
retrieveUID(int uid,
java.lang.String user)
Retrieves a message given a unique identifier. |
boolean |
setFlags(int msn,
java.lang.String user,
java.lang.String request)
Updates the flags of a message. |
boolean |
setFlagsUID(int uid,
java.lang.String user,
java.lang.String request)
Updates the flags of a message. |
void |
setNotSelectableByAnyone(boolean state)
Mark this mailbox as not selectable by anyone. |
boolean |
store(javax.mail.internet.MimeMessage message,
java.lang.String username)
Stores a message in this mailbox. |
boolean |
store(javax.mail.internet.MimeMessage message,
java.lang.String username,
MessageAttributes attrs,
Flags flags)
Stores a message in this mailbox, using passed MessageAttributes and Flags. |
void |
unsetRecent()
Remove \Recent flag from all messages in mailbox. |
boolean |
updateMessageAttributes(MessageAttributes attrs,
java.lang.String user)
Updates the attributes of a message. |
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable |
configure |
Methods inherited from interface org.apache.avalon.framework.component.Composable |
compose |
Field Detail |
public static final java.lang.String SYSTEM_FLAGS
public static final java.lang.String RECENT_FLAG
Method Detail |
public java.lang.String getName()
public java.lang.String getAbsoluteName()
public boolean matchesName(java.lang.String name)
name
- possible name for this Mailboxpublic int getUIDValidity()
public int getNextUID()
public int getMailboxSize()
public boolean getInferiorsAllowed()
public boolean isSelectable(java.lang.String username) throws AccessControlException
username
- String represnting userAccessControlException
- if username does not have lookup rightspublic boolean isMarked()
public java.lang.String getSupportedFlags()
public boolean allFlags(java.lang.String username) throws AccessControlException
username
- String represnting userAccessControlException
- if username does not have lookup rightspublic java.lang.String getPermanentFlags(java.lang.String username) throws AccessControlException
username
- String represnting userpublic int getExists()
public int getRecent()
public void unsetRecent()
public int getOldestUnseen(java.lang.String user)
public int getUnseen(java.lang.String user)
public boolean isReadOnly(java.lang.String username) throws AccessControlException
Implementations decide if Read Only means only lookup and read rights (lr) or lookup, read and keep seen rights (lrs). This may even vary between mailboxes.
username
- String represnting userAccessControlException
- if the user can not open this mailbox
at least Read-Only.public void addMailboxEventListener(MailboxEventListener mel)
public void removeMailboxEventListener(MailboxEventListener mel)
public boolean store(javax.mail.internet.MimeMessage message, java.lang.String username) throws AccessControlException, AuthorizationException, java.lang.IllegalArgumentException
mail
- the message to be storedusername
- String represnting userAccessControlException
- if username does not have lookup rights for this mailbox.AuthorizationException
- if username has lookup rights but does not have insert rights.public boolean store(javax.mail.internet.MimeMessage message, java.lang.String username, MessageAttributes attrs, Flags flags) throws AccessControlException, AuthorizationException, java.lang.IllegalArgumentException
mail
- the message to be storedusername
- String represnting userattrs
- non-null MessageAttributes for use with this Messageflags
- a Flags object for this messageAccessControlException
- if username does not have lookup rights
for this mailbox.AuthorizationException
- if username has lookup rights but does
not have insert rights.public MimeMessageWrapper retrieve(int msn, java.lang.String user) throws AccessControlException, AuthorizationException
msn
- the message sequence numberusername
- String represnting userAccessControlException
- if user does not have lookup rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have read rights.public MimeMessageWrapper retrieveUID(int uid, java.lang.String user) throws AccessControlException, AuthorizationException
uid
- the unique identifier of a messageusername
- String represnting userAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have read rights.public boolean markDeleted(int msn, java.lang.String user) throws AccessControlException, AuthorizationException
msn
- the message sequence numberusername
- String represnting userAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public boolean markDeletedUID(int uid, java.lang.String user) throws AccessControlException, AuthorizationException
uidunique
- identifierusername
- String represnting userAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public MessageAttributes getMessageAttributes(int msn, java.lang.String user) throws AccessControlException, AuthorizationException
msn
- message sequence numberusername
- String represnting userAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public MessageAttributes getMessageAttributesUID(int uid, java.lang.String user) throws AccessControlException, AuthorizationException
uid
- unique identifierusername
- String represnting userAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public boolean updateMessageAttributes(MessageAttributes attrs, java.lang.String user) throws AccessControlException, AuthorizationException
MessageAttributes
- of a message already in this MailboxAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public java.lang.String getFlags(int msn, java.lang.String user) throws AccessControlException, AuthorizationException
msn
- message sequence number for a message in this mailboxusername
- String represnting userAccessControlException
- if user does not have lookup rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have read rights.public java.lang.String getFlagsUID(int uid, java.lang.String user) throws AccessControlException, AuthorizationException
uid
- UniqueIdentifier for a message in this mailboxusername
- String represnting userAccessControlException
- if user does not have lookup rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have read rights.public boolean setFlags(int msn, java.lang.String user, java.lang.String request) throws AccessControlException, AuthorizationException, java.lang.IllegalArgumentException
msn
- message sequence number for a message in this mailboxusername
- String represnting userrequest
- IMAP formatted string of flag requestAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public boolean setFlagsUID(int uid, java.lang.String user, java.lang.String request) throws AccessControlException, AuthorizationException, java.lang.IllegalArgumentException
uid
- UniqueIdentifier for a message in this mailboxusername
- String represnting userrequest
- IMAP formatted string of flag requestAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public javax.mail.internet.InternetHeaders getInternetHeaders(int msn, java.lang.String user) throws AccessControlException, AuthorizationException
msn
- message sequence numberusername
- String represnting userAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public javax.mail.internet.InternetHeaders getInternetHeadersUID(int uid, java.lang.String user) throws AccessControlException, AuthorizationException
uid
- UniqueIdentifier for a message in this mailboxusername
- String represnting userAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has lookup rights but does not
have delete rights.public boolean expunge(java.lang.String user) throws AccessControlException, AuthorizationException, java.lang.IllegalArgumentException
username
- String represnting userAccessControlException
- if user does not have read rights for
this mailbox.AuthorizationException
- if user has delete rights but does not
have delete rights.public boolean hasLookupRights(java.lang.String user)
username
- String represnting userpublic boolean hasCreateRights(java.lang.String user) throws AccessControlException
username
- String represnting userAccessControlException
- if user does not have lookup rights for
this mailbox.public java.util.List listUIDs(java.lang.String user)
username
- String represnting userpublic boolean checkpoint()
public void setNotSelectableByAnyone(boolean state)
state
- true if folder is not selectable by anyonepublic boolean isNotSelectableByAnyone()
public java.util.Map getUnseenByUser()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |