public static interface TopicUpdateControl.Updater
An Updater can be used to send any number of updates.
For exclusive updating the updater is provided by the
TopicUpdateControl.UpdateSource.onActive(String, TopicUpdateControl.Updater)
callback. The topics that may be updated are determined by the topic path
used to register the parent TopicUpdateControl.UpdateSource
.
For non exclusive updating the updater is provided by the
TopicUpdateControl.updater()
method and may be used to update any
topic that the session is authorised to update.
A successful update will result in onSuccess
being called.
Should an update fail, onError
will be called with an ErrorReason
value indicating the
cause of the problem.
If the Updater is used when it's in an invalid state, such as when the
parent TopicUpdateControl.UpdateSource
enters a standby
or closed
state, onError
will be
called.
Modifier and Type | Interface and Description |
---|---|
static interface |
TopicUpdateControl.Updater.UpdateCallback
Callback for update operations.
|
static interface |
TopicUpdateControl.Updater.UpdateContextCallback<C>
Contextual callback for update operations.
|
Modifier and Type | Method and Description |
---|---|
<C> void |
update(String topicPath,
Bytes data,
C context,
TopicUpdateControl.Updater.UpdateContextCallback<C> callback)
Updates a topic, with an attached context object.
|
void |
update(String topicPath,
Bytes data,
TopicUpdateControl.Updater.UpdateCallback callback)
Updates a topic with a
Bytes value. |
<C> void |
update(String topicPath,
CharSequence data,
C context,
TopicUpdateControl.Updater.UpdateContextCallback<C> callback)
Updates a topic, with an attached context object.
|
void |
update(String topicPath,
CharSequence data,
TopicUpdateControl.Updater.UpdateCallback callback)
Updates a topic.
|
<C> void |
update(String topicPath,
Update update,
C context,
TopicUpdateControl.Updater.UpdateContextCallback<C> callback)
Updates a topic with a context callback.
|
void |
update(String topicPath,
Update update,
TopicUpdateControl.Updater.UpdateCallback callback)
Updates a topic.
|
<V> TopicUpdateControl.ValueUpdater<V> |
valueUpdater(Class<V> valueClass)
Returns an updater that can be used for a specified data type to
apply live value updates.
|
<V> TopicUpdateControl.ValueUpdater<V> valueUpdater(Class<V> valueClass) throws IllegalArgumentException
V
- the value type classvalueClass
- the value type class. This must correspond to the
DataType
of the topic type
of topics
that are to be updated using the updater. For example, for a
JSON
topic this would be specified as
JSON.class.IllegalArgumentException
- if any parameter is null or if
valueClass
is not supportedvoid update(String topicPath, Bytes data, TopicUpdateControl.Updater.UpdateCallback callback) throws IllegalArgumentException, SessionClosedException
Bytes
value.
The value supplied must be a value compatible with the type of topic
being updated. For example, for a JSON
topic
the data should be a JSON
value.
Note : this method does not cache values and so should never
be used to update a topic that is also being updated using a
TopicUpdateControl.ValueUpdater
.
For RECORD
or SINGLE_VALUE
topics a Content
object can be supplied and
this is equivalent to supplying an Update
created using
ContentUpdateFactory.update(Content)
to
update(String, Update, UpdateCallback)
.
topicPath
- identifies the topic to updatedata
- the data to use for the updatecallback
- the callback for notifications on the update requestIllegalArgumentException
- if any arguments are nullSessionClosedException
- if the session is closed<C> void update(String topicPath, Bytes data, C context, TopicUpdateControl.Updater.UpdateContextCallback<C> callback) throws IllegalArgumentException, SessionClosedException
As update(String, Bytes, UpdateCallback)
but with an
optional context object.
C
- the context typetopicPath
- identifies the topic to updatedata
- the data to use for the updatecontext
- the context to supply to callback notifications. May
be null.callback
- the callback for notifications on the update requestIllegalArgumentException
- if any arguments other than
context
are nullSessionClosedException
- if the session is closedvoid update(String topicPath, Update update, TopicUpdateControl.Updater.UpdateCallback callback) throws IllegalArgumentException, SessionClosedException
Subscribers will be notified of the change to the topic state in a manner appropriate to the topic type.
Updates may be created using a suitable UpdateFactory
. The
updateFactory
method
may be used to obtain an instance of the factory required.
topicPath
- identifies the topic to updateupdate
- the details of the update to be performedcallback
- the callback for notifications on the update requestIllegalArgumentException
- if any arguments are nullSessionClosedException
- if the session is closed<C> void update(String topicPath, Update update, C context, TopicUpdateControl.Updater.UpdateContextCallback<C> callback) throws IllegalArgumentException, SessionClosedException
Subscribers will be notified of the change to the topic in a manner appropriate to the topic type.
Updates may be created using a suitable UpdateFactory
. The
updateFactory
method
may be used to obtain an instance of the factory required.
C
- the context typetopicPath
- identifies the topic to updateupdate
- the details of the update to be performedcontext
- the context to supply to callback notifications. May
be nullcallback
- the callback for notifications on the update requestIllegalArgumentException
- if any arguments other than
context
are nullSessionClosedException
- if the session is closedvoid update(String topicPath, CharSequence data, TopicUpdateControl.Updater.UpdateCallback callback) throws IllegalArgumentException, SessionClosedException
This is a convenience method which is equivalent to supplying an
Update
created using
ContentUpdateFactory.update(Content)
with content created
using ContentFactory.newContent(CharSequence)
to
update(String, Update, UpdateCallback)
.
topicPath
- identifies the topic to updatedata
- the string data to use for the updatecallback
- the callback for notifications on the update requestIllegalArgumentException
- if any arguments are nullSessionClosedException
- if the session is closed<C> void update(String topicPath, CharSequence data, C context, TopicUpdateControl.Updater.UpdateContextCallback<C> callback) throws IllegalArgumentException, SessionClosedException
This is a convenience method which is equivalent to supplying an
Update
created using
ContentUpdateFactory.update(Content)
with content created
using ContentFactory.newContent(CharSequence)
to
update(String, Update, Object, UpdateContextCallback)
.
C
- the context typetopicPath
- identifies the topic to updatedata
- the string data to use for the updatecontext
- the context to supply to callback notifications. May
be null.callback
- the callback for notifications on the update requestIllegalArgumentException
- if any arguments other than
context
are nullSessionClosedException
- if the session is closedCopyright © 2016 Push Technology Ltd. All Rights Reserved.