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
 void addObject(DatabaseObject obj)
          Method to add the given DatabaseObject to the database, in the given relation.
 void closeDatabase()
          Method to close the database store.
 void createDatabase()
          Method to create the database store.
 void createRelation(java.lang.String relation)
          Creates the given relation within the Database
 void deleteDatabase()
          Method to remove the database store.
 void deleteRelation(java.lang.String relation)
          Deletes the given relation from the Database
 void endTransaction()
          Indicates that a transaction has finished.
 DatabaseObject findObject(java.lang.String unique_id)
          Method to locate the object in the given relation with the given UID
 java.util.Enumeration getIDs()
          Method to return an enumeration of the keys in the database
 void openDatabase()
          Method to re-open the database store.
 void removeObject(DatabaseObject obj)
          Method to remove the given DatabaseObject from the Database
 void removeObject(java.lang.String unique_id)
          Method to remove the DatabaseObject from the Database with the given UID
 void startTransaction(boolean readonly)
          Indicates that a transaction is about to start.
 void updateObject(DatabaseObject obj)
          Method to update the given DatabaseObject in the Database
 

Method Detail

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

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

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.

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.

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

findObject

public DatabaseObject findObject(java.lang.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

updateObject

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

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(java.lang.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

createRelation

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

deleteRelation

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

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

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.

getIDs

public java.util.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