K - the key type.V - the value type.public final class DefaultKeyedXmlFileValueManager<K extends Serializable,V extends Keyed<K>> extends AbstractKeyedFileValueManager<K,V>
@XmlRootElement. Keyed.XmlUtils.writeXmlToFile(java.io.File, Object),
XmlUtils.readXmlFromFile(java.io.File, Class)| Constructor and Description |
|---|
DefaultKeyedXmlFileValueManager(CachingDirectory cachingDirectory,
Class<V> xmlClazz,
PersistencesRestoreMethod persistencesRestoreMethod)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
This is ensures that any memory data that needs to be persisted is flushed.
|
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, reconstructKey, retrieveValue, storeValuecast, constructWrapper, getCachingDirectory, getFile, removeAll, removeValue, restore, updateExpireTimegetLogger, getPersistencesRestoreMethod, isPersistedpublic DefaultKeyedXmlFileValueManager(CachingDirectory cachingDirectory, Class<V> xmlClazz, PersistencesRestoreMethod persistencesRestoreMethod) throws IllegalArgumentException, NullPointerException
cachingDirectory - the directory where to store the cached values.xmlClazz - the class name of V.persistencesRestoreMethod - the restore method, when reconstructing the LRUCachingMap.IllegalArgumentException - if cacheDirectory isnt a valid directory or if xmlClazz is not annotated with "@XmlRootElement".NullPointerException - if cachingDirectory, xmlClazz,or persistencesRestoreMethod is null.public V retrieveFileValue(DefaultFileValueWrapper<K,V> valueWrapper)
AbstractKeyedFileValueManagerretrieveFileValue in class AbstractKeyedFileValueManager<K extends Serializable,V extends Keyed<K>>valueWrapper - the value wrapperpublic void storeFileValue(DefaultFileValueWrapper<K,V> valueWrapper, K key, V value) throws RuntimeException
AbstractKeyedFileValueManagerstoreFileValue in class AbstractKeyedFileValueManager<K extends Serializable,V extends Keyed<K>>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 void flush()
AbstractKeyedFileValueManagerflush in interface ValueManager<K extends Serializable,V extends Keyed<K>>flush in class AbstractKeyedFileValueManager<K extends Serializable,V extends Keyed<K>>LRUCachingMap.cleanup(),
ValueManager.restore(LRUCachingMap)Copyright © 2016. All rights reserved.