org.archive.wayback.util.bdb
Class BDBRecordSet

java.lang.Object
  extended by org.archive.wayback.util.bdb.BDBRecordSet
Direct Known Subclasses:
BDBIndex

public class BDBRecordSet
extends Object

Version:
$Date: 2010-09-29 05:28:38 +0700 (Wed, 29 Sep 2010) $, $Revision: 3262 $
Author:
brad

Constructor Summary
BDBRecordSet()
           
 
Method Summary
static String bytesToString(byte[] ba)
           
 void delete(String keyStr)
           
 String get(String keyStr)
          retrieve the value assoicated with keyStr from persistant storage
 String getDbName()
           
 String getPath()
           
 void initializeDB(String thePath, String theDbName)
           
 void insertRecords(Iterator<BDBRecord> itr)
           
 void put(String keyStr, String valueStr)
          persistantly store key-value pair
 BDBRecordIterator recordIterator(String startKey)
           
 BDBRecordIterator recordIterator(String startKey, boolean forward)
           
 void setDbName(String dbName)
           
 void setPath(String path)
           
 void shutdownDB()
          shut down the BDB.
static byte[] stringToBytes(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BDBRecordSet

public BDBRecordSet()
Method Detail

initializeDB

public void initializeDB(String thePath,
                         String theDbName)
                  throws IOException
Parameters:
thePath - Directory where BDBJE files are stored
theDbName - Name of files in thePath
Throws:
IOException - for usual reasons, plus as database exceptions

shutdownDB

public void shutdownDB()
                throws com.sleepycat.je.DatabaseException
shut down the BDB.

Throws:
com.sleepycat.je.DatabaseException

stringToBytes

public static byte[] stringToBytes(String s)
Parameters:
s -
Returns:
byte array representation of String s in UTF-8

bytesToString

public static String bytesToString(byte[] ba)
Parameters:
ba -
Returns:
String of UTF-8 encoded bytes ba

recordIterator

public BDBRecordIterator recordIterator(String startKey)
                                 throws com.sleepycat.je.DatabaseException
Parameters:
startKey -
Returns:
iterator for BDBRecords
Throws:
com.sleepycat.je.DatabaseException

recordIterator

public BDBRecordIterator recordIterator(String startKey,
                                        boolean forward)
                                 throws com.sleepycat.je.DatabaseException
Parameters:
startKey -
forward -
Returns:
iterator for BDBRecords
Throws:
com.sleepycat.je.DatabaseException

insertRecords

public void insertRecords(Iterator<BDBRecord> itr)
Parameters:
itr -

put

public void put(String keyStr,
                String valueStr)
         throws com.sleepycat.je.DatabaseException
persistantly store key-value pair

Parameters:
keyStr -
valueStr -
Throws:
com.sleepycat.je.DatabaseException

get

public String get(String keyStr)
           throws com.sleepycat.je.DatabaseException
retrieve the value assoicated with keyStr from persistant storage

Parameters:
keyStr -
Returns:
String value associated with key, or null if no key is found or an error occurs
Throws:
com.sleepycat.je.DatabaseException

delete

public void delete(String keyStr)
            throws com.sleepycat.je.DatabaseException
Parameters:
keyStr -
Throws:
com.sleepycat.je.DatabaseException

getDbName

public String getDbName()
Returns:
Returns the dbName.

getPath

public String getPath()
Returns:
Returns the path.

setPath

public void setPath(String path)
Parameters:
path - the path to set

setDbName

public void setDbName(String dbName)
Parameters:
dbName - the dbName to set


Copyright © 2005-2011 Internet Archive. All Rights Reserved.