org.helidb.impl.txn.log
Class LoggingTransactionalDatabaseBuilder<K,V>

java.lang.Object
  extended by org.helidb.impl.txn.log.LoggingTransactionalDatabaseBuilder<K,V>
Type Parameters:
K - The type of keys in the database.
V - The type of values in the database.

public class LoggingTransactionalDatabaseBuilder<K,V>
extends Object

This is a builder object for building LoggingTransactionalDatabase objects. It can be reused to create several objects with similar configurations.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
helidb-logging_txn

Constructor Summary
LoggingTransactionalDatabaseBuilder()
           
 
Method Summary
<P> LoggingTransactionalDatabase<K,V,P>
create(DatabaseBackend<K,V,P> backend, ReadWritableFile logFile)
          Create the database.
 LoggingTransactionalDatabaseBuilder<K,V> setKeySerializer(Serializer<K> ks)
          Set a key serializer.
 LoggingTransactionalDatabaseBuilder<K,V> setLogAdapter(LogAdapterHolder lah)
          Set a log adapter.
 LoggingTransactionalDatabaseBuilder<K,V> setValueSerializer(Serializer<V> vs)
          Set a value serializer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingTransactionalDatabaseBuilder

public LoggingTransactionalDatabaseBuilder()
Method Detail

setKeySerializer

public LoggingTransactionalDatabaseBuilder<K,V> setKeySerializer(Serializer<K> ks)
Set a key serializer. This property must be set.

Parameters:
ks - The key serializer.
Returns:
this

setValueSerializer

public LoggingTransactionalDatabaseBuilder<K,V> setValueSerializer(Serializer<V> vs)
Set a value serializer. This property must be set.

Parameters:
vs - The value serializer.
Returns:
this.

setLogAdapter

public LoggingTransactionalDatabaseBuilder<K,V> setLogAdapter(LogAdapterHolder lah)
Set a log adapter. The default value for this property is a StdOutLogAdapter.

Parameters:
lah - A log adapter holder.
Returns:
this

create

public <P> LoggingTransactionalDatabase<K,V,P> create(DatabaseBackend<K,V,P> backend,
                                                      ReadWritableFile logFile)
Create the database.

Type Parameters:
P - The type of positions in the database backend.
Parameters:
backend - The database backend.
logFile - The file where the database will write its rollback log.
Returns:
A new LoggingTransactionalDatabase object.