public class CacheRecordManager extends java.lang.Object implements RecordManager
| Modifier and Type | Field and Description |
|---|---|
protected CachePolicy |
_cache
Cache for underlying RecordManager
|
protected RecordManager |
_recman
Wrapped RecordManager
|
NAME_DIRECTORY_ROOT| Constructor and Description |
|---|
CacheRecordManager(RecordManager recman,
CachePolicy cache)
Construct a CacheRecordManager wrapping another RecordManager and
using a given cache policy.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the record manager.
|
void |
commit()
Commit (make persistent) all changes since beginning of transaction.
|
void |
delete(long recid)
Deletes a record.
|
java.lang.Object |
fetch(long recid)
Fetches a record using standard Java serialization.
|
java.lang.Object |
fetch(long recid,
Serializer serializer)
Fetches a record using a custom serializer.
|
CachePolicy |
getCachePolicy()
Get the underlying cache policy
|
long |
getNamedObject(java.lang.String name)
Obtain the record id of a named object.
|
RecordManager |
getRecordManager()
Get the underlying Record Manager.
|
long |
getRoot(int id)
Returns the indicated root rowid.
|
int |
getRootCount()
Returns the number of slots available for "root" rowids.
|
long |
insert(java.lang.Object obj)
Inserts a new record using a custom serializer.
|
long |
insert(java.lang.Object obj,
Serializer serializer)
Inserts a new record using a custom serializer.
|
void |
rollback()
Rollback (cancel) all changes since beginning of transaction.
|
void |
setNamedObject(java.lang.String name,
long recid)
Set the record id of a named object.
|
void |
setRoot(int id,
long rowid)
Sets the indicated root rowid.
|
void |
update(long recid,
java.lang.Object obj)
Updates a record using standard Java serialization.
|
void |
update(long recid,
java.lang.Object obj,
Serializer serializer)
Updates a record using a custom serializer.
|
protected void |
updateCacheEntries()
Update all dirty cache objects to the underlying RecordManager.
|
protected RecordManager _recman
protected CachePolicy _cache
public CacheRecordManager(RecordManager recman, CachePolicy cache)
recman - Wrapped RecordManagercache - Cache policypublic RecordManager getRecordManager()
public CachePolicy getCachePolicy()
public long insert(java.lang.Object obj)
throws java.io.IOException
insert in interface RecordManagerobj - the object for the new record.java.io.IOException - when one of the underlying I/O operations fails.public long insert(java.lang.Object obj,
Serializer serializer)
throws java.io.IOException
insert in interface RecordManagerobj - the object for the new record.serializer - a custom serializerjava.io.IOException - when one of the underlying I/O operations fails.public void delete(long recid)
throws java.io.IOException
delete in interface RecordManagerrecid - the rowid for the record that should be deleted.java.io.IOException - when one of the underlying I/O operations fails.public void update(long recid,
java.lang.Object obj)
throws java.io.IOException
update in interface RecordManagerrecid - the recid for the record that is to be updated.obj - the new object for the record.java.io.IOException - when one of the underlying I/O operations fails.public void update(long recid,
java.lang.Object obj,
Serializer serializer)
throws java.io.IOException
update in interface RecordManagerrecid - the recid for the record that is to be updated.obj - the new object for the record.serializer - a custom serializerjava.io.IOException - when one of the underlying I/O operations fails.public java.lang.Object fetch(long recid)
throws java.io.IOException
fetch in interface RecordManagerrecid - the recid for the record that must be fetched.java.io.IOException - when one of the underlying I/O operations fails.public java.lang.Object fetch(long recid,
Serializer serializer)
throws java.io.IOException
fetch in interface RecordManagerrecid - the recid for the record that must be fetched.serializer - a custom serializerjava.io.IOException - when one of the underlying I/O operations fails.public void close()
throws java.io.IOException
close in interface RecordManagerjava.io.IOException - when one of the underlying I/O operations fails.public int getRootCount()
getRootCount in interface RecordManagerpublic long getRoot(int id)
throws java.io.IOException
getRoot in interface RecordManagerjava.io.IOExceptiongetRootCount()public void setRoot(int id,
long rowid)
throws java.io.IOException
setRoot in interface RecordManagerjava.io.IOExceptiongetRootCount()public void commit()
throws java.io.IOException
commit in interface RecordManagerjava.io.IOExceptionpublic void rollback()
throws java.io.IOException
rollback in interface RecordManagerjava.io.IOExceptionpublic long getNamedObject(java.lang.String name)
throws java.io.IOException
getNamedObject in interface RecordManagerjava.io.IOExceptionpublic void setNamedObject(java.lang.String name,
long recid)
throws java.io.IOException
setNamedObject in interface RecordManagerjava.io.IOExceptionprotected void updateCacheEntries()
throws java.io.IOException
java.io.IOExceptionCees de Groot (C) 2000-2001. All rights reserved http://jdbm.sourceforge.net