|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcern.cmw.rda.client.DeviceHandle
public class DeviceHandle
Allows to set, get and monitor property values in a remote device. An object of this class acts as a proxy which represents a remote device to the local client, and delegates device calls, made by the client, to the device server.
The class provides several groups of the device access methods.
cern.cmw.rda.test.special.GetSync
is an example of using the
synchronous device calls.
cern.cmw.rda.test.special.GetAsync
is an example of using the
asynchronous device calls.
callback
object.
class
is a subscription example.
The class also provides a group
of methods that
allow to obtain some information on the associated device.
Method Summary | |
---|---|
GetRequest |
createGetRequest(String propName,
String cycleSelector,
Data context,
ReplyHandler replyHandler)
|
SetRequest |
createSetRequest(String propName,
String cycleSelector,
Data value,
Data context,
ReplyHandler replyHandler)
|
Data |
get(String propName)
Reads from the device and returns the specified property value. |
GetRequest |
get(String propName,
ReplyHandler replyHandler)
Creaters and sends to the device a request to read the speciified property value. |
Data |
get(String propName,
String cycleSelector)
Reads from the device and returns the specified property value. |
Data |
get(String propName,
String cycleSelector,
Data context)
Reads from the device and returns the specified property value. |
GetRequest |
get(String propName,
String cycleSelector,
Data context,
ReplyHandler replyHandler)
Creates and sends to the device a request to read the specified property value. |
GetRequest |
get(String propName,
String cycleSelector,
ReplyHandler replyHandler)
Creates and sends to the device a request to read the speciified property value. |
String |
getClassName()
Returns the device class name. |
String |
getDeviceName()
Returns the device name. |
protected cern.cmw.rda.client.ServerConnection |
getServerConnection(RDAService.ListOperationType operation)
|
static void |
main(String[] args)
For tests. |
void |
monitorOff(SubscriptionRequest subscription)
Cancels a data subscription initiated by the specified request. |
SubscriptionRequest |
monitorOn(String propName,
boolean onChange,
ReplyHandler replyHandler)
Starts a subscription on the specified property value. |
SubscriptionRequest |
monitorOn(String propName,
String cycleSelector,
boolean onChange,
ReplyHandler replyHandler)
Starts a subscription on the specified property value. |
SubscriptionRequest |
monitorOn(String propName,
String cycleSelector,
boolean onChange,
ReplyHandler replyHandler,
Data context)
Starts a subscription on the specified property value. |
void |
set(String propName,
Data value)
Changes the value of the specified property. |
SetRequest |
set(String propName,
Data value,
ReplyHandler replyHandler)
Creates and sends to the device a request to change the value of the specified property. |
void |
set(String propName,
String cycleSelector,
Data value)
Changes the value of the specified property. |
void |
set(String propName,
String cycleSelector,
Data value,
Data context)
Changes the value of the specified property. |
SetRequest |
set(String propName,
String cycleSelector,
Data value,
Data context,
ReplyHandler replyHandler)
Creates an sends to the device a request to change the value of the specified property. |
SetRequest |
set(String propName,
String cycleSelector,
Data value,
ReplyHandler replyHandler)
Creates and sends to the device a request to change the value of the specified property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected cern.cmw.rda.client.ServerConnection getServerConnection(RDAService.ListOperationType operation)
public String getDeviceName()
getDeviceName
in interface IDeviceHandle
public String getClassName() throws TimeOut, NoConnection, InternalException
getClassName
in interface IDeviceHandle
TimeOut
NoConnection
InternalException
public Data get(String propName) throws BadParameter, TimeOut, NoConnection, InternalException, IOError, NoPermission
This method is equivalent to the basic synchronous
get(String, String, Data)
call with cycleSelector
and
context
arguments equal to null
.
get
in interface IDeviceHandle
BadParameter
TimeOut
NoConnection
InternalException
IOError
NoPermission
public Data get(String propName, String cycleSelector) throws BadParameter, TimeOut, NoConnection, InternalException, IOError, NoPermission
This method is equivalent to the basic synchronous
get(String, String, Data)
call with the null
context
argument.
get
in interface IDeviceHandle
BadParameter
TimeOut
NoConnection
InternalException
IOError
NoPermission
public Data get(String propName, String cycleSelector, Data context) throws BadParameter, TimeOut, NoConnection, IOError, InternalException, NoPermission
get
in interface IDeviceHandle
propName
- the property namecycleSelector
- the cycle identifiercontext
- the operation context
BadParameter
- thrown if any of the call arguments has an illegal value
TimeOut
- thrown if the operation has been timed out
NoConnection
- thrown if the device server is currently unreachable
IOError
- thrown if an I/O error occured during the call execution in the remote
device
InternalException
- thrown if the call fails due to some internal RDA error, or if the method
implementation in the device server throws an unexpected exception.
NoPermission
- Thrown in case of RBAC-related complications. More information can be obtained
through downcasting or obtaining the error message of exception.
Possible exception types of this kind are: AccessDenied, BadToken and TokenExpiredpublic void set(String propName, Data value) throws BadParameter, TimeOut, NoConnection, IOError, InternalException, NoPermission
This method is equivalent to the basic synchronous
set(String, String, Data, Data)
call with the cycleSelector
and context
arguments equal to null
.
set
in interface IDeviceHandle
BadParameter
TimeOut
NoConnection
IOError
InternalException
NoPermission
public void set(String propName, String cycleSelector, Data value) throws BadParameter, TimeOut, NoConnection, IOError, InternalException, NoPermission
This method is equivalent to the basic synchronous
set(String, String, Data, Data)
call with the context
argument equal to null
.
set
in interface IDeviceHandle
BadParameter
TimeOut
NoConnection
IOError
InternalException
NoPermission
public void set(String propName, String cycleSelector, Data value, Data context) throws BadParameter, TimeOut, NoConnection, IOError, InternalException, NoPermission
set
in interface IDeviceHandle
propName
- the property namecycleSelector
- the cycle identifiervalue
- the value to setcontext
- the operation context
BadParameter
- thrown if any of the call arguments has an illegal value
TimeOut
- thrown if the operation has been timed out
NoConnection
- thrown if the device server is currently unreacheable
IOError
- thrown if an I/O error occured during the call execution in the remote
device
InternalException
- thrown if the call fails due to some internal RDA error, or if the method
implementation in the device server throws an unexpected exception.
NoPermission
- Thrown in case of RBAC-related complications. More information can be obtained
through downcasting or obtaining the error message of exception.
Possible exception types of this kind are: AccessDenied, BadToken and TokenExpiredpublic GetRequest get(String propName, ReplyHandler replyHandler) throws BadParameter, NoConnection, InternalException
This method is equivalent to the basic asynchronous
get(String, String, Data, ReplyHandler)
call with cycleSelector
and
context
arguments equal to null
.
get
in interface IDeviceHandle
BadParameter
NoConnection
InternalException
public GetRequest get(String propName, String cycleSelector, ReplyHandler replyHandler) throws BadParameter, NoConnection, InternalException
This method is equivalent to the basic asynchronous
get(String, String, Data, ReplyHandler)
call with the null
context
argument.
get
in interface IDeviceHandle
BadParameter
NoConnection
InternalException
public GetRequest get(String propName, String cycleSelector, Data context, ReplyHandler replyHandler) throws BadParameter, NoConnection, InternalException
GetRequest
for the detailed description
of actions in this phase.
get
in interface IDeviceHandle
propName
- the property namecycleSelector
- the cycle identifiercontext
- the operation contextreplyHandler
- the "callback" object that will be notified on the
operation results.
BadParameter
- thrown if any of the call arguments has an illegal value
NoConnection
- thrown if the device server is currently unreachable
InternalException
- thrown to indicate an internal RDA error; for example,
lack of memory to create the operation request..public SetRequest set(String propName, Data value, ReplyHandler replyHandler) throws BadParameter, NoConnection, InternalException, NoPermission
This method is equivalent to the basic asynchronous
set(String, String, Data, Data, ReplyHandler)
call with the cycleSelector
and context
arguments equal to null
.
set
in interface IDeviceHandle
BadParameter
NoConnection
InternalException
NoPermission
public SetRequest set(String propName, String cycleSelector, Data value, ReplyHandler replyHandler) throws BadParameter, NoConnection, InternalException
This method is equivalent to the basic synchronous
set(String, String, Data, Data)
call with the context
argument equal to null
.
set
in interface IDeviceHandle
BadParameter
NoConnection
InternalException
public SetRequest set(String propName, String cycleSelector, Data value, Data context, ReplyHandler replyHandler) throws BadParameter, NoConnection, InternalException
SetRequest
for the detailed description of actions in
this phase.
set
in interface IDeviceHandle
propName
- the property namecycleSelector
- the cycle identifiervalue
- the value to setcontext
- the operation contextreplyHandler
- the "callback" object that will be notified on the
operation results.
BadParameter
- thrown if any of the call arguments has an illegal value
NoConnection
- thrown if the device server is currently unreachable
InternalException
- indicates an internal RDA error; for example,
lack of memory to create the operation requestpublic SubscriptionRequest monitorOn(String propName, boolean onChange, ReplyHandler replyHandler) throws BadParameter, NoConnection, TimeOut, IOError, InternalException, NoPermission
This method is equivalent to the basic
monitorOn(String, String, boolean, ReplyHandler, Data)
call with the cycleSelector
and context
arguments equal to null
.
monitorOn
in interface IDeviceHandle
BadParameter
NoConnection
TimeOut
IOError
InternalException
NoPermission
public SubscriptionRequest monitorOn(String propName, String cycleSelector, boolean onChange, ReplyHandler replyHandler) throws BadParameter, NoConnection, TimeOut, IOError, InternalException, NoPermission
This method is equivalent to the basic
monitorOn(String, String, boolean, ReplyHandler, Data)
call with context
argument equal to null
.
monitorOn
in interface IDeviceHandle
BadParameter
NoConnection
TimeOut
IOError
InternalException
NoPermission
public SubscriptionRequest monitorOn(String propName, String cycleSelector, boolean onChange, ReplyHandler replyHandler, Data context) throws BadParameter, NoConnection, TimeOut, IOError, InternalException, NoPermission
If a monitorOn call completes successfully then the ReplyHandler object
specified as an argument to the call will be notified each time the
subscribed value is updated or an attempt to update the value fails due
to an I/O error (see SubscriptionRequest
for
the description of notification methods that can be invoked as a result
of this call).
If "on-change" mode has been specified in the call then only the value which is different from the previous one will be reported to the client.
monitorOn is a blocking call that propagates down to the device server. On the server side, it installs a "monitor" on the specified value. Each monitor takes some resources (CPU time, memory, I/O bandwidth) in the server. The call fails if the monitor cannot be installed due to lack of the resources.
On success, the call returns a reference to the SubscriptionRequest object sent to the server. The subscription can be cancelled using the #monitorOff call with this object as an argument.
monitorOn
in interface IDeviceHandle
propName
- the property namecycleSelector
- the cycle identifier (can be null
).onChange
- the subscription mode: "on-change", if true
replyHandler
- the "callback" object where to deliver the subscription
resultscontext
- the subscription context (can be null
).
BadParameter
- thrown if any of the call arguments has an illegal value
NoConnection
- thrown if the device server is currently unreacheable
TimeOut
- thrown if the operation has been timed out. You can safely retry a timed
out call.
IOError
- thrown if an I/O error occured during the call execution in the remote
device
InternalException
- thrown if the call fails due to some internal RDA error, or if the method
implementation in the device server throws an unexpected exception.
NoPermission
- Thrown in case of RBAC-related complications. More information can be obtained
through downcasting or obtaining the error message of exception.
Possible exception types of this kind are: AccessDenied, BadToken and TokenExpiredSubscriptionRequest
public void monitorOff(SubscriptionRequest subscription) throws BadParameter, TimeOut
This is a blocking call that propagates down to the device server. In case of timeout, the subscription remains active in the client and may or may not be removed in the server. You can retry the call to definitely remove the server side monitor.
In principle, each monitorOn
call should have a matching
monitorOff
: this allows to optimize resource utilization
on the client and server side. However, an uncancelled subscription
does not result in an irreversible resource leak: all monitors installed
by a client will be automatically removed in connected servers when the
client terminates.
monitorOff
in interface IDeviceHandle
BadParameter
- thrown if the specified subscription has already been cancelled
TimeOut
- thrown if the operation has been timed out.SubscriptionRequest
public GetRequest createGetRequest(String propName, String cycleSelector, Data context, ReplyHandler replyHandler) throws BadParameter, InternalException, NoPermission
BadParameter
InternalException
NoPermission
public SetRequest createSetRequest(String propName, String cycleSelector, Data value, Data context, ReplyHandler replyHandler) throws BadParameter, InternalException, NoPermission
BadParameter
InternalException
NoPermission
public static void main(String[] args)
> java cern.cmw.rda.client.DeviceHandle TST.DEV1
Device located on server 'dmcrtest'
The server is up and running
> java cern.cmw.rda.client.DeviceHandle TT40.BIC
Device located on server 'ibsba4'
The server is down or unreachable
> java cern.cmw.rda.client.DeviceHandle abba
Device not found in the system
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |