org.apache.james.imapserver
Class FileMailbox

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.james.imapserver.FileMailbox
All Implemented Interfaces:
ACL, ACLMailbox, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.Loggable, Mailbox, java.io.Serializable

public class FileMailbox
extends org.apache.avalon.framework.logger.AbstractLoggable
implements ACLMailbox, java.io.Serializable

Object representing an IMAP4rev1 mailbox (folder) on a local file system. The mailbox contains messages, message attributes and an access control list.

from Interface Mailbox

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.

From interface ACL

The standard rights in RFC2086 are:
l - lookup (mailbox is visible to LIST/LSUB commands)
r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL, SEARCH, COPY from mailbox)
s - keep seen/unseen information across sessions (STORE SEEN flag)
w - write (STORE flags other than SEEN and DELETED)
i - insert (perform APPEND, COPY into mailbox)
p - post (send mail to submission address for mailbox, not enforced by IMAP4 itself)
c - create (CREATE new sub-mailboxes in any implementation-defined hierarchy)
d - delete (STORE DELETED flag, perform EXPUNGE)
a - administer (perform SETACL)

Serialization. Not all fields are serialized. Dispose() must be called to write serialized fiels to disc before finishing with this object.

Deserialization. On recover from disc, configure, compose, contextualize and reInit must be called before object is ready for use. Reference: RFC 2060

Version:
0.1 on 14 Dec 2000
Author:
Charles Benett
See Also:
Serialized Form

Field Summary
static java.lang.String MAILBOX_FILE_NAME
           
 
Fields inherited from interface org.apache.james.imapserver.ACL
ADD_RIGHTS, ADMIN_RIGHTS, CREATE_RIGHTS, DELETE_RIGHTS, INSERT_RIGHTS, KEEP_SEEN_RIGHTS, LOOKUP_RIGHTS, POST_RIGHTS, READ_RIGHTS, REMOVE_RIGHTS, RIGHTS, WRITE_RIGHTS
 
Fields inherited from interface org.apache.james.imapserver.Mailbox
RECENT_FLAG, SYSTEM_FLAGS
 
Constructor Summary
FileMailbox()
           
 
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.
 void compose(org.apache.avalon.framework.component.ComponentManager comp)
           
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
           
 void contextualize(org.apache.avalon.framework.context.Context context)
           
 void dispose()
          Call when host has finished with a mailbox.
 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'
 java.lang.String getAllRights(java.lang.String getter)
          Retrieves a String of one or more who have rights in this ACL
 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 getOptionalRights(java.lang.String getter, java.lang.String identity)
          Retrieve rights which may be granted to the specified identity.
 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 getRequiredRights(java.lang.String getter, java.lang.String identity)
          Retrieve rights which will always be granted to the specified identity.
 java.lang.String getRights(java.lang.String getter, java.lang.String identity)
          Retrieve access rights for a specific identity.
 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.
 java.util.Set getUsersWithLookupRights()
           
 java.util.Set getUsersWithReadRights()
           
 boolean hasAdminRights(java.lang.String username)
           
 boolean hasCreateRights(java.lang.String username)
          Establishes if specified user has create rights for this mailbox.
 boolean hasDeleteRights(java.lang.String username)
           
 boolean hasInsertRights(java.lang.String username)
           
 boolean hasKeepSeenRights(java.lang.String username)
           
 boolean hasLookupRights(java.lang.String username)
          Helper boolean methods.
 boolean hasReadRights(java.lang.String username)
          Helper boolean methods.
 boolean hasWriteRights(java.lang.String username)
           
 void initialize()
           
 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 testName)
          Returns true if the argument is the relative or absolute name of this mailbox
 void prepareMailbox(java.lang.String user, java.lang.String absName, java.lang.String initialAdminUser)
          Set the details particular to this Mailbox.
 void reinitialize()
          Re-initialises mailbox after reading from file-system.
 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 for a message.
 boolean setFlagsUID(int uid, java.lang.String user, java.lang.String request)
          Updates the flags for a message.
 void setNotSelectableByAnyone(boolean state)
          Mark this mailbox as not selectable by anyone.
 boolean setRights(java.lang.String setter, java.lang.String identifier, java.lang.String modification)
          Store access rights for a given identity.
 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 msgAttrs, 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.This may be incorporated into setFlags().
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAILBOX_FILE_NAME

public static final java.lang.String MAILBOX_FILE_NAME
Constructor Detail

FileMailbox

public FileMailbox()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable

compose

public void compose(org.apache.avalon.framework.component.ComponentManager comp)
Specified by:
compose in interface org.apache.avalon.framework.component.Composable

prepareMailbox

public void prepareMailbox(java.lang.String user,
                           java.lang.String absName,
                           java.lang.String initialAdminUser)
Description copied from interface: ACLMailbox
Set the details particular to this Mailbox. Should only be called once, at creation, and not when restored from storage.
Specified by:
prepareMailbox in interface ACLMailbox
Following copied from interface: org.apache.james.imapserver.ACLMailbox
Parameters:
user - String email local part of owner of a personal mailbox.
abName - String absolute, ie user-independent, name of mailbox.
initialAdminUser - String email local-part of a user who will be assigned admin rights on this mailbox

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable

reinitialize

public void reinitialize()
                  throws java.lang.Exception
Re-initialises mailbox after reading from file-system. Cannot assume that this is the same instance of James that wrote it.

Contract is that re-init must be called after configure, contextualize, compose.

Specified by:
reinitialize in interface ACLMailbox

dispose

public void dispose()
Call when host has finished with a mailbox. This is really a stop rather than destroy. Writes current mailbox object to disc.
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

checkpoint

public boolean checkpoint()
Returns true once this Mailbox has been checkpointed. This implementation just writes its mailbox record to disc. Unless something is broken all messages added, amended or removed from this mailbox will have been handled by this object.
This implementation always returns true.
Specified by:
checkpoint in interface Mailbox

unsetRecent

public void unsetRecent()
Remove \Recent flag from all messages in mailbox. Should be called whenever a user session finishes.
Specified by:
unsetRecent in interface Mailbox

getName

public java.lang.String getName()
Returns name of this mailbox relative to its parent in the mailbox hierarchy. Example: 'NewIdeas'
Specified by:
getName in interface Mailbox

getAbsoluteName

public java.lang.String getAbsoluteName()
Returns absolute, that is user-independent, hierarchical name of mailbox (including namespace) Example: '#mail.fred.flintstone.apache.James.NewIdeas'
Specified by:
getAbsoluteName in interface Mailbox

matchesName

public boolean matchesName(java.lang.String testName)
Returns true if the argument is the relative or absolute name of this mailbox
Specified by:
matchesName in interface Mailbox
Parameters:
name - possible name for this Mailbox

getUIDValidity

public int getUIDValidity()
Returns the current unique id validity value of this mailbox.
Specified by:
getUIDValidity in interface Mailbox

getNextUID

public int getNextUID()
Returns the 32 bit uid available for the next message.
Specified by:
getNextUID in interface Mailbox

getMailboxSize

public int getMailboxSize()
Returns mailbox size in octets. Should only include actual messages and not any implementation-specific data, such as message attributes.
Specified by:
getMailboxSize in interface Mailbox

getInferiorsAllowed

public boolean getInferiorsAllowed()
Indicates if child folders may be created. It does not indicate which users can create child folders.
Specified by:
getInferiorsAllowed in interface Mailbox

isMarked

public boolean isMarked()
Indicates that messages have been added since this mailbox was last selected by any user.
Specified by:
isMarked in interface Mailbox

getSupportedFlags

public java.lang.String getSupportedFlags()
Returns all flags supported by this mailbox. e.g. \Answered \Deleted
Specified by:
getSupportedFlags in interface Mailbox

getRecent

public int getRecent()
Indicates no of messages with \Recent flag set
Specified by:
getRecent in interface Mailbox

getOldestUnseen

public int getOldestUnseen(java.lang.String user)
Indicates the oldest unseen message for the specified user.
Specified by:
getOldestUnseen in interface Mailbox

getExists

public int getExists()
Indicates number of messages in folder
Specified by:
getExists in interface Mailbox

getUnseen

public int getUnseen(java.lang.String user)
Indicates the number of unseen messages for the specified user.
Specified by:
getUnseen in interface Mailbox

addMailboxEventListener

public void addMailboxEventListener(MailboxEventListener mel)
Mailbox Events are used to inform registered listeners of events in the Mailbox. E.g. if mail is delivered to an Inbox or if another user appends/ deletes a message.
Specified by:
addMailboxEventListener in interface Mailbox

removeMailboxEventListener

public void removeMailboxEventListener(MailboxEventListener mel)
Specified by:
removeMailboxEventListener in interface Mailbox

setNotSelectableByAnyone

public void setNotSelectableByAnyone(boolean state)
Mark this mailbox as not selectable by anyone. Example folders at the roots of hierarchies, e. #mail for each user.
Specified by:
setNotSelectableByAnyone in interface Mailbox
Parameters:
state - true if folder is not selectable by anyone

isNotSelectableByAnyone

public boolean isNotSelectableByAnyone()
Specified by:
isNotSelectableByAnyone in interface Mailbox

setRights

public boolean setRights(java.lang.String setter,
                         java.lang.String identifier,
                         java.lang.String modification)
                  throws AccessControlException,
                         AuthorizationException
Store access rights for a given identity. The setter is the user setting the rights, the identifier is the user whose rights are affected. The setter and identifier arguments must be non-null and non-empty. The modification argument must be non-null and follow the syntax of the third argument to a SETACL command. If the modification argument is an empty string, that identifier is removed from the ACL, if currently present.
Specified by:
setRights in interface ACL
Parameters:
setter - String representing user attempting to set rights, must be non-null and non-empty
identity - String representing user whose rights are being set, must be non-null and non-empty
modification - String representing the change in rights, following the syntax specified in rfc 2086. Note a blank string means delete all rights for given identity.
Throws:
AccessControlException - if setter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if specified setter does not have the administer right (ie the right to write ACL rights), or if the result of this method would leave no identities with admin rights.

getRights

public java.lang.String getRights(java.lang.String getter,
                                  java.lang.String identity)
                           throws AccessControlException,
                                  AuthorizationException
Retrieve access rights for a specific identity.
Specified by:
getRights in interface ACL
Parameters:
getter - String representing user attempting to get the rights, must be non-null and non-empty
identity - String representing user whose rights are being got, must be non-null and non-empty
Throws:
AccessControlException - if getter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if implementation does not wish to expose ACL for this identity to this getter.

getAllRights

public java.lang.String getAllRights(java.lang.String getter)
                              throws AccessControlException,
                                     AuthorizationException
Retrieves a String of one or more who have rights in this ACL
Specified by:
getAllRights in interface ACL
Parameters:
getter - String representing user attempting to get the rights, must be non-null and non-empty
Throws:
AccessControlException - if getter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if implementation does not wish to expose ACL to this getter.

getRequiredRights

public java.lang.String getRequiredRights(java.lang.String getter,
                                          java.lang.String identity)
                                   throws AccessControlException,
                                          AuthorizationException
Retrieve rights which will always be granted to the specified identity.
Specified by:
getRequiredRights in interface ACL
Parameters:
getter - String representing user attempting to get the rights, must be non-null and non-empty
identity - String representing user whose rights are being got, must be non-null and non-empty
Throws:
AccessControlException - if getter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if implementation does not wish to expose ACL for this identity to this getter.

getOptionalRights

public java.lang.String getOptionalRights(java.lang.String getter,
                                          java.lang.String identity)
                                   throws AccessControlException,
                                          AuthorizationException
Retrieve rights which may be granted to the specified identity.
Specified by:
getOptionalRights in interface ACL
Parameters:
getter - String representing user attempting to get the rights, must be non-null and non-empty
identity - String representing user whose rights are being got, must be non-null and non-empty
Throws:
AccessControlException - if getter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if implementation does not wish to expose ACL for this identity to this getter.

hasLookupRights

public boolean hasLookupRights(java.lang.String username)
Helper boolean methods. Provided for cases where you need to check the ACL before selecting the mailbox.
Specified by:
hasLookupRights in interface Mailbox
Parameters:
username - String representing user

hasReadRights

public boolean hasReadRights(java.lang.String username)
                      throws AccessControlException
Description copied from interface: ACL
Helper boolean methods. Provided for cases where you need to check the ACL before selecting the mailbox.
Specified by:
hasReadRights in interface ACL
Following copied from interface: org.apache.james.imapserver.ACL
Parameters:
username - String representing user

hasKeepSeenRights

public boolean hasKeepSeenRights(java.lang.String username)
                          throws AccessControlException
Specified by:
hasKeepSeenRights in interface ACL

hasWriteRights

public boolean hasWriteRights(java.lang.String username)
                       throws AccessControlException
Specified by:
hasWriteRights in interface ACL

hasInsertRights

public boolean hasInsertRights(java.lang.String username)
                        throws AccessControlException
Specified by:
hasInsertRights in interface ACL

hasCreateRights

public boolean hasCreateRights(java.lang.String username)
                        throws AccessControlException
Description copied from interface: Mailbox
Establishes if specified user has create rights for this mailbox.
Specified by:
hasCreateRights in interface Mailbox
Following copied from interface: org.apache.james.imapserver.Mailbox
Parameters:
username - String represnting user
Throws:
AccessControlException - if user does not have lookup rights for this mailbox.

hasDeleteRights

public boolean hasDeleteRights(java.lang.String username)
                        throws AccessControlException
Specified by:
hasDeleteRights in interface ACL

hasAdminRights

public boolean hasAdminRights(java.lang.String username)
                       throws AccessControlException
Specified by:
hasAdminRights in interface ACL

isSelectable

public boolean isSelectable(java.lang.String username)
                     throws AccessControlException
Indicates if this folder may be selected by the specified user. Requires user to have at least read rights. It does not indicate whether user can write to mailbox
Specified by:
isSelectable in interface Mailbox
Parameters:
username - String represnting user
Throws:
AccessControlException - if username does not have lookup rights

allFlags

public boolean allFlags(java.lang.String username)
                 throws AccessControlException
Indicates if specified user can change any flag on a permanent basis, except for \Recent which can never be changed by a user.
Specified by:
allFlags in interface Mailbox
Parameters:
username - String represnting user

getPermanentFlags

public java.lang.String getPermanentFlags(java.lang.String username)
                                   throws AccessControlException
Indicates which flags this user can change permanently. If allFlags() returns true for this user, then this method must have the same return value as getSupportedFlags.
Specified by:
getPermanentFlags in interface Mailbox
Parameters:
username - String represnting user

isReadOnly

public boolean isReadOnly(java.lang.String username)
                   throws AccessControlException
Indicates state in which the mailbox will be opened by specified user. A return value of true indicates Read Only, false indicates Read-Write and an AccessControlException is thrown if user does not have read rights.

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.

Specified by:
isReadOnly in interface Mailbox
Parameters:
username - String represnting user
Throws:
AccessControlException - if the user can not open this mailbox at least Read-Only.

store

public boolean store(javax.mail.internet.MimeMessage message,
                     java.lang.String username)
              throws AccessControlException,
                     AuthorizationException,
                     java.lang.IllegalArgumentException
Stores a message in this mailbox. User must have insert rights.
Specified by:
store in interface Mailbox
Parameters:
message - the MimeMessage to be stored
username - String represnting user
Throws:
AccessControlException - if username does not have lookup rights for this mailbox.
AuthorizationException - if username has lookup rights but does not have insert rights.

store

public boolean store(javax.mail.internet.MimeMessage message,
                     java.lang.String username,
                     MessageAttributes msgAttrs,
                     Flags flags)
              throws AccessControlException,
                     AuthorizationException,
                     java.lang.IllegalArgumentException
Stores a message in this mailbox, using passed MessageAttributes and Flags. User must have insert rights.
Current implementation requires MessageAttributs to be of class SimpleMessageAttributes
Specified by:
store in interface Mailbox
Parameters:
mail - the message to be stored
username - String represnting user
msgAttrs - non-null MessageAttributes for use with this Message
Throws:
AccessControlException - if username does not have lookup rights for this mailbox.
AuthorizationException - if username has lookup rights but does not have insert rights.

retrieve

public MimeMessageWrapper retrieve(int msn,
                                   java.lang.String user)
                            throws AccessControlException,
                                   AuthorizationException
Retrieves a message given a message sequence number.
Specified by:
retrieve in interface Mailbox
Parameters:
msn - the message sequence number
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have read rights.

retrieveUID

public MimeMessageWrapper retrieveUID(int uid,
                                      java.lang.String user)
                               throws AccessControlException,
                                      AuthorizationException
Retrieves a message given a unique identifier.
Specified by:
retrieveUID in interface Mailbox
Parameters:
uid - the unique identifier of a message
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have read rights.

markDeleted

public boolean markDeleted(int msn,
                           java.lang.String user)
                    throws AccessControlException,
                           AuthorizationException
Marks a message for deletion given a message sequence number.
Specified by:
markDeleted in interface Mailbox
Parameters:
msn - the message sequence number
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.

markDeletedUID

public boolean markDeletedUID(int uid,
                              java.lang.String user)
                       throws AccessControlException,
                              AuthorizationException
Marks a message for deletion given a unique identifier.
Specified by:
markDeletedUID in interface Mailbox
Parameters:
uidunique - identifier
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.

getMessageAttributes

public MessageAttributes getMessageAttributes(int msn,
                                              java.lang.String user)
                                       throws AccessControlException,
                                              AuthorizationException
Returns the message attributes for a message.
Specified by:
getMessageAttributes in interface Mailbox
Parameters:
msn - message sequence number
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.

getMessageAttributesUID

public MessageAttributes getMessageAttributesUID(int uid,
                                                 java.lang.String user)
                                          throws AccessControlException,
                                                 AuthorizationException
Returns the message attributes for a message.
Specified by:
getMessageAttributesUID in interface Mailbox
Parameters:
uid - unique identifier
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.

updateMessageAttributes

public boolean updateMessageAttributes(MessageAttributes attrs,
                                       java.lang.String user)
                                throws AccessControlException,
                                       AuthorizationException
Updates the attributes of a message.This may be incorporated into setFlags().
Specified by:
updateMessageAttributes in interface Mailbox
Parameters:
MessageAttributes - of a message already in this Mailbox
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.

getFlags

public java.lang.String getFlags(int msn,
                                 java.lang.String user)
                          throws AccessControlException,
                                 AuthorizationException
Get the IMAP-formatted String of flags for specified message.
Specified by:
getFlags in interface Mailbox
Parameters:
msn - message sequence number for a message in this mailbox
username - String represnting user
Throws:
AccessControlException - if user does not have lookup rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have read rights.

getFlagsUID

public java.lang.String getFlagsUID(int uid,
                                    java.lang.String user)
                             throws AccessControlException,
                                    AuthorizationException
Get the IMAP-formatted String of flags for specified message.
Specified by:
getFlagsUID in interface Mailbox
Parameters:
uid - UniqueIdentifier for a message in this mailbox
username - String represnting user
Throws:
AccessControlException - if user does not have lookup rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have read rights.

setFlags

public boolean setFlags(int msn,
                        java.lang.String user,
                        java.lang.String request)
                 throws AccessControlException,
                        AuthorizationException,
                        java.lang.IllegalArgumentException
Updates the flags for a message.
Specified by:
setFlags in interface Mailbox
Parameters:
msn - MessageSequenceNumber of a message already in this Mailbox
username - String represnting user
request - IMAP-formatted String representing requested change to flags.
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.

setFlagsUID

public boolean setFlagsUID(int uid,
                           java.lang.String user,
                           java.lang.String request)
                    throws AccessControlException,
                           AuthorizationException,
                           java.lang.IllegalArgumentException
Updates the flags for a message.
Specified by:
setFlagsUID in interface Mailbox
Parameters:
uid - Unique Identifier of a message already in this Mailbox
username - String represnting user
request - IMAP-formatted String representing requested change to flags.
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.

expunge

public boolean expunge(java.lang.String user)
                throws AccessControlException,
                       AuthorizationException
Removes all messages marked Deleted. User must have delete rights.
Specified by:
expunge in interface Mailbox
Parameters:
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has delete rights but does not have delete rights.

listUIDs

public java.util.List listUIDs(java.lang.String user)
Lists uids of messages in mailbox indexed by MSN.
Specified by:
listUIDs in interface Mailbox
Parameters:
username - String represnting user

getUsersWithLookupRights

public java.util.Set getUsersWithLookupRights()
Specified by:
getUsersWithLookupRights in interface ACL

getUsersWithReadRights

public java.util.Set getUsersWithReadRights()
Specified by:
getUsersWithReadRights in interface ACL

getUnseenByUser

public java.util.Map getUnseenByUser()
Description copied from interface: Mailbox
Gets map of users to number of unseen messages. User key will only be present if getOldestUnseen() has been called, usually as a result of an IMAP SELECT or EXAMINE.
Specified by:
getUnseenByUser in interface Mailbox

getInternetHeaders

public javax.mail.internet.InternetHeaders getInternetHeaders(int msn,
                                                              java.lang.String user)
                                                       throws AccessControlException,
                                                              AuthorizationException
Description copied from interface: Mailbox
Returns the Internet Headers for a message. These are the top-level headers only, ie not MIME part headers or headers of encapsulated messages.
Specified by:
getInternetHeaders in interface Mailbox
Following copied from interface: org.apache.james.imapserver.Mailbox
Parameters:
msn - message sequence number
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.

getInternetHeadersUID

public javax.mail.internet.InternetHeaders getInternetHeadersUID(int uid,
                                                                 java.lang.String user)
                                                          throws AccessControlException,
                                                                 AuthorizationException
Description copied from interface: Mailbox
Returns the Internet Headers for a message. These are the top-level headers only, ie not MIME part headers or headers of encapsulated messages.
Specified by:
getInternetHeadersUID in interface Mailbox
Following copied from interface: org.apache.james.imapserver.Mailbox
Parameters:
uid - UniqueIdentifier for a message in this mailbox
username - String represnting user
Throws:
AccessControlException - if user does not have read rights for this mailbox.
AuthorizationException - if user has lookup rights but does not have delete rights.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.