|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.cache.loader.bdbje.BdbjeCacheLoader
A persistent CacheLoader
based on Berkeley DB Java Edition.
The configuration string format is:
environmentDirectoryName[#databaseName]
where databaseName, if omitted, defaults to the ClusterName property of the TreeCache.
A je.properties file may optionally be placed in the JE environment directory and used to customize the default JE configuration.
Constructor Summary | |
BdbjeCacheLoader()
|
Method Summary | |
void |
commit(Object tx)
Commits the given transaction, or throws IllegalArgumentException if the given key is not associated with an uncommited transaction. |
void |
create()
Does nothing since start() does all the work. |
void |
destroy()
Does nothing since stop() does all the work. |
boolean |
exists(Fqn name)
Returns whether the given node exists. |
Map |
get(Fqn name)
Returns a map containing all key-value pairs for the given FQN, or null if the node is not present. |
Object |
get(Fqn name,
Object key)
Returns the data object stored under the given FQN and key, or null if the FQN and key are not present. |
Set |
getChildrenNames(Fqn name)
Returns an unmodifiable set of relative children names (strings), or returns null if the parent node is not found or if no children are found. |
byte[] |
loadEntireState()
Export the contents of the databases as a byte array. |
void |
prepare(Object tx,
List modifications,
boolean onePhase)
Begins a transaction and applies the given modifications. |
void |
put(Fqn name,
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). |
Object |
put(Fqn name,
Object key,
Object value)
Stores a single FQN-key-value record. |
void |
put(List modifications)
Applies the given modifications. |
void |
remove(Fqn name)
Deletes the node for a given FQN and all its descendent nodes. |
Object |
remove(Fqn name,
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(Object tx)
Commits the given transaction, or throws IllegalArgumentException if the given key is not associated with an uncommited transaction. |
void |
setCache(TreeCache c)
Sets the TreeCache owner of this cache loader. |
void |
setConfig(Properties props)
Sets the configuration string for this cache loader. |
void |
start()
Opens the JE environment and the database specified by the configuration string. |
void |
stop()
Closes the JE databases and environment, and nulls references to them. |
void |
storeEntireState(byte[] state)
Replace the contents of the databases with the given exported data. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BdbjeCacheLoader()
Method Detail |
public void create() throws Exception
create
in interface org.jboss.system.Service
Exception
public void destroy()
destroy
in interface org.jboss.system.Service
public void start() throws Exception
start
in interface org.jboss.system.Service
Exception
public void stop()
stop
in interface org.jboss.system.Service
public void setConfig(Properties props)
setConfig
in interface CacheLoader
props
- A list of properties, defined in the XML filepublic void setCache(TreeCache c)
setCache
in interface CacheLoader
c
- The cache on which this loader workspublic Set getChildrenNames(Fqn name) throws Exception
getChildrenNames
in interface CacheLoader
name
- The FQN of the parent
Exception
public Map get(Fqn name) throws Exception
get
in interface CacheLoader
name
-
public Object get(Fqn name, Object key) throws Exception
get
in interface CacheLoader
name
-
Exception
public boolean exists(Fqn name) throws Exception
exists
in interface CacheLoader
name
-
Exception
public Object put(Fqn name, Object key, Object value) throws Exception
put
in interface CacheLoader
Exception
public void put(Fqn name, Map values) throws Exception
put
in interface CacheLoader
name
- The fully qualified name of the nodevalues
- A Map of attributes. Can be null
Exception
public void put(List modifications) throws Exception
put
in interface CacheLoader
modifications
- A ListException
public void remove(Fqn name) throws Exception
remove
in interface CacheLoader
Exception
public Object remove(Fqn name, Object key) throws Exception
remove
in interface CacheLoader
Exception
public void removeData(Fqn name) throws Exception
removeData
in interface CacheLoader
name
-
Exception
public void prepare(Object tx, List modifications, boolean onePhase) throws Exception
If onePhase is true, commits the transaction; otherwise, associates the txn value with the transaction and expects commit() or rollback() to be called later with the same tx value. Performs retries if necessary to resolve deadlocks.
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
Exception
public void commit(Object tx) throws Exception
commit
in interface CacheLoader
tx
-
Exception
public void rollback(Object tx)
rollback
in interface CacheLoader
tx
- public byte[] loadEntireState() throws Exception
loadEntireState
in interface CacheLoader
Exception
public void storeEntireState(byte[] state) throws Exception
storeEntireState
in interface CacheLoader
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |