Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.io.bdb
Class BerkeleyDBBinaryStore

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.io.AbstractBinaryStore
          extended by com.tangosol.io.bdb.BerkeleyDBBinaryStore

All Implemented Interfaces:
BinaryStore

public class BerkeleyDBBinaryStore
extends AbstractBinaryStore

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

Author:
mf 2005.09.29
See Also:
Berkeley DB JE JavaDoc

Nested Class Summary
protected  class BerkeleyDBBinaryStore.DatabaseHolder
          The DatabaseHolder class is used as a wrapper around a Berkeley DB Database object.

 

Nested classes/interfaces inherited from interface com.tangosol.io.BinaryStore
BinaryStore.SizeAware

 

Field Summary
protected  BerkeleyDBBinaryStore.DatabaseHolder m_db
          The Database handle.
protected  DatabaseFactory m_factory
          Factory used to create this Database.

 

Constructor Summary
BerkeleyDBBinaryStore(java.lang.String sDbName, DatabaseFactory dbFactory)
          Create a new Berkeley DB BinaryStore using the supplied DatabaseFactory.

 

Method Summary
 void close()
          Close the BinaryStore.
 void erase(Binary binKey)
          Remove the specified key from the underlying store if present.
 void eraseAll()
          Remove all data from the underlying store.
 BerkeleyDBBinaryStore.DatabaseHolder getDbHolder()
          Get the DatabaseHolder.
 DatabaseFactory getFactory()
          Get the DatabaseFactory used to create the underlying Database.
protected  void init(java.lang.String sDbName, DatabaseFactory dbFactory)
          Initialize the BinaryStore.
 java.util.Iterator keys()
          Iterate all keys in the underlying store.
 Binary load(Binary binKey)
          Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
 void store(Binary binKey, Binary binValue)
          Store the specified value under the specific key in the underlying store.
 java.lang.String toString()
          Return a human readable description of the BinaryStore.

 

Methods inherited from class com.tangosol.io.AbstractBinaryStore
getDefaultDirectory

 

Field Detail

m_db

protected volatile BerkeleyDBBinaryStore.DatabaseHolder m_db
The Database handle.

m_factory

protected DatabaseFactory m_factory
Factory used to create this Database.

Constructor Detail

BerkeleyDBBinaryStore

public BerkeleyDBBinaryStore(java.lang.String sDbName,
                             DatabaseFactory dbFactory)
                      throws com.sleepycat.je.DatabaseException
Create a new Berkeley DB BinaryStore using the supplied DatabaseFactory.
Parameters:
sDbName - the name of the table to store the cache's data in, null indicates a temporary table name.
dbFactory - the factory to use to create the Database
Throws:
com.sleepycat.je.DatabaseException - if the Database creation failed

Method Detail

init

protected void init(java.lang.String sDbName,
                    DatabaseFactory dbFactory)
             throws com.sleepycat.je.DatabaseException
Initialize the BinaryStore.
Parameters:
sDbName - the name of the table to store the cache's data in, null indicates a temporary table name.
dbFactory - the factory to use to create the Database
Throws:
com.sleepycat.je.DatabaseException - if the Database creation failed

toString

public java.lang.String toString()
Return a human readable description of the BinaryStore.
Returns:
a human readable description of the BinaryStore

load

public Binary load(Binary binKey)
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.
Specified by:
load in interface BinaryStore
Specified by:
load in class AbstractBinaryStore
Parameters:
binKey - key whose associated value is to be returned
Returns:
the value associated with the specified key, or null if no value is available for that key

store

public void store(Binary binKey,
                  Binary binValue)
Store the specified value under the specific key in the underlying store.

This method is supports both key/value creation and value update for a specific key.

Specified by:
store in interface BinaryStore
Overrides:
store in class AbstractBinaryStore
Parameters:
binKey - key to store the value under
binValue - value to be stored

erase

public void erase(Binary binKey)
Remove the specified key from the underlying store if present.
Specified by:
erase in interface BinaryStore
Overrides:
erase in class AbstractBinaryStore
Parameters:
binKey - key whose mapping is to be removed from the map

eraseAll

public void eraseAll()
Remove all data from the underlying store.
Specified by:
eraseAll in interface BinaryStore
Overrides:
eraseAll in class AbstractBinaryStore

keys

public java.util.Iterator keys()
Iterate all keys in the underlying store.
Specified by:
keys in interface BinaryStore
Overrides:
keys in class AbstractBinaryStore
Returns:
a read-only iterator of the keys in the underlying store

close

public void close()
Close the BinaryStore.

getDbHolder

public BerkeleyDBBinaryStore.DatabaseHolder getDbHolder()
Get the DatabaseHolder. To prevent the underlying Database from being deleted during usage, hold onto this handle while using the Database object.
Returns:
the DatabaseHolder

getFactory

public DatabaseFactory getFactory()
Get the DatabaseFactory used to create the underlying Database.
Returns:
the DatabaseFactory

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.