Class MapDBContext
Object
MapDBContext
- All Implemented Interfaces:
Closeable,AutoCloseable,DBContext
An implementation of
DBContext that relies on a DB.- Author:
- Abbas Abou Daya
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackup()Implementations of this method are free to return any object such as XML, JSON, etc...voidclear()Clears the data structures present in the database.voidclose()voidcommit()Commits the database to its persistent layer.boolean<T> List<T><K,V> Map<K, V> <T> Set<T><T> Var<T>static DBContextofflineInstance(String name) This DB returned by this method gets deleted on JVM shutdown.static DBContextonlineInstance(String name) This DB returned by this method does not trigger deletion on JVM shutdown.booleanThe object passed to this method need to conform to the implementation of theDBContext.backup()method.summary()
-
Constructor Details
-
MapDBContext
public MapDBContext(DB db)
-
-
Method Details
-
onlineInstance
This DB returned by this method does not trigger deletion on JVM shutdown.- Parameters:
name- name of the DB file- Returns:
- an online instance of
MapDBContext
-
offlineInstance
This DB returned by this method gets deleted on JVM shutdown.- Parameters:
name- name of the DB file- Returns:
- an offline instance of
MapDBContext
-
getList
-
getMap
-
getSet
-
getVar
-
summary
-
backup
Description copied from interface:DBContextImplementations of this method are free to return any object such as XML, JSON, etc... -
recover
Description copied from interface:DBContextThe object passed to this method need to conform to the implementation of theDBContext.backup()method. -
info
-
commit
public void commit()Description copied from interface:DBContextCommits the database to its persistent layer. Implementations are free to not implement this method as it is not compulsory. -
clear
public void clear()Description copied from interface:DBContextClears the data structures present in the database.This method does not delete the data-structure themselves, but leaves them empty.
-
contains
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-