jdbm.helper
Class RecordManagerImpl

java.lang.Object
  extended by jdbm.helper.RecordManagerImpl
All Implemented Interfaces:
RecordManager
Direct Known Subclasses:
BaseRecordManager, CacheRecordManager

public abstract class RecordManagerImpl
extends java.lang.Object
implements RecordManager

Abstract class for record manager which implements most of stuff

Author:
Jan Kotek

Field Summary
 
Fields inherited from interface jdbm.RecordManager
NULL_RECID
 
Constructor Summary
RecordManagerImpl()
           
 
Method Summary
 java.lang.Object fetch(long recid)
          Fetches a record using standard java object serialization.
<K,V> PrimaryHashMap<K,V>
hashMap(java.lang.String name)
          Creates or load existing Primary Hash Map which persists data into DB.
<K,V> PrimaryHashMap<K,V>
hashMap(java.lang.String name, Serializer<K> keySerializer)
          Creates or load existing Primary Hash Map which persists data into DB.
<K,V> PrimaryHashMap<K,V>
hashMap(java.lang.String name, Serializer<K> keySerializer, Serializer<V> valueSerializer)
          Creates or load existing Primary Hash Map which persists data into DB.
 long insert(java.lang.Object obj)
          Inserts a new record using standard java object serialization.
<V> PrimaryStoreMap<java.lang.Long,V>
storeMap(java.lang.String name)
          Creates or load existing Primary StoreMap which persists data into DB.
<V> PrimaryStoreMap<java.lang.Long,V>
storeMap(java.lang.String name, Serializer<V> valueSerializer)
          Creates or load existing StoreMap which persists data into DB.
<K extends java.lang.Comparable,V>
PrimaryTreeMap<K,V>
treeMap(java.lang.String name)
          Creates or load existing Primary TreeMap which persists data into DB.
<K,V> PrimaryTreeMap<K,V>
treeMap(java.lang.String name, java.util.Comparator<K> keyComparator)
          Creates or load existing TreeMap which persists data into DB.
<K,V> PrimaryTreeMap<K,V>
treeMap(java.lang.String name, java.util.Comparator<K> keyComparator, Serializer<V> valueSerializer)
          Creates or load existing TreeMap which persists data into DB.
<K,V> PrimaryTreeMap<K,V>
treeMap(java.lang.String name, java.util.Comparator<K> keyComparator, Serializer<V> valueSerializer, Serializer<K> keySerializer)
          Creates or load existing TreeMap which persists data into DB.
<K extends java.lang.Comparable,V>
PrimaryTreeMap<K,V>
treeMap(java.lang.String name, Serializer<V> valueSerializer)
          Creates or load existing TreeMap which persists data into DB.
<K extends java.lang.Comparable,V>
PrimaryTreeMap<K,V>
treeMap(java.lang.String name, Serializer<V> valueSerializer, Serializer<K> keySerializer)
          Creates or load existing TreeMap which persists data into DB.
 void update(long recid, java.lang.Object obj)
          Updates a record using standard java object serialization.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jdbm.RecordManager
clearCache, close, commit, defrag, delete, fetch, fetch, getNamedObject, insert, rollback, setNamedObject, update
 

Constructor Detail

RecordManagerImpl

public RecordManagerImpl()
Method Detail

hashMap

public <K,V> PrimaryHashMap<K,V> hashMap(java.lang.String name)
Description copied from interface: RecordManager
Creates or load existing Primary Hash Map which persists data into DB.

Specified by:
hashMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
Returns:

hashMap

public <K,V> PrimaryHashMap<K,V> hashMap(java.lang.String name,
                                         Serializer<K> keySerializer)
Description copied from interface: RecordManager
Creates or load existing Primary Hash Map which persists data into DB. This method uses custom serializer for keys.

Specified by:
hashMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
keySerializer - serializer to be used for Keys
Returns:

hashMap

public <K,V> PrimaryHashMap<K,V> hashMap(java.lang.String name,
                                         Serializer<K> keySerializer,
                                         Serializer<V> valueSerializer)
Description copied from interface: RecordManager
Creates or load existing Primary Hash Map which persists data into DB. Map will use custom serializers for Keys and Values. Leave keySerializer null to use default serializer for keys

Specified by:
hashMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
keySerializer - serializer to be used for Keys, leave null to use default serializer
valueSerializer - serializer to be used for Values
Returns:

treeMap

public <K extends java.lang.Comparable,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name)
Description copied from interface: RecordManager
Creates or load existing Primary TreeMap which persists data into DB.

Specified by:
treeMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
Returns:

treeMap

public <K extends java.lang.Comparable,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name,
                                                                      Serializer<V> valueSerializer)
Description copied from interface: RecordManager
Creates or load existing TreeMap which persists data into DB.

Specified by:
treeMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
valueSerializer - Serializer used for values. This may reduce disk space usage.
Returns:

treeMap

public <K extends java.lang.Comparable,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name,
                                                                      Serializer<V> valueSerializer,
                                                                      Serializer<K> keySerializer)
Description copied from interface: RecordManager
Creates or load existing TreeMap which persists data into DB.

Specified by:
treeMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
valueSerializer - Serializer used for values. This may reduce disk space usage.
keySerializer - Serializer used for keys. This may reduce disk space usage.
Returns:

treeMap

public <K,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name,
                                         java.util.Comparator<K> keyComparator)
Description copied from interface: RecordManager
Creates or load existing TreeMap which persists data into DB.

Specified by:
treeMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
keyComparator - Comparator used to sort keys
Returns:

treeMap

public <K,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name,
                                         java.util.Comparator<K> keyComparator,
                                         Serializer<V> valueSerializer)
Description copied from interface: RecordManager
Creates or load existing TreeMap which persists data into DB.

Specified by:
treeMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
keyComparator - Comparator used to sort keys
valueSerializer - Serializer used for values. This may reduce disk space usage
Returns:

treeMap

public <K,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name,
                                         java.util.Comparator<K> keyComparator,
                                         Serializer<V> valueSerializer,
                                         Serializer<K> keySerializer)
Description copied from interface: RecordManager
Creates or load existing TreeMap which persists data into DB.

Specified by:
treeMap in interface RecordManager
Type Parameters:
K - Key type
V - Value type
Parameters:
name - record name
keyComparator - Comparator used to sort keys
valueSerializer - Serializer used for values. This may reduce disk space usage
keySerializer - Serializer used for keys. This may reduce disk space usage *
Returns:

storeMap

public <V> PrimaryStoreMap<java.lang.Long,V> storeMap(java.lang.String name,
                                                      Serializer<V> valueSerializer)
Description copied from interface: RecordManager
Creates or load existing StoreMap which persists data into DB.

Specified by:
storeMap in interface RecordManager
Type Parameters:
V - Value type
Parameters:
name - record name
valueSerializer - Serializer used for values. This may reduce disk space usage
Returns:
map

storeMap

public <V> PrimaryStoreMap<java.lang.Long,V> storeMap(java.lang.String name)
Description copied from interface: RecordManager
Creates or load existing Primary StoreMap which persists data into DB.

Specified by:
storeMap in interface RecordManager
Type Parameters:
V - Value type
Parameters:
name - record name
Returns:
map

update

public void update(long recid,
                   java.lang.Object obj)
            throws java.io.IOException
Description copied from interface: RecordManager
Updates a record using standard java object serialization.

Specified by:
update in interface RecordManager
Parameters:
recid - the recid for the record that is to be updated.
obj - the new object for the record.
Throws:
java.io.IOException - when one of the underlying I/O operations fails or given recid does not exists.

fetch

public java.lang.Object fetch(long recid)
                       throws java.io.IOException
Description copied from interface: RecordManager
Fetches a record using standard java object serialization. If given recid does not exist, IOException will be thrown before/during commit (cache).

Specified by:
fetch in interface RecordManager
Parameters:
recid - the recid for the record that must be fetched.
Returns:
the object contained in the record, null if given recid does not exist
Throws:
java.io.IOException - when one of the underlying I/O operations fails.

insert

public long insert(java.lang.Object obj)
            throws java.io.IOException
Description copied from interface: RecordManager
Inserts a new record using standard java object serialization.

Specified by:
insert in interface RecordManager
Parameters:
obj - the object for the new record.
Returns:
the rowid for the new record.
Throws:
java.io.IOException - when one of the underlying I/O operations fails.


Cees de Groot (C) 2000. All rights reserved http://jdbm.sourceforge.net