|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.cache.loader.jdbm.JdbmCacheLoader
public class JdbmCacheLoader
A persistent CacheLoader
based on the JDBM project.
See http://jdbm.sourceforge.net/ .
Does not support transaction isolation.
The configuration string format is:
environmentDirectoryName[#databaseName]
where databaseName, if omitted, defaults to the ClusterName property of the TreeCache.
Data is sorted out like:/ = N /node1 = N /node1/K/k1 = v1 /node1/K/k2 = v2 /node2 = N /node2/node3 = N /node2/node3/K/k1 = v1 /node2/node3/K/k2 = v2 /node2/node4 = NN represents a node, K represents a key block. k and v represent key/value pairs. TODO the browse operations lock the entire tree; eventually the JDBM team plans to fix this.
Constructor Summary | |
---|---|
JdbmCacheLoader()
|
Method Summary | |
---|---|
void |
commit(java.lang.Object tx)
Commits a transaction. |
void |
create()
|
void |
destroy()
|
void |
dump()
Dumps the tree to debug. |
void |
dump(java.lang.Object key)
Dumps the tree past the key to debug. |
boolean |
exists(Fqn name)
Returns whether the given node exists. |
java.util.Map |
get(Fqn name)
Returns a map containing all key-value pairs for the given FQN, or null if the node is not present. |
java.util.Set |
getChildrenNames(Fqn name)
Returns an unmodifiable set of relative children names, or returns null if the parent node is not found or if no children are found. |
byte[] |
loadEntireState()
Fetches the entire state for this cache from secondary storage (disk, DB) and returns it as a byte buffer. |
byte[] |
loadState(Fqn subtree)
Export the contents of the databases as a byte array. |
void |
prepare(java.lang.Object tx,
java.util.List modifications,
boolean onePhase)
Applies and commits the given modifications in one transaction. |
void |
put(Fqn name,
java.util.Map values)
Stores a map of key-values for a given FQN, but does not delete existing key-value pairs (that is, it does not erase). |
java.lang.Object |
put(Fqn name,
java.lang.Object key,
java.lang.Object value)
Stores a single FQN-key-value record. |
void |
put(java.util.List modifications)
Applies the given modifications. |
void |
remove(Fqn name)
Deletes the node for a given FQN and all its descendent nodes. |
java.lang.Object |
remove(Fqn name,
java.lang.Object key)
Deletes a single FQN-key-value record. |
void |
removeData(Fqn name)
Clears the map for the given node, but does not remove the node. |
void |
rollback(java.lang.Object tx)
Removes transaction in progress. |
void |
setCache(TreeCache c)
Sets the TreeCache owner of this cache loader. |
void |
setConfig(java.util.Properties props)
Sets the configuration string for this cache loader. |
void |
setRegionManager(RegionManager manager)
Sets the RegionManager this object should use to manage
marshalling/unmarshalling of different regions using different
classloaders. |
void |
start()
Opens the environment and the database specified by the configuration string. |
void |
stop()
Closes the databases and environment, and nulls references to them. |
void |
storeEntireState(byte[] state)
Replace the contents of the databases with the given exported data. |
void |
storeState(byte[] state,
Fqn subtree)
Replace the contents of the databases with the given exported data. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JdbmCacheLoader()
Method Detail |
---|
public void create() throws java.lang.Exception
create
in interface org.jboss.system.Service
java.lang.Exception
public void destroy()
destroy
in interface org.jboss.system.Service
public void start() throws java.lang.Exception
start
in interface org.jboss.system.Service
java.lang.Exception
public void stop()
stop
in interface org.jboss.system.Service
public void setConfig(java.util.Properties props)
setConfig
in interface CacheLoader
props
- a collection of configuration propertiespublic void setCache(TreeCache c)
setCache
in interface CacheLoader
c
- The cache on which this loader workspublic java.util.Set getChildrenNames(Fqn name) throws java.lang.Exception
getChildrenNames
in interface CacheLoader
name
- The FQN of the parent
java.lang.Exception
public java.util.Map get(Fqn name) throws java.lang.Exception
get
in interface CacheLoader
public boolean exists(Fqn name) throws java.io.IOException
exists
in interface CacheLoader
java.io.IOException
public java.lang.Object put(Fqn name, java.lang.Object key, java.lang.Object value) throws java.lang.Exception
put
in interface CacheLoader
java.lang.Exception
public void put(Fqn name, java.util.Map values) throws java.lang.Exception
put
in interface CacheLoader
name
- The fully qualified name of the nodevalues
- A Map of attributes. Can be null
java.lang.Exception
public void put(java.util.List modifications) throws java.lang.Exception
put
in interface CacheLoader
modifications
- A Listjava.lang.Exception
public void remove(Fqn name) throws java.lang.Exception
remove
in interface CacheLoader
java.lang.Exception
public java.lang.Object remove(Fqn name, java.lang.Object key) throws java.lang.Exception
remove
in interface CacheLoader
java.lang.Exception
public void removeData(Fqn name) throws java.lang.Exception
removeData
in interface CacheLoader
java.lang.Exception
public void prepare(java.lang.Object tx, java.util.List modifications, boolean onePhase) throws java.lang.Exception
prepare
in interface CacheLoader
tx
- The transaction, just used as a hashmap keymodifications
- ListonePhase
- Persist immediately and (for example) commit the local JDBC transaction as well. When true,
we won't get a CacheLoader.commit(Object)
or CacheLoader.rollback(Object)
method call later
java.lang.Exception
public void commit(java.lang.Object tx) throws java.lang.Exception
commit
in interface CacheLoader
tx
- transaction to commit
java.lang.Exception
public void rollback(java.lang.Object tx)
rollback
in interface CacheLoader
tx
- transaction to roll backpublic byte[] loadEntireState() throws java.lang.Exception
CacheLoader
CacheLoader.storeEntireState(byte[])
.
loadEntireState
in interface CacheLoader
java.lang.Exception
public byte[] loadState(Fqn subtree) throws java.lang.Exception
loadState
in interface ExtendedCacheLoader
subtree
- Fqn naming the root (i.e. highest level parent) node of
the subtree for which state is requested.
java.lang.Exception
TreeCache.activateRegion(String)
public void storeEntireState(byte[] state) throws java.lang.Exception
storeEntireState
in interface CacheLoader
java.lang.Exception
public void storeState(byte[] state, Fqn subtree) throws java.lang.Exception
storeState
in interface ExtendedCacheLoader
state
- the state to storesubtree
- Fqn naming the root (i.e. highest level parent) node of
the subtree included in state
. If the Fqns
of the data included in state
are not
already children of subtree
, then their
Fqns should be altered to make them children of
subtree
before they are persisted.
java.lang.Exception
public void dump() throws java.io.IOException
java.io.IOException
public void dump(java.lang.Object key) throws java.io.IOException
java.io.IOException
public void setRegionManager(RegionManager manager)
ExtendedCacheLoader
RegionManager
this object should use to manage
marshalling/unmarshalling of different regions using different
classloaders.
NOTE: This method is only intended to be used
by the TreeCache
instance this cache loader is
associated with.
setRegionManager
in interface ExtendedCacheLoader
manager
- the region manager to use, or null
.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |