public final class RMIStore extends AbstractStore implements SessionProxy.Listener
This class provides a client side access to an RMI Store.
Proxied.Abstract
QUERIES_BATCH_LIMIT_PROPERTY, RESPONSE_LIMIT_PROPERTY
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 |
---|
RMIStore() |
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
confirm(PointValue pointValue,
boolean confirmValue)
Confirms a point value.
|
void |
connect()
Connects.
|
StoreValues |
deliver(int limit,
long timeout)
Delivers subscribed point values from store update events.
|
protected void |
doAddQuery(StoreValuesQuery query)
Does add a store query for point values.
|
Optional<Exception[]> |
getExceptions()
Gets the exceptions.
|
Optional<StoreValues[]> |
getSubscribedValues()
Gets the values from the subscribed call.
|
void |
impersonate(Optional<String> user)
Impersonates an other user.
|
Iterable<PointValue> |
iterate(StoreValuesQuery query)
Iterates on the point values returned for a store query.
|
Optional<StoreValues> |
nextValues()
Returns the next store values to our store queries.
|
boolean |
onSessionConnected(SessionProxy sessionProxy)
Called when the session is connected.
|
void |
onSessionDisconnected(SessionProxy sessionProxy)
Called when the session is disconnected.
|
boolean |
probe()
Probes the state of the store session.
|
StoreValues |
pull(StoreValuesQuery query,
long timeout)
Pulls points values.
|
int |
purge(UUID[] pointUUIDs,
TimeInterval timeInterval)
Purges point values.
|
protected void |
reset()
Resets.
|
StoreValues |
select(StoreValuesQuery query)
Selects the store values for a store query.
|
boolean |
sendUpdates(Collection<PointValue> updates)
Sends updates.
|
boolean |
setUp(Metadata metadata,
ProxyEntity proxyEntity)
Sets up the instance for action.
|
boolean |
subscribe(UUID[] points)
Subscribes to point values store update events.
|
protected String |
supportedValueTypeCodes()
Returns a string of supported value type codes.
|
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 |
supportsSubscribe()
Asks if this store supports subscribe.
|
boolean |
unsubscribe(UUID[] points)
Unsubscribes from points values events.
|
accessException, addQuery, addUpdate, bind, bindPoints, compareTo, getConfirmRetries, getConfirmRetryDelay, getQueriesBatchLimit, getResponseLimit, getThisLogger, getUpdateCount, getUpdates, getUUID, isNullRemoves, sendUpdates, setConfirmRetries, setQueriesBatchLimit, setResponseLimit, subscribe, supportedValueTypes, supportsPurge, tearDown
getMetadata, getName, getParams, getProxyEntity
public boolean canConfirm()
canConfirm
in interface Store
canConfirm
in class AbstractStore
public void close()
May be called redundantly.
close
in interface Store
close
in class AbstractStore
public boolean confirm(PointValue pointValue, boolean confirmValue) throws InterruptedException, StoreAccessException
confirm
in interface Store
confirm
in class AbstractStore
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 void connect() throws StoreAccessException
connect
in interface Store
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
deliver
in class AbstractStore
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 Optional<Exception[]> getExceptions()
getExceptions
in interface Store
public Optional<StoreValues[]> getSubscribedValues()
getSubscribedValues
in interface Store
getSubscribedValues
in class AbstractStore
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
impersonate
in class AbstractStore
user
- The other user (empty string for anonymous, empty to cancel).StoreAccessException
- On store access problem.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.
iterate
in interface Store
iterate
in class AbstractStore
query
- The store query.public Optional<StoreValues> nextValues() throws InterruptedException, StoreAccessException
Any pending query is first sent.
nextValues
in interface Store
InterruptedException
- When the service is stopped.StoreAccessException
- On store access problem.public boolean onSessionConnected(SessionProxy sessionProxy)
onSessionConnected
in interface SessionProxy.Listener
sessionProxy
- The session proxy.public void onSessionDisconnected(SessionProxy sessionProxy)
onSessionDisconnected
in interface SessionProxy.Listener
sessionProxy
- The session proxy.public boolean probe() throws StoreAccessException
probe
in interface Store
StoreAccessException
- On store access problem.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
pull
in class AbstractStore
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
purge
in class AbstractStore
pointUUIDs
- The UUID of the points to purge.timeInterval
- A time interval.StoreAccessException
- On store access problem.Store.supportsPurge()
public StoreValues select(StoreValuesQuery query) throws InterruptedException, StoreAccessException
The processing of the query must not interfere with the batch operation mode.
select
in interface Store
query
- The store query.InterruptedException
- When the service is stopped.StoreAccessException
- On store access problem.public boolean sendUpdates(Collection<PointValue> updates) throws StoreAccessException
sendUpdates
in interface Store
updates
- The updates to send.StoreAccessException
- On store access problem.public boolean setUp(Metadata metadata, ProxyEntity proxyEntity)
setUp
in interface Proxied
setUp
in class AbstractStore
metadata
- The metadata available to the current process.proxyEntity
- The proxy entity refering to the proxied.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
subscribe
in class AbstractStore
points
- The points.StoreAccessException
- On store access problem.Store.deliver(int, long)
,
Store.pull(StoreValuesQuery, long)
,
Store.getSubscribedValues()
,
Store.supportsSubscribe()
public boolean supportsCount() throws StoreAccessException
supportsCount
in interface Store
supportsCount
in class AbstractStore
StoreAccessException
- On store access problem.public boolean supportsDelete() throws StoreAccessException
supportsDelete
in interface Store
supportsDelete
in class AbstractStore
StoreAccessException
- On store access problem.public boolean supportsDeliver() throws StoreAccessException
supportsDeliver
in interface Store
supportsDeliver
in class AbstractStore
StoreAccessException
- On store access problem.public boolean supportsPull() throws StoreAccessException
supportsPull
in interface Store
supportsPull
in class AbstractStore
StoreAccessException
- On store access problem.public boolean supportsSubscribe() throws StoreAccessException
supportsSubscribe
in interface Store
supportsSubscribe
in class AbstractStore
StoreAccessException
- On store access problem.public boolean unsubscribe(UUID[] points) throws StoreAccessException
unsubscribe
in interface Store
unsubscribe
in class AbstractStore
points
- The points.StoreAccessException
- On store access problem.protected void bindPoints(Set<Point> points) throws InterruptedException, StoreAccessException
bindPoints
in class AbstractStore
points
- The points.InterruptedException
- When the service is stopped.StoreAccessException
- On store access problem.protected void doAddQuery(StoreValuesQuery query)
This provides the subclass specific implementation.
doAddQuery
in class AbstractStore
query
- The store query.protected void reset()
reset
in class AbstractStore
protected String supportedValueTypeCodes() throws StoreAccessException
supportedValueTypeCodes
in class AbstractStore
StoreAccessException
- On store access problem.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.