Package es.bsc.dataclay.dbhandler
Interface DBHandler
-
- All Known Implementing Classes:
SQLHandler
,SQLiteHandler
public interface DBHandler
This class represents the functions that any handler of the storage of objects must implement.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
close()
Close the databaseint
count()
Count number of objects in DBvoid
delete(ObjectID objectID)
Deletes and object from the database.boolean
exists(ObjectID objectID)
Check if object with ID provided exists.byte[]
get(ObjectID objectID)
Get serialized object identified by ObjectIDboolean
isClosed()
Verify if database is closed.void
open()
Open the database.void
store(ObjectID objectID, byte[] bytes)
Store the object.void
update(ObjectID objectID, byte[] newbytes)
Updates an object identified by the ID provided with the new values provided.void
vacuum()
Vacuum database.
-
-
-
Method Detail
-
store
void store(ObjectID objectID, byte[] bytes)
Store the object.- Parameters:
objectID
- ID of the objectbytes
- Bytes of the object
-
get
byte[] get(ObjectID objectID)
Get serialized object identified by ObjectID- Parameters:
objectID
- ID of the object- Returns:
- Bytes of the serialized object with ID provided.
-
exists
boolean exists(ObjectID objectID)
Check if object with ID provided exists.- Parameters:
objectID
- ID of the object- Returns:
- TRUE if object exists.
-
update
void update(ObjectID objectID, byte[] newbytes)
Updates an object identified by the ID provided with the new values provided.- Parameters:
objectID
- ID of the object.newbytes
- New byte values
-
delete
void delete(ObjectID objectID)
Deletes and object from the database.- Parameters:
objectID
- ID of the object to delete
-
isClosed
boolean isClosed()
Verify if database is closed.- Returns:
- TRUE if database is closed. FALSE, otherwise.
-
close
boolean close()
Close the database- Returns:
- TRUE if database was closed successfully. FALSE otherwise.
-
open
void open()
Open the database.
-
count
int count()
Count number of objects in DB- Returns:
- number of objects in DB
-
vacuum
void vacuum()
Vacuum database.
-
-