public class HBaseMessageMapper extends NonTransactionalMapper implements MessageMapper<UUID>
MessageMapper
.
I don't know if this class is thread-safe! Asume it is not!MessageMapper.FetchType
Mapper.Transaction<T>, Mapper.VoidTransaction
Constructor and Description |
---|
HBaseMessageMapper(MailboxSession session,
UidProvider<UUID> uidProvider,
ModSeqProvider<UUID> modSeqProvider,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
MessageMetaData |
add(Mailbox<UUID> mailbox,
Message<UUID> message)
Add the given
Message to the underlying storage. |
MessageMetaData |
copy(Mailbox<UUID> mailbox,
Message<UUID> original)
Copy the given
Message to a new mailbox and return the uid of the copy. |
long |
countMessagesInMailbox(Mailbox<UUID> mailbox)
Return the count of messages in the mailbox
|
long |
countUnseenMessagesInMailbox(Mailbox<UUID> mailbox)
Return the count of unseen messages in the mailbox
|
void |
delete(Mailbox<UUID> mailbox,
Message<UUID> message)
Delete the given
Message |
void |
endRequest()
IMAP Request was complete.
|
Map<Long,MessageMetaData> |
expungeMarkedForDeletionInMailbox(Mailbox<UUID> 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<UUID> mailbox)
Return the uid of the first unseen message.
|
Iterator<Message<UUID>> |
findInMailbox(Mailbox<UUID> mailbox,
MessageRange set,
MessageMapper.FetchType fType,
int max)
|
List<Long> |
findRecentMessageUidsInMailbox(Mailbox<UUID> mailbox)
Return a List of
Message which are recent. |
long |
getHighestModSeq(Mailbox<UUID> mailbox)
Return the higest mod-sequence which were used for storing a Message in the
Mailbox |
long |
getLastUid(Mailbox<UUID> mailbox)
Return the last uid which were used for storing a Message in the
Mailbox |
protected MessageMetaData |
save(Mailbox<UUID> mailbox,
Message<UUID> message)
|
Iterator<UpdatedFlags> |
updateFlags(Mailbox<UUID> mailbox,
javax.mail.Flags flags,
boolean value,
boolean replace,
MessageRange set)
Update flags for the given
MessageRange . |
execute
public HBaseMessageMapper(MailboxSession session, UidProvider<UUID> uidProvider, ModSeqProvider<UUID> modSeqProvider, org.apache.hadoop.conf.Configuration conf)
public void endRequest()
Mapper
endRequest
in interface Mapper
public Iterator<Message<UUID>> findInMailbox(Mailbox<UUID> 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<UUID>
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 Map<Long,MessageMetaData> expungeMarkedForDeletionInMailbox(Mailbox<UUID> 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<UUID>
MailboxException
public long countMessagesInMailbox(Mailbox<UUID> mailbox) throws MailboxException
MessageMapper
countMessagesInMailbox
in interface MessageMapper<UUID>
MailboxException
public long countUnseenMessagesInMailbox(Mailbox<UUID> mailbox) throws MailboxException
MessageMapper
countUnseenMessagesInMailbox
in interface MessageMapper<UUID>
MailboxException
public void delete(Mailbox<UUID> mailbox, Message<UUID> message) throws MailboxException
MessageMapper
Message
delete
in interface MessageMapper<UUID>
MailboxException
public Long findFirstUnseenMessageUid(Mailbox<UUID> mailbox) throws MailboxException
MessageMapper
findFirstUnseenMessageUid
in interface MessageMapper<UUID>
MailboxException
public List<Long> findRecentMessageUidsInMailbox(Mailbox<UUID> mailbox) throws MailboxException
MessageMapper
findRecentMessageUidsInMailbox
in interface MessageMapper<UUID>
MailboxException
public MessageMetaData add(Mailbox<UUID> mailbox, Message<UUID> message) throws MailboxException
MessageMapper
Message
to the underlying storage. Be aware that implementation may choose to replace the uid of the given message while storing.
So you should only depend on the returned uid.add
in interface MessageMapper<UUID>
MailboxException
public Iterator<UpdatedFlags> updateFlags(Mailbox<UUID> mailbox, javax.mail.Flags flags, boolean value, boolean replace, MessageRange set) throws MailboxException
MessageMapper
MessageRange
. Only the flags may be modified after a message was saved to a mailbox.updateFlags
in interface MessageMapper<UUID>
MailboxException
public MessageMetaData copy(Mailbox<UUID> mailbox, Message<UUID> original) throws MailboxException
MessageMapper
Message
to a new mailbox and return the uid of the copy. Be aware that the given uid is just a suggestion for the uid of the copied
message. Implementation may choose to use a different one, so only depend on the returned uid!copy
in interface MessageMapper<UUID>
mailbox
- the Mailbox to copy tooriginal
- the original to copyMailboxException
public long getLastUid(Mailbox<UUID> mailbox) throws MailboxException
MessageMapper
Mailbox
getLastUid
in interface MessageMapper<UUID>
MailboxException
public long getHighestModSeq(Mailbox<UUID> mailbox) throws MailboxException
MessageMapper
Mailbox
getHighestModSeq
in interface MessageMapper<UUID>
MailboxException
protected MessageMetaData save(Mailbox<UUID> mailbox, Message<UUID> message) throws MailboxException
mailbox
- message
- MailboxException
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.