|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.cache.loader.AbstractCacheLoader org.jboss.cache.loader.bdbje.BdbjeCacheLoader
@ThreadSafe public class 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 CacheImpl.
A je.properties file may optionally be placed in the JE environment directory and used to customize the default JE configuration.
Field Summary |
---|
Fields inherited from class org.jboss.cache.loader.AbstractCacheLoader |
---|
cache, regionManager, transactions |
Constructor Summary | |
---|---|
BdbjeCacheLoader()
|
Method Summary | |
---|---|
void |
commit(java.lang.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. |
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<java.lang.String> |
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. |
CacheLoaderConfig.IndividualCacheLoaderConfig |
getConfig()
Gets the configuration. |
void |
prepare(java.lang.Object tx,
java.util.List<Modification> modifications,
boolean onePhase)
Begins a transaction and applies the given modifications. |
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<Modification> 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)
Commits the given transaction, or throws IllegalArgumentException if the given key is not associated with an uncommited transaction. |
void |
setCache(CacheSPI c)
Sets the CacheImpl owner of this cache loader. |
void |
setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
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. |
Methods inherited from class org.jboss.cache.loader.AbstractCacheLoader |
---|
destroy, getMarshaller, getNodeDataList, loadEntireState, loadState, loadStateHelper, put, setRegionManager, storeEntireState, storeState |
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 java.lang.Exception
create
in interface CacheLoader
create
in class AbstractCacheLoader
java.lang.Exception
public void start() throws java.lang.Exception
start
in interface CacheLoader
start
in class AbstractCacheLoader
java.lang.Exception
public void stop()
stop
in interface CacheLoader
stop
in class AbstractCacheLoader
public void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig base)
base
- May be an instance of the CacheLoaderConfig.IndividualCacheLoaderConfig
base
class, in which case the cache loader should use the
CacheLoaderConfig.IndividualCacheLoaderConfig.getProperties()
method to find configuration information. Alternatively,
may be a type-specific subclass of CacheLoaderConfig.IndividualCacheLoaderConfig
,
if there is one.public CacheLoaderConfig.IndividualCacheLoaderConfig getConfig()
CacheLoader
CacheLoaderConfig.IndividualCacheLoaderConfig
object.public void setCache(CacheSPI c)
setCache
in interface CacheLoader
setCache
in class AbstractCacheLoader
c
- The cache on which this loader workspublic java.util.Set<java.lang.String> getChildrenNames(Fqn name) throws java.lang.Exception
name
- The Fqn
of the parent
java.lang.Exception
public java.util.Map get(Fqn name) throws java.lang.Exception
name
- the Fqn
to search for.
public boolean exists(Fqn name) throws java.lang.Exception
java.lang.Exception
public java.lang.Object put(Fqn name, java.lang.Object key, java.lang.Object value) throws java.lang.Exception
java.lang.Exception
public void put(Fqn name, java.util.Map values) throws java.lang.Exception
name
- The fully qualified name of the nodevalues
- A Map of attributes. Can be null
java.lang.Exception
public void put(java.util.List<Modification> modifications) throws java.lang.Exception
put
in interface CacheLoader
put
in class AbstractCacheLoader
modifications
- A Listjava.lang.Exception
public void remove(Fqn name) throws java.lang.Exception
name
- the Fqn
of the node
java.lang.Exception
public java.lang.Object remove(Fqn name, java.lang.Object key) throws java.lang.Exception
java.lang.Exception
public void removeData(Fqn name) throws java.lang.Exception
name
- the Fqn
of the node
java.lang.Exception
public void prepare(java.lang.Object tx, java.util.List<Modification> modifications, boolean onePhase) throws java.lang.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
prepare
in class AbstractCacheLoader
tx
- The transaction, indended to be used by implementations as an identifier of the transaction (and not necessarily a JTA Transaction
object)modifications
- A List
containing Modification
s, for the given transactiononePhase
- 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
commit
in class AbstractCacheLoader
tx
- transaction to commit
java.lang.Exception
public void rollback(java.lang.Object tx)
rollback
in interface CacheLoader
rollback
in class AbstractCacheLoader
tx
- transaction to roll back
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |