CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.io.bdb
Class BerkeleyDBBinaryStoreManager

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.io.bdb.BerkeleyDBBinaryStoreManager
All Implemented Interfaces:
BinaryStoreManager, XmlConfigurable

public class BerkeleyDBBinaryStoreManager
extends Base
implements BinaryStoreManager, XmlConfigurable

An implementation of the BinaryStoreManager interface using Sleepycat Berkeley DB Java Edition.

The usage pattern for BinaryStoreManagers is simply to instantiate them, use them to allocate a single BinaryStore instance, and forget about them. This implementation maintains knowledge of previously created Berkeley DB Environments via a static DatabaseFactoryManager, thus ensuring a minimum number of Environemnts are created, regardless of the life-cycle of the BinaryStoreManager.

Author:
mf 2005.09.29
See Also:
Berkeley DB JE JavaDoc

Field Summary
protected  File m_dirParent
          Parent directory for creating Environments.
protected  boolean m_fTemporary
          Flag indicating if this store manages temporary data.
protected  String m_sDbName
          Database name, used for persistent stores.
protected  XmlElement m_xmlConfig
          Stored configuration for this Manager.
 
Constructor Summary
BerkeleyDBBinaryStoreManager()
          Default constructor.
BerkeleyDBBinaryStoreManager(File dirParent, String sDbName)
          Construct a Berkeley DB BinaryStoreManager for the specified directory.
 
Method Summary
 BinaryStore createBinaryStore()
          Return a new BinaryStore.
 void destroyBinaryStore(BinaryStore store)
          Destroy a BinaryStore previously created by this manager.
 boolean equals(Object that)
          Compares two BerkeleyDBBinaryStoreManagers for equality.
 XmlElement getConfig()
          Retrieve the manager's configuration.
static DatabaseFactoryManager getFactoryManager()
          Get the DatabaseFactoryManager.
 File getParentDirectory()
          Get the configured parent directory.
 int hashCode()
          Computes the hash code of the BerkeleyDBBinaryStoreManager.
 boolean isTemporary()
          Return true if this is a manager for temporary stores.
 void setConfig(XmlElement xmlConfig)
          Specify the manager's configuration.
 String toString()
          Return a human readable description of the BinaryStoreManager.
 

Field Detail

m_xmlConfig

protected XmlElement m_xmlConfig
Stored configuration for this Manager.


m_dirParent

protected File m_dirParent
Parent directory for creating Environments.


m_sDbName

protected String m_sDbName
Database name, used for persistent stores.


m_fTemporary

protected boolean m_fTemporary
Flag indicating if this store manages temporary data.

Constructor Detail

BerkeleyDBBinaryStoreManager

public BerkeleyDBBinaryStoreManager()
Default constructor.

The temporary Environment directory will be placed under $tmp/coherence/bdb, where $tmp is the system defiend temp directory.

Configuration is performed via XmlConfigurable interface.

See Also:
setConfig(com.tangosol.run.xml.XmlElement)

BerkeleyDBBinaryStoreManager

public BerkeleyDBBinaryStoreManager(File dirParent,
                                    String sDbName)
Construct a Berkeley DB BinaryStoreManager for the specified directory.

A temporary directory will be created beneth the specified parent directory, for use by the Berkeley Environment.

Additional configuration is performed via XmlConfigurable interface.

Parameters:
dirParent - the parent directory for the Environment
sDbName - the name of the database to store the cache's data within. This value is only specified when using a persistent store.
See Also:
setConfig(com.tangosol.run.xml.XmlElement)
Method Detail

toString

public String toString()
Return a human readable description of the BinaryStoreManager.

Returns:
human readable description of the BinaryStoreManager

equals

public boolean equals(Object that)
Compares two BerkeleyDBBinaryStoreManagers for equality.

Two instances are considered to be equal if their underlying configuration is identical, or if they have reference equality.

Parameters:
that - the object to compare equality against
Returns:
true if they are equal, false otherwise

hashCode

public int hashCode()
Computes the hash code of the BerkeleyDBBinaryStoreManager.

The hash code is computed as the sum of the hash codes of the Objects making up the BerkeleyDBBinaryStoreManager's configuration.

Returns:
the hash code

createBinaryStore

public BinaryStore createBinaryStore()
Return a new BinaryStore.

Specified by:
createBinaryStore in interface BinaryStoreManager
Returns:
a new BinaryStore object

destroyBinaryStore

public void destroyBinaryStore(BinaryStore store)
Destroy a BinaryStore previously created by this manager.

Specified by:
destroyBinaryStore in interface BinaryStoreManager
Parameters:
store - a BinaryStore object previously created by this manager

getConfig

public XmlElement getConfig()
Retrieve the manager's configuration.

Specified by:
getConfig in interface XmlConfigurable
Returns:
XmlElement containing the configuration

setConfig

public void setConfig(XmlElement xmlConfig)
Specify the manager's configuration.

Any configuration setting prefixed with je. will be passed through to Berkeley DB Configuration.

Specified by:
setConfig in interface XmlConfigurable
Parameters:
xmlConfig - the new configuration
See Also:
Berkeley DB Configuration

getFactoryManager

public static DatabaseFactoryManager getFactoryManager()
Get the DatabaseFactoryManager.

This manager is used to find pre-existing DatabaseFactory objects.

Returns:
the DatabaseFactoryManager

getParentDirectory

public File getParentDirectory()
Get the configured parent directory.

This is the directory in which Berkeley DB Environment sub-directories will be created.

Returns:
the parent directory

isTemporary

public boolean isTemporary()
Return true if this is a manager for temporary stores.

Returns:
true if this is a manager for temporary stores

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation