K
- the key type.V
- the value type.public class DefaultIndexedXmlFileValueManager<K extends Serializable,V> extends AbstractIndexedFileValueManager<K,V>
XmlUtils.writeXmlToFile(java.io.File, Object)
,
XmlUtils.readXmlFromFile(java.io.File, Class)
PERSISTENCE_STORAGE_INDEX_FILE, PERSISTENCE_STORAGE_INDEX_FILENAME
Constructor and Description |
---|
DefaultIndexedXmlFileValueManager(CachingDirectory cachingDirectory,
Class<V> xmlClazz,
PersistencesRestoreMethod persistencesRestoreMethod,
int indexSaveInterval)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Class<V> |
getXmlClazz()
The class name of V.
|
V |
retrieveFileValue(DefaultFileValueWrapper<K,V> valueWrapper)
Loads the value from the file in valueWrapper.
|
void |
storeFileValue(DefaultFileValueWrapper<K,V> valueWrapper,
K key,
V value)
This method shall the take the Value and stored it in a file given by the valueWrapper.
|
constructFile, flush, getIndexSaveInterval, reconstructKey, removeAll, removeValue, retrieveValue, storeValue
cast, constructWrapper, getCachingDirectory, getFile, restore, updateExpireTime
getLogger, getPersistencesRestoreMethod, isPersisted
public DefaultIndexedXmlFileValueManager(CachingDirectory cachingDirectory, Class<V> xmlClazz, PersistencesRestoreMethod persistencesRestoreMethod, int indexSaveInterval) throws NullPointerException, IllegalArgumentException
cachingDirectory
- the directory where to store the cached values.xmlClazz
- the class name of V.persistencesRestoreMethod
- the restore method, when reconstructing the LRUCachingMap.indexSaveInterval
- how many changes (put,remove) must occur before the key/file index file is saved, allways forced save after (restore and cleanup)IllegalArgumentException
- if cacheDirectory isnt a valid directory or if xmlClazz is not annotated with "@XmlRootElement".NullPointerException
- if cachingDirectory, xmlClazz,or persistencesRestoreMethod is null
.public void storeFileValue(DefaultFileValueWrapper<K,V> valueWrapper, K key, V value) throws RuntimeException
AbstractIndexedFileValueManager
storeFileValue
in class AbstractIndexedFileValueManager<K extends Serializable,V>
valueWrapper
- the value wrapper which holds the file.key
- the key.value
- the value.RuntimeException
- if the value can not be stored in the file.public V retrieveFileValue(DefaultFileValueWrapper<K,V> valueWrapper)
AbstractIndexedFileValueManager
retrieveFileValue
in class AbstractIndexedFileValueManager<K extends Serializable,V>
valueWrapper
- the value wrapperCopyright © 2016. All rights reserved.