org.apache.james.mailrepository.javamail
Class HashJavamailStoreMailRepository.KeyToMsgMap

java.lang.Object
  extended by org.apache.james.mailrepository.javamail.HashJavamailStoreMailRepository.KeyToMsgMap
Enclosing class:
HashJavamailStoreMailRepository

protected class HashJavamailStoreMailRepository.KeyToMsgMap
extends java.lang.Object


Field Summary
protected  java.util.Map hashToMsgObj
           
protected  java.util.Map keyToMsgObj
           
protected  java.util.SortedMap noToMsgObj
           
 
Constructor Summary
protected HashJavamailStoreMailRepository.KeyToMsgMap()
           
 
Method Summary
 boolean contains(java.lang.String key)
          Return true if a MsgObj is stored with the given key
 HashJavamailStoreMailRepository.MsgObj getByKey(java.lang.String key)
          Return the MsgObj associted with the given key
 java.lang.String[] getKeys()
          Return an String[] of all stored keys
 HashJavamailStoreMailRepository.MsgObj getMsgObj(java.lang.String key)
          TODO: Check why we have to methods which do the same
 java.lang.String getStat()
          only used for debugging
 HashJavamailStoreMailRepository.MsgObj put(javax.mail.internet.MimeMessage mm, java.lang.String key, int no)
          At first it tries to lookup message by key otherwise by hash or stores it as new
 void removeByKey(java.lang.String key, boolean decrement)
          removes a message from the maps.
 void retainAllListedAndAddedByKeys(java.lang.String[] keysBefore, java.lang.String[] listed)
          Cleans up database after rehash.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

noToMsgObj

protected java.util.SortedMap noToMsgObj

keyToMsgObj

protected java.util.Map keyToMsgObj

hashToMsgObj

protected java.util.Map hashToMsgObj
Constructor Detail

HashJavamailStoreMailRepository.KeyToMsgMap

protected HashJavamailStoreMailRepository.KeyToMsgMap()
Method Detail

contains

public boolean contains(java.lang.String key)
Return true if a MsgObj is stored with the given key

Parameters:
key - the key
Returns:
true if a MsgObj is stored with the given key

retainAllListedAndAddedByKeys

public void retainAllListedAndAddedByKeys(java.lang.String[] keysBefore,
                                          java.lang.String[] listed)
Cleans up database after rehash. Only keys listed by rehash or added in the meantime are retained

Parameters:
keysBefore - keys that have exist before rehash was called
listed - keys that have listed by rehash

getStat

public java.lang.String getStat()
only used for debugging

Returns:
a String representing the sizes of the internal maps

removeByKey

public void removeByKey(java.lang.String key,
                        boolean decrement)
removes a message from the maps.

Parameters:
key - key of message
decrement - if true, all message number greater than this are decremented

getKeys

public java.lang.String[] getKeys()
Return an String[] of all stored keys

Returns:
keys a String[] of all stored keys

getByKey

public HashJavamailStoreMailRepository.MsgObj getByKey(java.lang.String key)
Return the MsgObj associted with the given key

Parameters:
key - the key
Returns:
msgObj the MsgObj for the given key

put

public HashJavamailStoreMailRepository.MsgObj put(javax.mail.internet.MimeMessage mm,
                                                  java.lang.String key,
                                                  int no)
                                           throws javax.mail.MessagingException
At first it tries to lookup message by key otherwise by hash or stores it as new

Parameters:
mm - message
key - if null it will be generated when not found by hash
no - current number of this message
Returns:
fetched/created MsgObj
Throws:
javax.mail.MessagingException

getMsgObj

public HashJavamailStoreMailRepository.MsgObj getMsgObj(java.lang.String key)
TODO: Check why we have to methods which do the same

See Also:
getByKey(String)


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.