Package com.oracle.coherence.repository
Class AbstractRepositoryBase<ID,T,M>
java.lang.Object
com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,M>
- Type Parameters:
ID
- the type of entity's identifierT
- the type of entity stored in this repositoryM
- the underlying map type
- Direct Known Subclasses:
AbstractAsyncRepository
,AbstractRepository
Base functionality for all Coherence
repository
implementations.
- Since:
- 21.06
- Author:
- Ryan Lubke 2021.04.08, Aleks Seovic
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
An interface that should be implemented by the clients interested in repository events.protected static class
Adapter fromAbstractRepositoryBase.Listener
toMapListener
that can be registered with the backingNamedMap
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(AbstractRepositoryBase.Listener<? super T> listener) Register a listener that will observe all repository events.void
addListener
(Filter<?> filter, AbstractRepositoryBase.Listener<? super T> listener) Register a listener that will observe all events for entities that satisfy the specified criteria.void
addListener
(ID id, AbstractRepositoryBase.Listener<? super T> listener) Register a listener that will observe all events for a specific entity.protected void
Creates indices for this repository that are defined via@Accelerated
and@Indexed
annotations.protected void
Ensures that this repository is initialized by creating necessary indices on the backing map.Return the type of entities in this repository.protected abstract ID
Return the identifier of the specified entity instance.protected abstract M
getMap()
Return the map that is used as the underlying entity store.protected MapListener
<? super ID, ? super T> instantiateMapListener
(AbstractRepositoryBase.Listener<? super T> delegate) Factory method forAbstractRepositoryBase.Listener
adapter toMapListener
.listener()
Create newAbstractRepositoryBase.Listener.Builder
instance.void
removeListener
(AbstractRepositoryBase.Listener<? super T> listener) Unregister a listener that observes all repository events.void
removeListener
(Filter<?> filter, AbstractRepositoryBase.Listener<? super T> listener) Unregister a listener that observes all events for entities that satisfy the specified criteria.void
removeListener
(ID id, AbstractRepositoryBase.Listener<? super T> listener) Unregister a listener that observes all events for a specific entity.
-
Constructor Details
-
AbstractRepositoryBase
public AbstractRepositoryBase()
-
-
Method Details
-
getId
Return the identifier of the specified entity instance.- Parameters:
entity
- the entity to get the identifier from- Returns:
- the identifier of the specified entity instance
-
getEntityType
Return the type of entities in this repository.- Returns:
- the type of entities in this repository
-
getMap
Return the map that is used as the underlying entity store.- Returns:
- the map that is used as the underlying entity store
-
ensureInitialized
protected void ensureInitialized()Ensures that this repository is initialized by creating necessary indices on the backing map. Base framework classes that extend this class should call this method after the backing map has been initialized, but before any other calls are made. -
createIndices
protected void createIndices()Creates indices for this repository that are defined via@Accelerated
and@Indexed
annotations. If overriding this method, please callsuper.createIndices()
or the standard behavior will not work. -
instantiateMapListener
protected MapListener<? super ID,? super T> instantiateMapListener(AbstractRepositoryBase.Listener<? super T> delegate) Factory method forAbstractRepositoryBase.Listener
adapter toMapListener
.- Parameters:
delegate
- theAbstractRepositoryBase.Listener
to delegate events to- Returns:
- a
MapListener
that can be registered with aNamedMap
and will delegate events to theAbstractRepositoryBase.Listener
it wraps
-
addListener
Register a listener that will observe all repository events.- Parameters:
listener
- the event listener to register
-
removeListener
Unregister a listener that observes all repository events.- Parameters:
listener
- the event listener to unregister
-
addListener
Register a listener that will observe all events for a specific entity.- Parameters:
id
- the identifier of the entity to observelistener
- the event listener to register
-
removeListener
Unregister a listener that observes all events for a specific entity.- Parameters:
id
- the identifier of the entity to observelistener
- the event listener to unregister
-
addListener
Register a listener that will observe all events for entities that satisfy the specified criteria.- Parameters:
filter
- the criteria to use to select entities to observelistener
- the event listener to register
-
removeListener
Unregister a listener that observes all events for entities that satisfy the specified criteria.- Parameters:
filter
- the criteria to use to select entities to observelistener
- the event listener to unregister
-
listener
Create newAbstractRepositoryBase.Listener.Builder
instance.- Returns:
- a new
AbstractRepositoryBase.Listener.Builder
instance
-