public class JCRMessageMapper extends AbstractMessageMapper<String> implements JCRImapConstants
MessageMapper. The implementation store each message as
a seperate child node under the mailboxMessageMapper.FetchTypeMapper.Transaction<T>, Mapper.VoidTransaction| Modifier and Type | Field and Description |
|---|---|
static int |
MESSAGE_SCALE_DAY
Store the messages under a year/month/day directory in the mailbox:
.../mailbox/2010/05/01/
|
static int |
MESSAGE_SCALE_HOUR
Store the messages under a year/month/day/hour directory in the mailbox:
.../mailbox/2010/05/02/11
|
static int |
MESSAGE_SCALE_MINUTE
Store the messages under a year/month/day/hour/min directory in the
mailbox: .../mailbox/2010/05/02/11/59
|
static int |
MESSAGE_SCALE_MONTH
Store the messages under a year/month directory in the mailbox:
.../mailbox/2010/05/
|
static int |
MESSAGE_SCALE_NONE
Store the messages directly in the mailbox: .../mailbox/
|
static int |
MESSAGE_SCALE_YEAR
Store the messages under a year directory in the mailbox:
.../mailbox/2010/
|
mailboxSessionNODE_DELIMITER| Constructor and Description |
|---|
JCRMessageMapper(MailboxSessionJCRRepository repos,
MailboxSession session,
UidProvider<String> uidProvider,
ModSeqProvider<String> modSeqProvider)
Construct a new
JCRMessageMapper instance using MESSAGE_SCALE_DAY as default |
JCRMessageMapper(MailboxSessionJCRRepository repository,
MailboxSession mSession,
UidProvider<String> uidProvider,
ModSeqProvider<String> modSeqProvider,
int scaleType)
Construct a new
JCRMessageMapper instance |
| Modifier and Type | Method and Description |
|---|---|
protected void |
begin()
Begin is not supported by level 1 JCR implementations, however we refresh the session
|
protected void |
commit()
Just call save on the underlying JCR Session, because level 1 JCR implementation does not offer Transactions
|
protected MessageMetaData |
copy(Mailbox<String> mailbox,
long uid,
long modSeq,
Message<String> original)
Copy the Message to the Mailbox, using the given uid and modSeq for the new Message
|
long |
countMessagesInMailbox(Mailbox<String> mailbox)
Return the count of messages in the mailbox
|
long |
countUnseenMessagesInMailbox(Mailbox<String> mailbox)
Return the count of unseen messages in the mailbox
|
void |
delete(Mailbox<String> mailbox,
Message<String> message)
Delete the given
Message |
void |
endRequest()
Logout from open JCR Session
|
Map<Long,MessageMetaData> |
expungeMarkedForDeletionInMailbox(Mailbox<String> mailbox,
MessageRange set)
Return a
Iterator which holds the uids for all deleted Messages for the given MessageRange which are marked for deletion
The list must be ordered |
Long |
findFirstUnseenMessageUid(Mailbox<String> mailbox)
Return the uid of the first unseen message.
|
Iterator<Message<String>> |
findInMailbox(Mailbox<String> mailbox,
MessageRange set,
MessageMapper.FetchType fType,
int max)
|
List<Long> |
findRecentMessageUidsInMailbox(Mailbox<String> mailbox)
Return a List of
Message which are recent. |
protected javax.jcr.Session |
getSession()
Return the JCR Session
|
protected void |
rollback()
Rollback is not supported by level 1 JCR implementations, so just do nothing
|
protected MessageMetaData |
save(Mailbox<String> mailbox,
Message<String> message)
|
add, copy, getHighestModSeq, getLastUid, updateFlagsexecutepublic static final int MESSAGE_SCALE_NONE
public static final int MESSAGE_SCALE_YEAR
public static final int MESSAGE_SCALE_MONTH
public static final int MESSAGE_SCALE_DAY
public static final int MESSAGE_SCALE_HOUR
public static final int MESSAGE_SCALE_MINUTE
public JCRMessageMapper(MailboxSessionJCRRepository repository, MailboxSession mSession, UidProvider<String> uidProvider, ModSeqProvider<String> modSeqProvider, int scaleType)
JCRMessageMapper instancerepository - MailboxSessionJCRRepository to usemSession - MailboxSession to which the mapper is bounduidProvider - UidProvider to usemodSeqProvider - ModSeqProvider to usescaleType - message scale type either MESSAGE_SCALE_DAY, MESSAGE_SCALE_HOUR, MESSAGE_SCALE_MINUTE,
MESSAGE_SCALE_MONTH, MESSAGE_SCALE_NONE or MESSAGE_SCALE_YEARpublic JCRMessageMapper(MailboxSessionJCRRepository repos, MailboxSession session, UidProvider<String> uidProvider, ModSeqProvider<String> modSeqProvider)
JCRMessageMapper instance using MESSAGE_SCALE_DAY as defaultrepos - MailboxSessionJCRRepository to usesession - MailboxSession to which the mapper is bounduidProvider - UidProvider to usemodSeqProvider - ModSeqProvider to useprotected javax.jcr.Session getSession()
throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprotected void begin()
throws MailboxException
begin in class TransactionalMapperMailboxExceptionprotected void commit()
throws MailboxException
commit in class TransactionalMapperMailboxExceptionprotected void rollback()
throws MailboxException
rollback in class TransactionalMapperMailboxExceptionpublic long countMessagesInMailbox(Mailbox<String> mailbox) throws MailboxException
MessageMappercountMessagesInMailbox in interface MessageMapper<String>MailboxExceptionpublic long countUnseenMessagesInMailbox(Mailbox<String> mailbox) throws MailboxException
MessageMappercountUnseenMessagesInMailbox in interface MessageMapper<String>MailboxExceptionpublic void delete(Mailbox<String> mailbox, Message<String> message) throws MailboxException
MessageMapperMessagedelete in interface MessageMapper<String>MailboxExceptionpublic Iterator<Message<String>> findInMailbox(Mailbox<String> mailbox, MessageRange set, MessageMapper.FetchType fType, int max) throws MailboxException
MessageMapperIterator which holds the messages for the given criterias
The list must be ordered by the Message uidfindInMailbox in interface MessageMapper<String>mailbox - The mailbox to searchset - message range for batch processingmax - the maximal limit of returned Message's. Use -1 to set no limit. In any case the caller MUST not expect the limit to get applied in all cases as the implementation
MAY just ignore itMailboxExceptionpublic List<Long> findRecentMessageUidsInMailbox(Mailbox<String> mailbox) throws MailboxException
MessageMapperfindRecentMessageUidsInMailbox in interface MessageMapper<String>MailboxExceptionpublic Long findFirstUnseenMessageUid(Mailbox<String> mailbox) throws MailboxException
MessageMapperfindFirstUnseenMessageUid in interface MessageMapper<String>MailboxExceptionpublic void endRequest()
endRequest in interface Mapperprotected MessageMetaData copy(Mailbox<String> mailbox, long uid, long modSeq, Message<String> original) throws MailboxException
AbstractMessageMappercopy in class AbstractMessageMapper<String>MailboxExceptionprotected MessageMetaData save(Mailbox<String> mailbox, Message<String> message) throws MailboxException
AbstractMessageMappersave in class AbstractMessageMapper<String>MailboxExceptionpublic Map<Long,MessageMetaData> expungeMarkedForDeletionInMailbox(Mailbox<String> mailbox, MessageRange set) throws MailboxException
MessageMapperIterator which holds the uids for all deleted Messages for the given MessageRange which are marked for deletion
The list must be orderedexpungeMarkedForDeletionInMailbox in interface MessageMapper<String>MailboxExceptionCopyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.