fipaos.skill.db
Interface Database

All Known Implementing Classes:
MemoryDatabase, NoDatabase, SerializationDatabase

public interface Database

This is the interface that all database implementations should implement to provide the ability to change the database used at runtime


Method Summary
 voidaddObject(DatabaseObject obj)
          Method to add the given DatabaseObject to the database, in the given relation.
 voidcloseDatabase()
          Method to close the database store.
 voidcreateDatabase()
          Method to create the database store.
 voidcreateRelation(String relation)
          Creates the given relation within the Database
 voiddeleteDatabase()
          Method to remove the database store.
 voiddeleteRelation(String relation)
          Deletes the given relation from the Database
 voidendTransaction()
          Indicates that a transaction has finished.
 DatabaseObjectfindObject(String unique_id)
          Method to locate the object in the given relation with the given UID
 EnumerationgetIDs()
          Method to return an enumeration of the keys in the database
 voidopenDatabase()
          Method to re-open the database store.
 voidremoveObject(DatabaseObject obj)
          Method to remove the given DatabaseObject from the Database
 voidremoveObject(String unique_id)
          Method to remove the DatabaseObject from the Database with the given UID
 voidstartTransaction(boolean readonly)
          Indicates that a transaction is about to start.
 voidupdateObject(DatabaseObject obj)
          Method to update the given DatabaseObject in the Database

Method Detail

addObject

public void addObject(DatabaseObject obj)
throws DatabaseException
Method to add the given DatabaseObject to the database, in the given relation.
Parameters:
obj - The DatabaseObject to add

closeDatabase

public void closeDatabase()
throws DatabaseException
Method to close the database store. Should only be called after openDatabase() or createDatabase() have been used and after all necessary transactions have been made. Transactions cannot take place again until the database is re-opened.

createDatabase

public void createDatabase()
throws DatabaseException
Method to create the database store. Either this method or openDatabase() should be called before attempting to interact with the Database

createRelation

public void createRelation(String relation)
throws DatabaseException
Creates the given relation within the Database
Parameters:
relation - The name of the relation to create

deleteDatabase

public void deleteDatabase()
throws DatabaseException
Method to remove the database store. The database will be closed if necessary before the store is removed. The database can only be used again once a new store has been created.

deleteRelation

public void deleteRelation(String relation)
throws DatabaseException
Deletes the given relation from the Database
Parameters:
relation - The name of the relation to delete

endTransaction

public void endTransaction()
throws DatabaseException
Indicates that a transaction has finished. THIS MUST BE CALLED AFTER THE DATABASE HAS BEEN MANIPULATED IN ORDER TO COMMIT CHANGES.

findObject

public DatabaseObject findObject(String unique_id)
throws DatabaseException
Method to locate the object in the given relation with the given UID
Parameters:
unique_id - The unique id of the DatabaseObject to find

getIDs

public Enumeration getIDs()
throws DatabaseException
Method to return an enumeration of the keys in the database
Returns: An Enumeration of the ID's of the objects in the database

openDatabase

public void openDatabase()
throws DatabaseException
Method to re-open the database store. Either this method or createDatabase() should be called before attempting to interact with the Database

removeObject

public void removeObject(DatabaseObject obj)
throws DatabaseException
Method to remove the given DatabaseObject from the Database
Parameters:
obj - The DatabaseObject to remove

removeObject

public void removeObject(String unique_id)
throws DatabaseException
Method to remove the DatabaseObject from the Database with the given UID
Parameters:
unique_id - The unique id of the DatabaseObject to remove

startTransaction

public void startTransaction(boolean readonly)
throws DatabaseException
Indicates that a transaction is about to start. THIS MUST BE CALLED BEFORE THE DATABASE IS MANIPULATED.
Parameters:
type - If true, the transaction will be read-only

updateObject

public void updateObject(DatabaseObject obj)
throws DatabaseException
Method to update the given DatabaseObject in the Database
Parameters:
obj - The DatabaseObject to update