Package org.dizitart.no2.store
Class AbstractNitriteStore<Config extends StoreConfig>
- java.lang.Object
-
- org.dizitart.no2.store.AbstractNitriteStore<Config>
-
- Type Parameters:
Config
- the type of the store configuration object
- All Implemented Interfaces:
AutoCloseable
,NitritePlugin
,NitriteStore<Config>
public abstract class AbstractNitriteStore<Config extends StoreConfig> extends Object implements NitriteStore<Config>
An abstract implementation of theNitriteStore
interface that provides common functionality for Nitrite data stores.- Since:
- 4.0
- Author:
- Anindya Chatterjee
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeClose()
This method is called before closing the store.StoreCatalog
getCatalog()
Gets the store catalog.Set<String>
getCollectionNames()
Returns a set of all collection names in the store.org.dizitart.no2.common.event.NitriteEventBus<EventInfo,StoreEventListener>
getEventBus()
The event bus used to publish and subscribe to store events.Map<String,Set<String>>
getKeyedRepositoryRegistry()
Returns a set of all the keyed-repository names registered in the Nitrite store.NitriteConfig
getNitriteConfig()
The NitriteConfig object that holds the configuration for the Nitrite database.Set<String>
getRepositoryRegistry()
Returns a set of all the repository names registered in the Nitrite store.StoreCatalog
getStoreCatalog()
The catalog of all the collections and repositories in the Nitrite database.Config
getStoreConfig()
The configuration object for the Nitrite store.void
initialize(NitriteConfig nitriteConfig)
Initializes the plugin instance.void
setStoreConfig(Config storeConfig)
The configuration object for the Nitrite store.void
subscribe(StoreEventListener listener)
Subscribes aStoreEventListener
to this store.void
unsubscribe(StoreEventListener listener)
Unsubscribes aStoreEventListener
from this store.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dizitart.no2.common.module.NitritePlugin
close
-
Methods inherited from interface org.dizitart.no2.store.NitriteStore
closeMap, closeRTree, commit, getStoreVersion, hasMap, hasUnsavedChanges, isClosed, isReadOnly, openMap, openOrCreate, openRTree, removeMap, removeRTree
-
-
-
-
Method Detail
-
getCollectionNames
public Set<String> getCollectionNames()
Description copied from interface:NitriteStore
Returns a set of all collection names in the store.- Specified by:
getCollectionNames
in interfaceNitriteStore<Config extends StoreConfig>
- Returns:
- a set of all collection names in the store
-
getRepositoryRegistry
public Set<String> getRepositoryRegistry()
Description copied from interface:NitriteStore
Returns a set of all the repository names registered in the Nitrite store.- Specified by:
getRepositoryRegistry
in interfaceNitriteStore<Config extends StoreConfig>
- Returns:
- a set of all the repository names registered in the Nitrite store
-
getKeyedRepositoryRegistry
public Map<String,Set<String>> getKeyedRepositoryRegistry()
Description copied from interface:NitriteStore
Returns a set of all the keyed-repository names registered in the Nitrite store.- Specified by:
getKeyedRepositoryRegistry
in interfaceNitriteStore<Config extends StoreConfig>
- Returns:
- a set of all the keyed-repository names registered in the Nitrite store
-
beforeClose
public void beforeClose()
Description copied from interface:NitriteStore
This method is called before closing the store. Any cleanup or finalization tasks should be performed in this method.- Specified by:
beforeClose
in interfaceNitriteStore<Config extends StoreConfig>
-
subscribe
public void subscribe(StoreEventListener listener)
Description copied from interface:NitriteStore
Subscribes aStoreEventListener
to this store. The listener will be notified of any changes made to the store.- Specified by:
subscribe
in interfaceNitriteStore<Config extends StoreConfig>
- Parameters:
listener
- the listener to subscribe
-
unsubscribe
public void unsubscribe(StoreEventListener listener)
Description copied from interface:NitriteStore
Unsubscribes aStoreEventListener
from this store.- Specified by:
unsubscribe
in interfaceNitriteStore<Config extends StoreConfig>
- Parameters:
listener
- the listener to unsubscribe
-
initialize
public void initialize(NitriteConfig nitriteConfig)
Description copied from interface:NitritePlugin
Initializes the plugin instance.- Specified by:
initialize
in interfaceNitritePlugin
- Parameters:
nitriteConfig
- the nitrite config
-
getCatalog
public StoreCatalog getCatalog()
Description copied from interface:NitriteStore
Gets the store catalog.- Specified by:
getCatalog
in interfaceNitriteStore<Config extends StoreConfig>
- Returns:
- the catalog
-
getStoreConfig
public Config getStoreConfig()
The configuration object for the Nitrite store.- Specified by:
getStoreConfig
in interfaceNitriteStore<Config extends StoreConfig>
- Returns:
- the store config
-
getEventBus
public org.dizitart.no2.common.event.NitriteEventBus<EventInfo,StoreEventListener> getEventBus()
The event bus used to publish and subscribe to store events.
-
getNitriteConfig
public NitriteConfig getNitriteConfig()
The NitriteConfig object that holds the configuration for the Nitrite database.
-
getStoreCatalog
public StoreCatalog getStoreCatalog()
The catalog of all the collections and repositories in the Nitrite database.
-
setStoreConfig
public void setStoreConfig(Config storeConfig)
The configuration object for the Nitrite store.
-
-