Class AbstractTrsStore
- java.lang.Object
-
- com.sodius.oslc.server.trs.store.AbstractTrsStore
-
- All Implemented Interfaces:
ResourceEventStore,Store,TrsStore
- Direct Known Subclasses:
FileTrsStore
public abstract class AbstractTrsStore extends Object implements TrsStore
Partial implementation of aTrsStorefulfilling the contract ofResourceEventStore.- Since:
- 3.3.0
-
-
Field Summary
Fields Modifier and Type Field Description protected static intBASE_BUFFER_SIZEProven buffer size for base members consumption with good performance for memory and db storage.protected static intEVENTS_BUFFER_SIZEProven buffer size for resource events consumption with good performance for memory and db storage.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTrsStore(URI domain)Creates a new store instance representing the given OSLC domain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassertNoOrderOverflow(int order)Asserts whether the given order can be safely incremented after this call, to add a new change event.protected URIgetDomain()Returns the OSLC domain represented by this store.booleanisStoringEventsOf(Optional<String> projectAreaId)Determines whether the store is currently able to store events and, optionally, for a particular project.voidstore(ResourceEvent... resourceEvents)Stores one or a fewresource events.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sodius.oslc.server.trs.store.ResourceEventStore
store
-
Methods inherited from interface com.sodius.oslc.server.trs.store.Store
corrupt, isCorrupted
-
Methods inherited from interface com.sodius.oslc.server.trs.store.TrsStore
addBaseMembers, collectBaseMembers, collectChangeEventSeeds, countChangeEventSeeds, createSynchronizer, getControl, getFirstChangeEventSince, getStagingResourceEventStore, isResourceExposed, pollChangeEventSeeds, pushResourceEvents, rebase, removeChangeEventSeedsBefore, restore, saveControl, synchronizeResourceEvents
-
-
-
-
Field Detail
-
BASE_BUFFER_SIZE
protected static final int BASE_BUFFER_SIZE
Proven buffer size for base members consumption with good performance for memory and db storage.- See Also:
- Constant Field Values
-
EVENTS_BUFFER_SIZE
protected static final int EVENTS_BUFFER_SIZE
Proven buffer size for resource events consumption with good performance for memory and db storage.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractTrsStore
protected AbstractTrsStore(URI domain)
Creates a new store instance representing the given OSLC domain.- Parameters:
domain- the OSLC domain- Throws:
NullPointerException- if the domain isnull- Since:
- 3.11.0
-
-
Method Detail
-
getDomain
protected final URI getDomain()
Returns the OSLC domain represented by this store.- Returns:
- the domain URI
- Since:
- 3.11.0
-
isStoringEventsOf
public boolean isStoringEventsOf(Optional<String> projectAreaId)
Description copied from interface:ResourceEventStoreDetermines whether the store is currently able to store events and, optionally, for a particular project.This method must not raise any exception,
falsemust be returned silently if any of them occurred while computing the result. Implementation must verify theTRS store is not corrupted, the correspondingbase is computedand afunctional useris set. If a project is given, it is then recommended to rely onTrsFeedManager.isExposedProjectArea(String).- Specified by:
isStoringEventsOfin interfaceResourceEventStore- Parameters:
projectAreaId- the optional project identifier.- Returns:
trueif TRS events should be stored
-
store
public void store(ResourceEvent... resourceEvents)
Description copied from interface:ResourceEventStoreStores one or a fewresource events. If a larger volume of events is to send at once, client is recommended to rather use theResourceEventStore.store(Function)method.Implementations MUST store events, without blocking the application, only if the
ResourceEventStore.isStoringEventsOf(Optional)method returnstrue, for each of the givenevent seeds, and must keep them hidden from the TRS feed up to theTrsStore.synchronizeResourceEvents()method is called.This method is intended to avoid raising
TrsStoreException, if something went wrong preventing the storage of the event, implementations must handle it silently.- Specified by:
storein interfaceResourceEventStore- Parameters:
resourceEvents- events to store.
-
assertNoOrderOverflow
protected void assertNoOrderOverflow(int order)
Asserts whether the given order can be safely incremented after this call, to add a new change event. If the given number is yet the maximum value, this methodcorruptsthe store and throws an exception.- Parameters:
order- the last event order used and that is to increment after this call- Throws:
CompletionException- if the given order is yet the maximum value- Since:
- 3.11.0
-
-