@ThreadSafe public class FileCacheLoader extends AbstractCacheLoader
CacheLoader, this implementation uses a StripedLock| Modifier and Type | Field and Description |
|---|---|
static String |
DATA
CacheImpl data file.
|
static String |
DIR_SUFFIX
CacheImpl directory suffix.
|
static Pattern |
FQN_PATTERN
For fqn, check '*' '<' '>' '|' '"' '?' and also '\' '/' and ':'
|
protected StripedLock |
lock |
static Pattern |
PATH_PATTERN
For full path, check '*' '<' '>' '|' '"' '?' Regex: [\*<>|"?]
|
buddyFqnTransformer, cache, regionManager, transactions| Constructor and Description |
|---|
FileCacheLoader() |
| Modifier and Type | Method and Description |
|---|---|
void |
create() |
protected void |
doMarshall(Fqn fqn,
Object toMarshall) |
protected Object |
doUnmarshall(Fqn fqn,
Object fromFile) |
boolean |
exists(Fqn fqn)
Returns true if the CacheLoader has a node with a
Fqn. |
Map |
get(Fqn fqn)
Returns all keys and values from the persistent store, given a
Fqn |
Set<String> |
getChildrenNames(Fqn fqn)
Returns a set of children node names.
|
CacheLoaderConfig.IndividualCacheLoaderConfig |
getConfig()
Gets the configuration.
|
protected boolean |
isCharacterPortableLocation(String fileAbsolutePath) |
protected boolean |
isCharacterPortableTree(Fqn fqn) |
protected boolean |
isLengthPortablePath(String absoluteFqnPath) |
protected Map |
loadAttributes(Fqn fqn) |
void |
put(Fqn fqn,
Map attributes)
Puts all entries of the map into the existing map of the given node,
overwriting existing keys, but not clearing the existing map before
insertion.
|
void |
put(Fqn fqn,
Map attributes,
boolean erase) |
Object |
put(Fqn fqn,
Object key,
Object value)
Puts a key and value into the attribute map of a given node.
|
void |
remove(Fqn fqn)
Removes the given node and all its subnodes, does nothing if the node does not exist.
|
Object |
remove(Fqn fqn,
Object key)
Removes the given key and value from the attributes of the given node.
|
void |
removeData(Fqn fqn)
Removes all attributes from a given node, but doesn't delete the node
itself or any subnodes.
|
void |
setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
Sets the configuration.
|
protected void |
storeAttributes(Fqn fqn,
Map attrs) |
commit, destroy, getMarshaller, getNodeDataList, loadEntireState, loadState, loadStateHelper, move, prepare, put, regionAwareMarshall, regionAwareUnmarshall, rollback, setCache, setRegionManager, start, stop, storeEntireState, storeState, storeStateHelperprotected final StripedLock lock
public static final String DATA
public static final String DIR_SUFFIX
public static final Pattern PATH_PATTERN
public static final Pattern FQN_PATTERN
public void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
CacheLoaderLifecycle.create() and Lifecycle.start().base - May be an instance of the CacheLoaderConfig.IndividualCacheLoaderConfig base
class, in which case the cache loader should use the
PluggableConfigurationComponent.getProperties()
method to find configuration information. Alternatively,
may be a type-specific subclass of CacheLoaderConfig.IndividualCacheLoaderConfig,
if there is one.public CacheLoaderConfig.IndividualCacheLoaderConfig getConfig()
CacheLoaderCacheLoaderConfig.IndividualCacheLoaderConfig object.public void create()
throws Exception
create in interface Lifecyclecreate in class AbstractCacheLoaderExceptionpublic Set<String> getChildrenNames(Fqn fqn) throws Exception
CacheLoaderFqn.
Returns null if the named node is not found or there are no children.
The returned set must not be modifiable. Implementors can use
Collections.unmodifiableSet(java.util.Set) to make the set unmodifiable.
Implementors may impose restrictions on the contents of an Fqn (such as Strings-only) and as such, indirectly
impose the same restriction on the contents of a Set returned by getChildrenNames().
public Map get(Fqn fqn) throws Exception
CacheLoaderFqnpublic boolean exists(Fqn fqn) throws Exception
CacheLoaderFqn.Exceptionpublic Object put(Fqn fqn, Object key, Object value) throws Exception
CacheLoaderExceptionpublic void put(Fqn fqn, Map attributes) throws Exception
CacheLoaderMap.putAll(java.util.Map<? extends K, ? extends V>).
If the node does not exist, all parent nodes from the root down are created automatically
Note since 3.0, as an optimization, this method will require a definitive attribute map and
not just a subset. This will allow cache loader implementations to overwrite rather than merge, if that is
deemed more efficient. This will not break backward compatibility since performing a merge will not cause
any loss of data even though it is an unnecessary step.fqn - The fully qualified name of the nodeattributes - A Map of attributes. Can be nullExceptionpublic void put(Fqn fqn, Map attributes, boolean erase) throws Exception
put in class AbstractCacheLoaderExceptionpublic Object remove(Fqn fqn, Object key) throws Exception
CacheLoaderExceptionpublic void remove(Fqn fqn) throws Exception
CacheLoaderpublic void removeData(Fqn fqn) throws Exception
CacheLoaderprotected void storeAttributes(Fqn fqn, Map attrs) throws Exception
Exceptionprotected void doMarshall(Fqn fqn, Object toMarshall) throws Exception
doMarshall in class AbstractCacheLoaderExceptionprotected Object doUnmarshall(Fqn fqn, Object fromFile) throws Exception
doUnmarshall in class AbstractCacheLoaderExceptionprotected boolean isCharacterPortableLocation(String fileAbsolutePath)
protected boolean isCharacterPortableTree(Fqn fqn)
protected boolean isLengthPortablePath(String absoluteFqnPath)
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.