All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.archive.DatabaseNoIndex

java.lang.Object
   |
   +----semper.archive.DatabaseNoIndex

public class DatabaseNoIndex
extends Object
implements Database
DatabaseNoIndex implements a database to be used for the Archive Services of SEMPER. It offers basic functions for persistent storage, using the interface defined by the interface class Database.
This particular implementation does not provide an index to the stored database. It looks up information every time a request is executed on the database. This implementation is not the most efficient but it works. For this version of the database, a very simple storage model is used, much like a Unix directory. Each entry in the database consists of the following fields: 0 entry-size - 1 | | v v Entry: (entry-size, record-size, record, gap) Record: (key-size, key, date, attr-size, attr, data-size, data) The entry-size specifies the size of the record and the optional gap at and of the entry. The gap can be used to fill in new entries, and is created when records are thrown away. The size of the gap is always entry-size - record-size - sizeof(record-size). The records themselves hold: key, date, attr and data.

Version:
$Revision 1.3 $ $Date:
Author:
Peter Bosch, CWI

Constructor Index

 o DatabaseNoIndex(String, boolean)
Construct a new database object.

Method Index

 o Delete(String)
Delete an entry from the database
 o Modify(String, Date, String, byte[])
Update an entry with new data
 o ReadAttr(String)
Search the database for key and return the attr associated with the key
 o ReadData(String)
Search the database for key and return the data associated with the key
 o ReadDate(String)
Search the database for key and return the date associated with the key
 o Store(String, Date, String, byte[])
Stores a new entry in the database
 o Traverse(String, Date, Date)
Traverse the database, returns the next key

Constructors

 o DatabaseNoIndex
 public DatabaseNoIndex(String filename,
                        boolean newDataBase) throws DatabaseException
Construct a new database object.

Parameters:
filename - File which is used as database.
newDataBase - Create a new database?
Throws: DatabaseException
Error while updating the database

Methods

 o Store
 public void Store(String key,
                   Date date,
                   String attr,
                   byte data[]) throws DatabaseException
Stores a new entry in the database

Parameters:
key - Key to store
date - Date at which the field is stored
attr - Security attributes
data - User defined data
Throws: DatabaseException
Error while updating the database
 o Delete
 public void Delete(String key) throws DatabaseException
Delete an entry from the database

Parameters:
key - Key reprenting entry to delete.
Throws: DatabaseException
Error while updating the database
 o ReadDate
 public Date ReadDate(String key) throws DatabaseException
Search the database for key and return the date associated with the key

Parameters:
key - Key reprenting entry to delete.
Returns:
The date stored in the entry.
Throws: DatabaseException
Error while updating the database
 o ReadAttr
 public String ReadAttr(String key) throws DatabaseException
Search the database for key and return the attr associated with the key

Parameters:
key - Key reprenting entry to delete.
Returns:
The attributes stored in the entry.
Throws: DatabaseException
Error while updating the database
 o ReadData
 public byte[] ReadData(String key) throws DatabaseException
Search the database for key and return the data associated with the key

Parameters:
key - Key reprenting entry to delete.
Returns:
The data stored in the entry.
Throws: DatabaseException
Error while updating the database
 o Modify
 public void Modify(String key,
                    Date date,
                    String attr,
                    byte data[]) throws DatabaseException
Update an entry with new data

Parameters:
key - Key to store
date - Date at which the field is stored
attr - Security attributes
data - User defined data
Throws: DatabaseException
Error while updating the database
 o Traverse
 public String[] Traverse(String partialKey,
                          Date startDate,
                          Date endDate) throws DatabaseException
Traverse the database, returns the next key

Parameters:
partialKey - Substring of keys to match.
Entries - before startData are not selected
Entries - after endDate are not selected
Returns:
List of keys that match partialKey and are startDate <= d <= endDate
Throws: DatabaseException
Error while updating the database

All Packages  Class Hierarchy  This Package  Previous  Next  Index