Class BerkeleyKVStorePlugin
- java.lang.Object
-
- io.vertigo.datastore.plugins.kvstore.berkeley.BerkeleyKVStorePlugin
-
- All Implemented Interfaces:
io.vertigo.core.node.component.Activeable
,io.vertigo.core.node.component.CoreComponent
,io.vertigo.core.node.component.Plugin
,io.vertigo.core.node.definition.DefinitionProvider
,io.vertigo.core.node.definition.SimpleDefinitionProvider
,KVStorePlugin
public final class BerkeleyKVStorePlugin extends Object implements KVStorePlugin, io.vertigo.core.node.component.Activeable, io.vertigo.core.node.definition.SimpleDefinitionProvider
Implémentation d'un store BerkeleyDB.- Author:
- pchretien, npiedeloup
-
-
Constructor Summary
Constructors Constructor Description BerkeleyKVStorePlugin(String collections, String dbFilePath, VTransactionManager transactionManager, CodecManager codecManager, io.vertigo.core.analytics.AnalyticsManager analyticsManager)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(String collection)
Removes all elements from a collection.int
count(String collection)
<C> Optional<C>
find(String collection, String id, Class<C> clazz)
Finds the optional element to which the id is mapped inside the specified collection.<C> List<C>
findAll(String collection, int skip, Integer limit, Class<C> clazz)
Finds all elements contained inside the specified collection.List<String>
getCollections()
Returns the list of collections managed by this plugin.List<? extends io.vertigo.core.node.definition.Definition>
provideDefinitions(io.vertigo.core.node.definition.DefinitionSpace definitionSpace)
void
put(String collection, String id, Object element)
Adds an element defined by an id in a collection.void
remove(String collection, String id)
Removes an element defined by an id from a collection.void
start()
void
stop()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
BerkeleyKVStorePlugin
@Inject public BerkeleyKVStorePlugin(String collections, String dbFilePath, VTransactionManager transactionManager, CodecManager codecManager, io.vertigo.core.analytics.AnalyticsManager analyticsManager)
Constructor. Collections syntax : - collections are comma separated a revoir (param étendus - collections may defined TimeToLive and Memory configs with a json like syntax : collName;TTL=10;inMemory - TTL default to -1 meaning eternal - inMemory default to false meaning store on file system- Parameters:
collections
- List of collections managed by this plugin (comma separated)dbFilePath
- Base Berkeley DB file system path (Could use java env param like user.home user.dir or java.io.tmpdir)transactionManager
- Transaction managercodecManager
- Codec manager
-
-
Method Detail
-
provideDefinitions
public List<? extends io.vertigo.core.node.definition.Definition> provideDefinitions(io.vertigo.core.node.definition.DefinitionSpace definitionSpace)
- Specified by:
provideDefinitions
in interfaceio.vertigo.core.node.definition.SimpleDefinitionProvider
-
getCollections
public List<String> getCollections()
Returns the list of collections managed by this plugin.- Specified by:
getCollections
in interfaceKVStorePlugin
- Returns:
- list of collections;
-
start
public void start()
- Specified by:
start
in interfaceio.vertigo.core.node.component.Activeable
-
stop
public void stop()
- Specified by:
stop
in interfaceio.vertigo.core.node.component.Activeable
-
remove
public void remove(String collection, String id)
Removes an element defined by an id from a collection. If the collection doesn't contain the is then a exception is thrown.- Specified by:
remove
in interfaceKVStorePlugin
- Parameters:
collection
- the collectionid
- the id
-
clear
public void clear(String collection)
Removes all elements from a collection.- Specified by:
clear
in interfaceKVStorePlugin
- Parameters:
collection
- the collection
-
put
public void put(String collection, String id, Object element)
Adds an element defined by an id in a collection.- Specified by:
put
in interfaceKVStorePlugin
- Parameters:
collection
- the collectionid
- the idelement
- the element
-
find
public <C> Optional<C> find(String collection, String id, Class<C> clazz)
Finds the optional element to which the id is mapped inside the specified collection. If the element is not found then an empty option is returned.- Specified by:
find
in interfaceKVStorePlugin
- Type Parameters:
C
- Element type- Parameters:
collection
- the collectionid
- the idclazz
- the type of the searched element- Returns:
- the option
-
findAll
public <C> List<C> findAll(String collection, int skip, Integer limit, Class<C> clazz)
Finds all elements contained inside the specified collection.- Specified by:
findAll
in interfaceKVStorePlugin
- Type Parameters:
C
- Element type- Parameters:
collection
- the collectionskip
- the position from which the elements are returnedlimit
- the limit size of elementsclazz
- the type of the searched element- Returns:
- the list of elements.
-
count
public int count(String collection)
- Specified by:
count
in interfaceKVStorePlugin
- Parameters:
collection
- the collection- Returns:
- count of elements into collection
-
-