Package org.sensorhub.api.database
Interface IDatabase
- All Known Subinterfaces:
IFeatureDatabase
,IFederatedDatabase
,IObsSystemDatabase
,IObsSystemDatabaseModule<ConfigType>
,IProcedureDatabase
,ISystemDriverDatabase
,ISystemStateDatabase
public interface IDatabase
Base interface for all database implementations.
A database contains one or more data stores.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
commit()
Commit changes to the database.
Note that this is equivalent to calling commit on each data store separately<T> T
executeTransaction
(Callable<T> transaction) Execute a transaction guaranteeing that all changes are applied consistently or reverted in case of error.boolean
isOpen()
boolean
-
Method Details
-
getDatabaseNum
Integer getDatabaseNum()- Returns:
- The number assigned to this database, or null if none is set. Database instances attached to the same hub must have different numbers.
-
executeTransaction
Execute a transaction guaranteeing that all changes are applied consistently or reverted in case of error.- Parameters:
transaction
- Callable running all creation/deletion/update commands.- Returns:
- The result of the transaction
- Throws:
Exception
- Any exception thrown by the callable itself
-
commit
void commit()Commit changes to the database.
Note that this is equivalent to calling commit on each data store separately -
isOpen
boolean isOpen()- Returns:
- True if the database is open, false otherwise
-
isReadOnly
boolean isReadOnly()- Returns:
- True if the database is open as read-only, false otherwise
-