|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.core.database.recman.PageManagedDatabase
public class PageManagedDatabase
This is a wrapper for PageManager supplied by Cees de Groot. This will be used to support Serailized data storage in a page-based file.
Database
Constructor Summary | |
---|---|
PageManagedDatabase(java.lang.String name)
The constructor for a paged managed database takes a string to identify the name of the database. |
Method Summary | |
---|---|
long |
allocateObject(int size)
This method will pre-allocate an obect of a particular size. |
void |
bind(java.lang.String name,
PersistentCapableIfc object)
Bind the specified name to an object. |
void |
close()
Close this database. |
void |
delete(PersistentCapableIfc object)
Delete the specified object form the database. |
void |
deleteObject(long id)
Delete the object with the specified id from the database. |
protected int |
getFirstFreeRootSlot()
Return the next available root slot. |
protected org.exolab.core.database.recman.PMDRootTable |
getNamedRootTable()
Return the named root table. |
java.util.Enumeration |
getRootNames()
Return an enumeration of all the database root names. |
java.lang.Object |
getRootObject(java.lang.String name)
Lookup the object specified by name. |
void |
insert(PersistentCapableIfc object)
Insert the specified object into the database. |
long |
insertBoolean(boolean value)
Insert the boolean entity into the database and return the id of the stored record. |
long |
insertByte(byte value)
Insert the byte entity into the database and return the id of the stored record. |
long |
insertBytes(byte[] value)
Insert the String entity into the database and return the id of the stored record. |
long |
insertChar(char value)
Insert the char entity into the database and return the id of the stored record. |
long |
insertDouble(double value)
Insert the double entity into the database and return the id of the stored record. |
long |
insertFloat(float value)
Insert the float entity into the database and return the id of the stored record. |
long |
insertInt(int value)
Insert the int entity into the database and return the id of the stored record. |
long |
insertLong(long value)
Insert the long entity into the database and return the id of the stored record. |
long |
insertObject(java.lang.Object value)
Insert the object entity into the database and return the id of the stored record. |
long |
insertShort(short value)
Insert the short entity into the database and return the id of the stored record. |
long |
insertString(java.lang.String value)
Insert the String entity into the database and return the id of the stored record. |
boolean |
isBound(java.lang.String name)
Check if the specified object is already bound in the database |
boolean |
isOpen()
Test if the database is open |
PersistentCapableIfc |
lookup(java.lang.String name)
Lookup the object specified by name. |
void |
open()
Opens the specified database. |
boolean |
readBoolean(long id)
read the boolean from the database given the specified record id. |
byte |
readByte(long id)
Read the byte from the database given the specified record id. |
byte[] |
readBytes(long id)
Read the byte[] from the database given the specified record id. |
char |
readChar(long id)
Read the char from the database given the specified record id. |
double |
readDouble(long id)
Read the double from the database given the specified record id. |
float |
readFloat(long id)
Read the float from the database given the specified record id. |
int |
readInt(long id)
Read the int from the database given the specified record id. |
long |
readLong(long id)
Read the long from the database given the specified record id. |
java.lang.Object |
readObject(long id)
Read the object from the database given the specified record id. |
short |
readShort(long id)
Read the short from the database given the specified record id. |
java.lang.String |
readString(long id)
Read the string from the database given the specified record id. |
void |
removeRootObject(java.lang.String name)
Remove the binding between the specified name and the object.If the nroot name does not exist then raise the ObjectNameNotFound= Exception. |
protected void |
setNamedRootTable(org.exolab.core.database.recman.PMDRootTable table)
Set the named root table. |
void |
setObjectCacheSize(int size)
Set the cache size for the database. |
void |
setRootObject(java.lang.String name,
java.lang.Object object)
Store the specified object with the passed in name. |
java.lang.String |
toString()
This will print the names of all the root entries |
void |
unbind(java.lang.String name)
Unbind the object associated with the specified name. |
void |
update(PersistentCapableIfc object)
Update the specified object form the database. |
long |
updateBoolean(long id,
boolean value)
Insert the boolean entity into the database and return the id of the stored record. |
long |
updateByte(long id,
byte value)
Insert the byte entity into the database and return the id of the stored record. |
long |
updateBytes(long id,
byte[] value)
Insert the String entity into the database and return the id of the stored record. |
long |
updateChar(long id,
char value)
Insert the char entity into the database and return the id of the stored record. |
long |
updateDouble(long id,
double value)
Insert the double entity into the database and return the id of the stored record. |
long |
updateFloat(long id,
float value)
Insert the float entity into the database and return the id of the stored record. |
long |
updateInt(long id,
int value)
Insert the int entity into the database and return the id of the stored record. |
long |
updateLong(long id,
long value)
Insert the long entity into the database and return the id of the stored record. |
protected void |
updateNamedRootTable()
Update the persistent copy of the named root table. |
long |
updateObject(long id,
java.lang.Object value)
Insert the object entity into the database and return the id of the stored record. |
long |
updateShort(long id,
short value)
Insert the short entity into the database and return the id of the stored record. |
long |
updateString(long id,
java.lang.String value)
Insert the String entity into the database and return the id of the stored record. |
protected long |
writeBoolean(long id,
boolean value)
Write the boolean to the database and return the id of the written entity. |
protected long |
writeByte(long id,
byte value)
Write the byte to the database and return the id of the written entity. |
protected long |
writeBytes(long id,
byte[] value)
Write the bytes[] to the database and return the id of the written entity. |
protected long |
writeChar(long id,
char value)
Write the char to the database and return the id of the written entity. |
protected long |
writeDouble(long id,
double value)
Write the double to the database and return the id of the written entity. |
protected long |
writeFloat(long id,
float value)
Write the float to the database and return the id of the written entity. |
protected long |
writeInt(long id,
int value)
Write the int to the database and return the id of the written entity. |
protected long |
writeLong(long id,
long value)
Write the long to the database and return the id of the written entity. |
protected long |
writeObject(long id,
java.lang.Object value)
Write the object to the database and return the id of the written entity. |
protected long |
writeShort(long id,
short value)
Write the short to the database and return the id of the written entity. |
protected long |
writeString(long id,
java.lang.String value)
Write the string to the database and return the id of the written entity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PageManagedDatabase(java.lang.String name) throws FailedToCreateDatabaseException
name
- name of the database
FailedToCreateDatabaseException
Method Detail |
---|
public void open() throws FailedToOpenDatabaseException
DatabaseIfc
open
in interface DatabaseIfc
FailedToOpenDatabaseException
public void close()
DatabaseIfc
close
in interface DatabaseIfc
public boolean isOpen()
DatabaseIfc
isOpen
in interface DatabaseIfc
public java.util.Enumeration getRootNames()
DatabaseIfc
getRootNames
in interface DatabaseIfc
public void bind(java.lang.String name, PersistentCapableIfc object) throws ObjectNameExistsException, DatabaseIOException
DatabaseIfc
bind
in interface DatabaseIfc
name
- binding nameobject
- object to bind
ObjectNameExistsException
DatabaseIOException
public void unbind(java.lang.String name) throws ObjectNameNotFoundException, DatabaseIOException
DatabaseIfc
unbind
in interface DatabaseIfc
name
- binding name
ObjectNameNotFoundException
DatabaseIOException
public PersistentCapableIfc lookup(java.lang.String name)
DatabaseIfc
lookup
in interface DatabaseIfc
name
- lookup name
public java.lang.Object getRootObject(java.lang.String name)
name
- lookup name
public void setRootObject(java.lang.String name, java.lang.Object object) throws ObjectNameExistsException, DatabaseIOException
If the name is already bound to another object then throw the ObjectNameExistsException exception. If there is any other error raise the DatabaseIOException exception
name
- name of the objectobject
- object to bind
ObjectNameExistsException
DatabaseIOException
public void removeRootObject(java.lang.String name) throws ObjectNameNotFoundException, DatabaseIOException
If there is any other problem removing the binding then throw the DatabaseIOException exception
name
- name of the object
ObjectNameNotFoundException
DatabaseIOException
public boolean isBound(java.lang.String name)
isBound
in interface DatabaseIfc
name
- lookup name
public void deleteObject(long id) throws DatabaseIOException
id
- id of object to destroy
DatabaseIOException
public long allocateObject(int size) throws DatabaseIOException
If it fails to delete the object then throw the DatabaseIOException exception.
int
- sizeof the object
DatabasEIOException
DatabaseIOException
public void insert(PersistentCapableIfc object) throws DatabaseIOException
DatabaseIfc
insert
in interface DatabaseIfc
object
- object to store
DatabaseIOException
public void delete(PersistentCapableIfc object) throws DatabaseIOException
DatabaseIfc
delete
in interface DatabaseIfc
object
- object to delete
DatabaseIOException
public void update(PersistentCapableIfc object) throws DatabaseIOException
DatabaseIfc
update
in interface DatabaseIfc
object
- object to update
DatabaseIOException
public long insertBoolean(boolean value) throws DatabaseIOException
value
- boolean value to store
DatabaseIOException
public long insertByte(byte value) throws DatabaseIOException
value
- byte value to store
DatabaseIOException
public long insertShort(short value) throws DatabaseIOException
value
- short value to store
DatabaseIOException
public long insertChar(char value) throws DatabaseIOException
value
- char value to store
DatabaseIOException
public long insertInt(int value) throws DatabaseIOException
value
- int value to store
DatabaseIOException
public long insertLong(long value) throws DatabaseIOException
value
- long value to store
DatabaseIOException
public long insertFloat(float value) throws DatabaseIOException
value
- float value to store
DatabaseIOException
public long insertDouble(double value) throws DatabaseIOException
value
- double value to store
DatabaseIOException
public long insertBytes(byte[] value) throws DatabaseIOException
value
- bytes to store
DatabaseIOException
public long insertString(java.lang.String value) throws DatabaseIOException
value
- String value to store
DatabaseIOException
public long insertObject(java.lang.Object value) throws DatabaseIOException
value
- object value to store
DatabaseIOException
public long updateBoolean(long id, boolean value) throws DatabaseIOException
id
- record id of entity to updatevalue
- boolean value to store
DatabaseIOException
public long updateByte(long id, byte value) throws DatabaseIOException
id
- record id of entity to updatevalue
- byte value to store
DatabaseIOException
public long updateShort(long id, short value) throws DatabaseIOException
id
- record id of entity to updatevalue
- short value to store
DatabaseIOException
public long updateChar(long id, char value) throws DatabaseIOException
id
- record id of entity to updatevalue
- char value to store
DatabaseIOException
public long updateInt(long id, int value) throws DatabaseIOException
id
- record id of entity to updatevalue
- int value to store
DatabaseIOException
public long updateLong(long id, long value) throws DatabaseIOException
id
- record id of entity to updatevalue
- long value to store
DatabaseIOException
public long updateFloat(long id, float value) throws DatabaseIOException
id
- record id of entity to updatevalue
- float value to store
DatabaseIOException
public long updateDouble(long id, double value) throws DatabaseIOException
id
- record id of entity to updatevalue
- double value to store
DatabaseIOException
public long updateBytes(long id, byte[] value) throws DatabaseIOException
id
- record id of entity to updatevalue
- bytes to store
DatabaseIOException
public long updateString(long id, java.lang.String value) throws DatabaseIOException
id
- record id of entity to updatevalue
- String value to store
DatabaseIOException
public long updateObject(long id, java.lang.Object value) throws DatabaseIOException
id
- record id of entity to updatevalue
- object value to store
DatabaseIOException
public boolean readBoolean(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public byte readByte(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public short readShort(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public char readChar(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public int readInt(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public long readLong(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public float readFloat(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public double readDouble(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public byte[] readBytes(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public java.lang.String readString(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public java.lang.Object readObject(long id) throws DatabaseIOException
id
- record identifier
DatabaseIOException
public void setObjectCacheSize(int size)
count
- size of cacheprotected long writeBoolean(long id, boolean value) throws DatabaseIOException
id
- record id if avaialablevalue
- boolean value to store
DatabaseIOException
protected long writeByte(long id, byte value) throws DatabaseIOException
id
- record id if avaialablevalue
- byte value to store
DatabaseIOException
protected long writeShort(long id, short value) throws DatabaseIOException
id
- record id if avaialablevalue
- short value to store
DatabaseIOException
protected long writeChar(long id, char value) throws DatabaseIOException
id
- record id if avaialablevalue
- char value to store
DatabaseIOException
protected long writeInt(long id, int value) throws DatabaseIOException
id
- long id if avaialablevalue
- int value to store
DatabaseIOException
protected long writeLong(long id, long value) throws DatabaseIOException
id
- record id if avaialablevalue
- long value to store
DatabaseIOException
protected long writeFloat(long id, float value) throws DatabaseIOException
id
- record id if avaialablevalue
- float value to store
DatabaseIOException
protected long writeDouble(long id, double value) throws DatabaseIOException
id
- record id if avaialablevalue
- double value to store
DatabaseIOException
protected long writeBytes(long id, byte[] value) throws DatabaseIOException
id
- record id if avaialablevalue
- bytes[] value to store
DatabaseIOException
protected long writeString(long id, java.lang.String value) throws DatabaseIOException
id
- record id if avaialablevalue
- string value to store
DatabaseIOException
protected long writeObject(long id, java.lang.Object value) throws DatabaseIOException
This also does some additional work if the object is of type Persistent- ObjectIfc. It checks the minimumObjectSize to see whether it should create an object which is greater than the current streamed-object size. This is only valid in the 'insert' mode and can drastically effect the size of the database.
id
- record id if avaialablevalue
- object value to store
DatabaseIOException
protected int getFirstFreeRootSlot() throws NoAvailableRootException, java.io.IOException
NoAvailableRootException
OException
java.io.IOException
protected void setNamedRootTable(org.exolab.core.database.recman.PMDRootTable table) throws java.io.IOException, DatabaseIOException
PMDRootTable
- new root table
DatabaseIOException
java.io.IOException
protected org.exolab.core.database.recman.PMDRootTable getNamedRootTable()
protected void updateNamedRootTable() throws java.io.IOException, DatabaseIOException
IOExcpetion
java.io.IOException
DatabaseIOException
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |