|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.james.mailrepository.javamail.AbstractJavamailStoreMailRepository
org.apache.james.mailrepository.javamail.HashJavamailStoreMailRepository
public class HashJavamailStoreMailRepository
MailRepository implementation to store mail in a Javamail store.
should work with every JavamailStore implementation that has deterministic
message content. (checksum save). This implementation should be considered as
EXPERIMENTAL.
TODO examine for thread-safety
Nested Class Summary | |
---|---|
static class |
HashJavamailStoreMailRepository.HasherOutputStream
|
protected class |
HashJavamailStoreMailRepository.KeyToMsgMap
|
protected static class |
HashJavamailStoreMailRepository.MsgObj
used to internal represent a message |
Field Summary | |
---|---|
protected HashJavamailStoreMailRepository.KeyToMsgMap |
keyToMsgMap
tridirectional map of messages key, hash and number saved in internaly used class MsgObj |
Fields inherited from class org.apache.james.mailrepository.javamail.AbstractJavamailStoreMailRepository |
---|
cacheMessages, DEEP_DEBUG, log |
Fields inherited from interface org.apache.james.services.MailRepository |
---|
MAIL, ROLE |
Constructor Summary | |
---|---|
HashJavamailStoreMailRepository()
|
Method Summary | |
---|---|
protected static java.lang.Object |
calcMessageHash(javax.mail.internet.MimeMessage mm)
currently uses Arrays.hashCode to build an Integer. |
FolderInterface |
createAdapter(javax.mail.Folder folder)
just uses a FolderAdapter to wrap around folder |
protected static java.lang.String |
generateKey(java.lang.String hash)
builds a key for unknow messages |
protected HashJavamailStoreMailRepository.KeyToMsgMap |
getKeyToMsgMap()
lazy loads KeyToMsgMap |
protected int |
getMessageCount()
|
protected javax.mail.internet.MimeMessage |
getMessageFromInbox(java.lang.String key)
Fetches a message from inbox. |
java.util.Iterator |
list()
calls rehash and uses stored keys in KeyToMsgMap |
protected javax.mail.internet.MimeMessage |
rehash(java.lang.String filterkey)
Calls getMessages(); on Folder and rehashes messages an renews message numbers calls retainAllListedAndAddedByKeys on KeyToMsgMap to remove keys not found in Folder |
void |
remove(java.lang.String key)
Removes a message identified by key. |
org.apache.mailet.Mail |
retrieve(java.lang.String key)
uses getMessageFromInbox, returns null if not found |
void |
store(org.apache.mailet.Mail mc)
Stores a message by Javamails appendMessages method. |
Methods inherited from class org.apache.james.mailrepository.javamail.AbstractJavamailStoreMailRepository |
---|
configure, enableLogging, getFolderGateKeeper, getLock, getRandom, getStore, initialize, lock, remove, remove, service, unlock |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected HashJavamailStoreMailRepository.KeyToMsgMap keyToMsgMap
Constructor Detail |
---|
public HashJavamailStoreMailRepository()
Method Detail |
---|
protected int getMessageCount() throws javax.mail.MessagingException
javax.mail.MessagingException
public void store(org.apache.mailet.Mail mc) throws javax.mail.MessagingException
mc
- the mail message to store
javax.mail.MessagingException
MailRepository.store(Mail)
public java.util.Iterator list() throws javax.mail.MessagingException
Iterator
over the list of keys in the repository
javax.mail.MessagingException
MailRepository.list()
public org.apache.mailet.Mail retrieve(java.lang.String key) throws javax.mail.MessagingException
key
- the key of the message to retrieve
javax.mail.MessagingException
MailRepository.retrieve(String)
public void remove(java.lang.String key) throws javax.mail.MessagingException
key
- the key of the message to be removed from the repository
javax.mail.MessagingException
MailRepository.remove(String)
protected javax.mail.internet.MimeMessage rehash(java.lang.String filterkey) throws javax.mail.MessagingException
filterkey
- key of message that should be returned, can be null
javax.mail.MessagingException
protected javax.mail.internet.MimeMessage getMessageFromInbox(java.lang.String key) throws javax.mail.MessagingException
key
- message key
javax.mail.MessagingException
protected HashJavamailStoreMailRepository.KeyToMsgMap getKeyToMsgMap()
protected static java.lang.Object calcMessageHash(javax.mail.internet.MimeMessage mm) throws javax.mail.MessagingException
mm
- message to hash
javax.mail.MessagingException
protected static java.lang.String generateKey(java.lang.String hash)
hash
- Hash to be included in key
public FolderInterface createAdapter(javax.mail.Folder folder)
folder
- JavaMail folder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |