public class JCRMessageMapper extends AbstractMessageMapper<String> implements JCRImapConstants
MessageMapper
. The implementation store each message as
a seperate child node under the mailboxMessageMapper.FetchType
Mapper.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/
|
mailboxSession
NODE_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, updateFlags
execute
public 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_YEAR
public 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.RepositoryException
protected void begin() throws MailboxException
begin
in class TransactionalMapper
MailboxException
protected void commit() throws MailboxException
commit
in class TransactionalMapper
MailboxException
protected void rollback() throws MailboxException
rollback
in class TransactionalMapper
MailboxException
public long countMessagesInMailbox(Mailbox<String> mailbox) throws MailboxException
MessageMapper
countMessagesInMailbox
in interface MessageMapper<String>
MailboxException
public long countUnseenMessagesInMailbox(Mailbox<String> mailbox) throws MailboxException
MessageMapper
countUnseenMessagesInMailbox
in interface MessageMapper<String>
MailboxException
public void delete(Mailbox<String> mailbox, Message<String> message) throws MailboxException
MessageMapper
Message
delete
in interface MessageMapper<String>
MailboxException
public Iterator<Message<String>> findInMailbox(Mailbox<String> mailbox, MessageRange set, MessageMapper.FetchType fType, int max) throws MailboxException
MessageMapper
Iterator
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 itMailboxException
public List<Long> findRecentMessageUidsInMailbox(Mailbox<String> mailbox) throws MailboxException
MessageMapper
findRecentMessageUidsInMailbox
in interface MessageMapper<String>
MailboxException
public Long findFirstUnseenMessageUid(Mailbox<String> mailbox) throws MailboxException
MessageMapper
findFirstUnseenMessageUid
in interface MessageMapper<String>
MailboxException
public void endRequest()
endRequest
in interface Mapper
protected MessageMetaData copy(Mailbox<String> mailbox, long uid, long modSeq, Message<String> original) throws MailboxException
AbstractMessageMapper
copy
in class AbstractMessageMapper<String>
MailboxException
protected MessageMetaData save(Mailbox<String> mailbox, Message<String> message) throws MailboxException
AbstractMessageMapper
save
in class AbstractMessageMapper<String>
MailboxException
public Map<Long,MessageMetaData> expungeMarkedForDeletionInMailbox(Mailbox<String> mailbox, MessageRange set) throws MailboxException
MessageMapper
Iterator
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>
MailboxException
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.