public abstract class AbstractStore extends Proxied.Abstract implements Store
Proxied.Abstract
Modifier and Type | Field and Description |
---|---|
static String |
QUERIES_BATCH_LIMIT_PROPERTY
Limits the size of a batch of queries.
|
static String |
RESPONSE_LIMIT_PROPERTY
Limits the maximum number of point values that may be grouped in a
single response.
|
ARCHIVE_TIME_PARAM, BIND_POINTS_PARAM, BINDING_PARAM, CONFIRM_PARAM, CONFIRM_RETRIES_PARAM, CONFIRM_RETRY_DELAY_PARAM, DEFAULT_STORE_NAME, LIFE_TIME_PARAM, NAME_PARAM, NULL_REMOVES_PARAM, PASSWORD_PARAM, QUEUE_PARAM, RESPECT_VERSION_PARAM, SECURITY_PARAM, USER_PARAM
Constructor and Description |
---|
AbstractStore() |
Modifier and Type | Method and Description |
---|---|
protected StoreAccessException |
accessException(SessionException cause)
Returns an access exception.
|
boolean |
addQuery(StoreValuesQuery query)
Adds a store query for point values.
|
void |
addUpdate(PointValue pointValue)
Added an update for a point value.
|
void |
bind(Point point)
Requests the binding of a point.
|
protected void |
bindPoints()
Binds points to their UUID.
|
protected void |
bindPoints(Set<Point> points)
Binds points to their UUID.
|
boolean |
canConfirm()
Asks if this store can confirm point values.
|
void |
close()
Closes the store.
|
int |
compareTo(Store other) |
boolean |
confirm(PointValue pointValue,
boolean confirmValue)
Confirms a point value.
|
StoreValues |
deliver(int limit,
long timeout)
Delivers subscribed point values from store update events.
|
protected abstract void |
doAddQuery(StoreValuesQuery query)
Does add a store query for point values.
|
protected int |
getConfirmRetries()
Gets the confirm retries.
|
protected long |
getConfirmRetryDelay()
Gets the confirm retry delay.
|
int |
getQueriesBatchLimit()
Gets the queries batch limit.
|
int |
getResponseLimit()
Gets the response limit.
|
Optional<StoreValues[]> |
getSubscribedValues()
Gets the values from the subscribed call.
|
protected Logger |
getThisLogger()
Gets the logger.
|
int |
getUpdateCount()
Gets the update count.
|
Collection<PointValue> |
getUpdates()
Gets the updates not yet sent.
|
UUID |
getUUID()
Gest the store entity UUID.
|
void |
impersonate(Optional<String> user)
Impersonates an other user.
|
boolean |
isNullRemoves()
Asks if a null value removes that value.
|
Iterable<PointValue> |
iterate(StoreValuesQuery query)
Iterates on the point values returned for a store query.
|
StoreValues |
pull(StoreValuesQuery query,
long timeout)
Pulls points values.
|
int |
purge(UUID[] pointUUIDs,
TimeInterval timeInterval)
Purges point values.
|
protected void |
reset()
Resets.
|
boolean |
sendUpdates()
Sends the pending updates.
|
protected void |
setConfirmRetries()
Sets the confirm retries.
|
protected void |
setQueriesBatchLimit(Config config)
Sets the queries batch limit.
|
protected void |
setResponseLimit(Config config)
Sets the response limit.
|
boolean |
setUp(Metadata metadata,
ProxyEntity proxyEntity)
Sets up the instance for action.
|
boolean |
subscribe(Collection<UUID> points)
Subscribes to point values store update events.
|
boolean |
subscribe(UUID[] points)
Subscribes to point values store update events.
|
protected abstract String |
supportedValueTypeCodes()
Returns a string of supported value type codes.
|
EnumSet<Externalizer.ValueType> |
supportedValueTypes()
Gets the value types supported by this store.
|
boolean |
supportsCount()
Asks if this store supports count.
|
boolean |
supportsDelete()
Asks if this store supports delete.
|
boolean |
supportsDeliver()
Asks if this store supports deliver.
|
boolean |
supportsPull()
Asks if this store supports pull queries.
|
boolean |
supportsPurge()
Asks if this store supports purge.
|
boolean |
supportsSubscribe()
Asks if this store supports subscribe.
|
void |
tearDown()
Tears down what has been set up.
|
boolean |
unsubscribe(UUID[] points)
Unsubscribes from points values events.
|
getMetadata, getName, getParams, getProxyEntity
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connect, getExceptions, getName, getParams, nextValues, probe, select, sendUpdates
public static final String QUERIES_BATCH_LIMIT_PROPERTY
public static final String RESPONSE_LIMIT_PROPERTY
public final boolean addQuery(StoreValuesQuery query)
The queries will be sent on the next call to Store.nextValues()
.
public final void addUpdate(PointValue pointValue)
The updates will be sent on the next call to Store.sendUpdates()
.
addUpdate
in interface Store
pointValue
- The point value.Store.supportsDelete()
public final void bind(Point point)
This allows communications with stores on different metadata domains. The client and server will try to map the possibly different UUID using the point's 'Tag' parameter (the point's name will be used when this parameter is absent).
public boolean canConfirm()
canConfirm
in interface Store
public void close()
May be called redundantly.
public final int compareTo(Store other)
compareTo
in interface Comparable<Store>
public boolean confirm(PointValue pointValue, boolean confirmValue) throws InterruptedException, StoreAccessException
confirm
in interface Store
pointValue
- The point value.confirmValue
- When true, PointValue.sameValueAs(org.rvpf.base.value.PointValue)
should be
called.InterruptedException
- When interrupted.StoreAccessException
- On store access problem.public StoreValues deliver(int limit, long timeout) throws InterruptedException, StoreAccessException
A 'deliver' request is an alternative to a 'pull' request. Starting values are taken as the return of the 'subscribe' request; the follow up is then made with 'deliver' request.
deliver
in interface Store
limit
- A limit for the number of values.timeout
- A time limit in millis to wait for the first message
(negative for infinite).InterruptedException
- When the service is stopped.StoreAccessException
- On store access problem.Store.supportsDeliver()
public final int getQueriesBatchLimit()
getQueriesBatchLimit
in interface Store
public final int getResponseLimit()
getResponseLimit
in interface Store
public Optional<StoreValues[]> getSubscribedValues()
getSubscribedValues
in interface Store
public UUID getUUID()
public final int getUpdateCount()
getUpdateCount
in interface Store
public final Collection<PointValue> getUpdates()
getUpdates
in interface Store
public void impersonate(Optional<String> user) throws StoreAccessException
Ends the current impersonation, if any, and begins a new one if the user argument is not empty.
impersonate
in interface Store
user
- The other user (empty string for anonymous, empty to cancel).StoreAccessException
- On store access problem.public boolean isNullRemoves()
isNullRemoves
in interface Store
public Iterable<PointValue> iterate(StoreValuesQuery query)
The iteration can extend beyond the store query limit.
Note: the returned iterable and its iterator are not thread safe.
public StoreValues pull(StoreValuesQuery query, long timeout) throws InterruptedException, StoreAccessException
This differs from a 'select' call by insisting for a 'pull' query and allowing a wait for a non empty response. Also, if there are subscribed points, the returned values will be restricted to those points.
A 'pull' query gets point values based on the time of their last update ('version') instead of the time associated with the value ('stamp').
Note: the filtering for subscribed point values may represent a significant overhead; when appropriate, 'deliver' could provide better performance.
pull
in interface Store
query
- The store query (must be a 'pull' query).timeout
- A time limit in millis to wait for the first value
(negative for infinite).InterruptedException
- When the service is stopped.StoreAccessException
- On store access problem.Store.select(StoreValuesQuery)
,
Store.deliver(int, long)
,
Store.supportsPull()
public int purge(UUID[] pointUUIDs, TimeInterval timeInterval) throws StoreAccessException
purge
in interface Store
pointUUIDs
- The UUID of the points to purge.timeInterval
- A time interval.StoreAccessException
- On store access problem.Store.supportsPurge()
public final boolean sendUpdates() throws StoreAccessException
sendUpdates
in interface Store
StoreAccessException
- On store access problem.public boolean setUp(Metadata metadata, ProxyEntity proxyEntity)
setUp
in interface Proxied
setUp
in class Proxied.Abstract
metadata
- The metadata available to the current process.proxyEntity
- The proxy entity refering to the proxied.public boolean subscribe(Collection<UUID> points) throws StoreAccessException
This calls collects the last value for each point at the time of the subscription. These values will be available with a call to 'getSubscribedValues'.
subscribe
in interface Store
points
- The points.StoreAccessException
- On store access problem.Store.deliver(int, long)
,
Store.pull(StoreValuesQuery, long)
,
Store.getSubscribedValues()
,
Store.supportsSubscribe()
public boolean subscribe(UUID[] points) throws StoreAccessException
This calls collects the last value for each point at the time of the subscription. These values will be available with a call to 'getSubscribedValues'.
subscribe
in interface Store
points
- The points.StoreAccessException
- On store access problem.Store.deliver(int, long)
,
Store.pull(StoreValuesQuery, long)
,
Store.getSubscribedValues()
,
Store.supportsSubscribe()
public EnumSet<Externalizer.ValueType> supportedValueTypes() throws StoreAccessException
supportedValueTypes
in interface Store
StoreAccessException
- On store access problem.public boolean supportsCount() throws StoreAccessException
supportsCount
in interface Store
StoreAccessException
- On store access problem.public boolean supportsDelete() throws StoreAccessException
supportsDelete
in interface Store
StoreAccessException
- On store access problem.public boolean supportsDeliver() throws StoreAccessException
supportsDeliver
in interface Store
StoreAccessException
- On store access problem.public boolean supportsPull() throws StoreAccessException
supportsPull
in interface Store
StoreAccessException
- On store access problem.public boolean supportsPurge() throws StoreAccessException
supportsPurge
in interface Store
StoreAccessException
- On store access problem.public boolean supportsSubscribe() throws StoreAccessException
supportsSubscribe
in interface Store
StoreAccessException
- On store access problem.public void tearDown()
tearDown
in interface Proxied
tearDown
in class Proxied.Abstract
public boolean unsubscribe(UUID[] points) throws StoreAccessException
unsubscribe
in interface Store
points
- The points.StoreAccessException
- On store access problem.protected final StoreAccessException accessException(@Nonnull SessionException cause)
cause
- The cause for this.protected final void bindPoints() throws InterruptedException, StoreAccessException
InterruptedException
- When the service is stopped.StoreAccessException
- On store access problem.protected void bindPoints(@Nonnull Set<Point> points) throws InterruptedException, StoreAccessException
points
- The points.InterruptedException
- When the service is stopped.StoreAccessException
- On store access problem.protected abstract void doAddQuery(@Nonnull StoreValuesQuery query)
This provides the subclass specific implementation.
query
- The store query.@CheckReturnValue protected final int getConfirmRetries()
@CheckReturnValue protected final long getConfirmRetryDelay()
protected Logger getThisLogger()
getThisLogger
in class Proxied.Abstract
protected void reset()
protected final void setConfirmRetries()
protected final void setQueriesBatchLimit(@Nonnull Config config)
config
- The configuration.protected final void setResponseLimit(@Nonnull Config config)
config
- The configuration.@Nonnull @CheckReturnValue protected abstract String supportedValueTypeCodes() throws StoreAccessException
StoreAccessException
- On store access problem.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.