|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLoggable | +--org.apache.james.imapserver.FileMailbox
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: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
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 |
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 |
public static final java.lang.String MAILBOX_FILE_NAME
Constructor Detail |
public FileMailbox()
Method Detail |
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
public void contextualize(org.apache.avalon.framework.context.Context context)
contextualize
in interface org.apache.avalon.framework.context.Contextualizable
public void compose(org.apache.avalon.framework.component.ComponentManager comp)
compose
in interface org.apache.avalon.framework.component.Composable
public void prepareMailbox(java.lang.String user, java.lang.String absName, java.lang.String initialAdminUser)
ACLMailbox
prepareMailbox
in interface ACLMailbox
org.apache.james.imapserver.ACLMailbox
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 mailboxpublic void initialize() throws java.lang.Exception
initialize
in interface org.apache.avalon.framework.activity.Initializable
public void reinitialize() throws java.lang.Exception
Contract is that re-init must be called after configure, contextualize, compose.
reinitialize
in interface ACLMailbox
public void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
public boolean checkpoint()
checkpoint
in interface Mailbox
public void unsetRecent()
unsetRecent
in interface Mailbox
public java.lang.String getName()
getName
in interface Mailbox
public java.lang.String getAbsoluteName()
getAbsoluteName
in interface Mailbox
public boolean matchesName(java.lang.String testName)
matchesName
in interface Mailbox
name
- possible name for this Mailboxpublic int getUIDValidity()
getUIDValidity
in interface Mailbox
public int getNextUID()
getNextUID
in interface Mailbox
public int getMailboxSize()
getMailboxSize
in interface Mailbox
public boolean getInferiorsAllowed()
getInferiorsAllowed
in interface Mailbox
public boolean isMarked()
isMarked
in interface Mailbox
public java.lang.String getSupportedFlags()
getSupportedFlags
in interface Mailbox
public int getRecent()
getRecent
in interface Mailbox
public int getOldestUnseen(java.lang.String user)
getOldestUnseen
in interface Mailbox
public int getExists()
getExists
in interface Mailbox
public int getUnseen(java.lang.String user)
getUnseen
in interface Mailbox
public void addMailboxEventListener(MailboxEventListener mel)
addMailboxEventListener
in interface Mailbox
public void removeMailboxEventListener(MailboxEventListener mel)
removeMailboxEventListener
in interface Mailbox
public void setNotSelectableByAnyone(boolean state)
setNotSelectableByAnyone
in interface Mailbox
state
- true if folder is not selectable by anyonepublic boolean isNotSelectableByAnyone()
isNotSelectableByAnyone
in interface Mailbox
public boolean setRights(java.lang.String setter, java.lang.String identifier, java.lang.String modification) throws AccessControlException, AuthorizationException
setRights
in interface ACL
setter
- String representing user attempting to set rights, must
be non-null and non-emptyidentity
- String representing user whose rights are being set,
must be non-null and non-emptymodification
- String representing the change in rights, following
the syntax specified in rfc 2086. Note a blank string means delete all
rights for given identity.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.public java.lang.String getRights(java.lang.String getter, java.lang.String identity) throws AccessControlException, AuthorizationException
getRights
in interface ACL
getter
- String representing user attempting to get the rights,
must be non-null and non-emptyidentity
- String representing user whose rights are being got,
must be non-null and non-emptyAccessControlException
- 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.public java.lang.String getAllRights(java.lang.String getter) throws AccessControlException, AuthorizationException
getAllRights
in interface ACL
getter
- String representing user attempting to get the rights,
must be non-null and non-emptyAccessControlException
- 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.public java.lang.String getRequiredRights(java.lang.String getter, java.lang.String identity) throws AccessControlException, AuthorizationException
getRequiredRights
in interface ACL
getter
- String representing user attempting to get the rights,
must be non-null and non-emptyidentity
- String representing user whose rights are being got,
must be non-null and non-emptyAccessControlException
- 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.public java.lang.String getOptionalRights(java.lang.String getter, java.lang.String identity) throws AccessControlException, AuthorizationException
getOptionalRights
in interface ACL
getter
- String representing user attempting to get the rights,
must be non-null and non-emptyidentity
- String representing user whose rights are being got,
must be non-null and non-emptyAccessControlException
- 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.public boolean hasLookupRights(java.lang.String username)
hasLookupRights
in interface Mailbox
username
- String representing userpublic boolean hasReadRights(java.lang.String username) throws AccessControlException
ACL
hasReadRights
in interface ACL
org.apache.james.imapserver.ACL
username
- String representing userpublic boolean hasKeepSeenRights(java.lang.String username) throws AccessControlException
hasKeepSeenRights
in interface ACL
public boolean hasWriteRights(java.lang.String username) throws AccessControlException
hasWriteRights
in interface ACL
public boolean hasInsertRights(java.lang.String username) throws AccessControlException
hasInsertRights
in interface ACL
public boolean hasCreateRights(java.lang.String username) throws AccessControlException
Mailbox
hasCreateRights
in interface Mailbox
org.apache.james.imapserver.Mailbox
username
- String represnting userAccessControlException
- if user does not have lookup rights for
this mailbox.public boolean hasDeleteRights(java.lang.String username) throws AccessControlException
hasDeleteRights
in interface ACL
public boolean hasAdminRights(java.lang.String username) throws AccessControlException
hasAdminRights
in interface ACL
public boolean isSelectable(java.lang.String username) throws AccessControlException
isSelectable
in interface Mailbox
username
- String represnting userAccessControlException
- if username does not have lookup rightspublic boolean allFlags(java.lang.String username) throws AccessControlException
allFlags
in interface Mailbox
username
- String represnting userpublic java.lang.String getPermanentFlags(java.lang.String username) throws AccessControlException
getPermanentFlags
in interface Mailbox
username
- String represnting userpublic 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.
isReadOnly
in interface Mailbox
username
- String represnting userAccessControlException
- if the user can not open this mailbox
at least Read-Only.public boolean store(javax.mail.internet.MimeMessage message, java.lang.String username) throws AccessControlException, AuthorizationException, java.lang.IllegalArgumentException
store
in interface Mailbox
message
- the MimeMessage 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 msgAttrs, Flags flags) throws AccessControlException, AuthorizationException, java.lang.IllegalArgumentException
store
in interface Mailbox
mail
- the message to be storedusername
- String represnting usermsgAttrs
- non-null MessageAttributes for use with 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
retrieve
in interface Mailbox
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 read rights.public MimeMessageWrapper retrieveUID(int uid, java.lang.String user) throws AccessControlException, AuthorizationException
retrieveUID
in interface Mailbox
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
markDeleted
in interface Mailbox
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
markDeletedUID
in interface Mailbox
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
getMessageAttributes
in interface Mailbox
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
getMessageAttributesUID
in interface Mailbox
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
updateMessageAttributes
in interface Mailbox
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
getFlags
in interface Mailbox
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
getFlagsUID
in interface Mailbox
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
setFlags
in interface Mailbox
msn
- MessageSequenceNumber of a message already in this Mailboxusername
- String represnting userrequest
- IMAP-formatted String representing requested change to
flags.AccessControlException
- 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
setFlagsUID
in interface Mailbox
uid
- Unique Identifier of a message already in this Mailboxusername
- String represnting userrequest
- IMAP-formatted String representing requested change to
flags.AccessControlException
- 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
expunge
in interface Mailbox
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 java.util.List listUIDs(java.lang.String user)
listUIDs
in interface Mailbox
username
- String represnting userpublic java.util.Set getUsersWithLookupRights()
getUsersWithLookupRights
in interface ACL
public java.util.Set getUsersWithReadRights()
getUsersWithReadRights
in interface ACL
public java.util.Map getUnseenByUser()
Mailbox
getUnseenByUser
in interface Mailbox
public javax.mail.internet.InternetHeaders getInternetHeaders(int msn, java.lang.String user) throws AccessControlException, AuthorizationException
Mailbox
getInternetHeaders
in interface Mailbox
org.apache.james.imapserver.Mailbox
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
Mailbox
getInternetHeadersUID
in interface Mailbox
org.apache.james.imapserver.Mailbox
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |