org.archive.wayback.util.bdb
Class BDBMap

java.lang.Object
  extended by org.archive.wayback.util.bdb.BDBMap

public class BDBMap
extends Object

Generic class for simple key-value pair lookup using BDBJE.

Version:
$Date: 2010-09-29 05:28:38 +0700 (Wed, 29 Sep 2010) $, $Revision: 3262 $
Author:
oskar.grenholm@kb.se

Field Summary
protected  com.sleepycat.je.Database db
           
protected  String dir
           
protected  com.sleepycat.je.Environment env
           
protected  String name
           
 
Constructor Summary
BDBMap(String name, String dir)
          consturctor
 
Method Summary
static void addTimestampForId(String context, String ip, String time)
          associate timestamp time with idenfier ip persistantly
 String get(String keyStr)
          retrieve the value assoicated with keyStr from persistant storage
static BDBMap getContextMap(String context)
           
static String getTimestampForId(String context, String ip)
          return the timestamp associated with the identifier argument, or now if no value is associated or something goes wrong.
protected  void init()
           
 void put(String keyStr, String valueStr)
          persistantly store key-value pair
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

protected com.sleepycat.je.Environment env

db

protected com.sleepycat.je.Database db

name

protected String name

dir

protected String dir
Constructor Detail

BDBMap

public BDBMap(String name,
              String dir)
consturctor

Parameters:
name - of database
dir - path of directory where dbd files should be stored. The directory is created if it does not exist.
Method Detail

init

protected void init()

put

public void put(String keyStr,
                String valueStr)
persistantly store key-value pair

Parameters:
keyStr -
valueStr -

get

public String get(String keyStr)
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

getContextMap

public static BDBMap getContextMap(String context)
Parameters:
context -
Returns:
singleton BDBMap for the context

getTimestampForId

public static String getTimestampForId(String context,
                                       String ip)
return the timestamp associated with the identifier argument, or now if no value is associated or something goes wrong.

Parameters:
context -
ip -
Returns:
timestamp string value

addTimestampForId

public static void addTimestampForId(String context,
                                     String ip,
                                     String time)
associate timestamp time with idenfier ip persistantly

Parameters:
context -
ip -
time -


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