|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcern.cmw.rda.client.RDAService
public class RDAService
Manages communications with remote devices and serves as a factory for DeviceHandle objects.
The RDAService class is a Singleton class, in that only one instance of the class is allowed per client. It is created when a client invokes the static init method of the class for the first time. If the initialization fails for some reason then a CmwInternalError will be thrown.
DeviceHandle
Nested Class Summary | |
---|---|
protected static class |
RDAService.ListOperationType
|
Nested classes/interfaces inherited from interface cern.cmw.rda.client.IRDAService |
---|
IRDAService.GetElement, IRDAService.SubscriptionResult |
Field Summary | |
---|---|
static boolean |
DEBUG
|
static boolean |
DEBUG_ARRAY_CALLS
|
static String |
RBAC_TOKEN_TAG
|
Method Summary | |
---|---|
static Data |
addTokenToCtx(Data ctx,
byte[] fullToken)
Method allows insertion of RBAToken to the Data object that can be later used as a credential context to the specific operation. |
static Data |
addTokenToCtx(Data ctx,
byte[] token,
byte[] signature)
Method allows insertion of RBAToken to the Data object that can be later used as a credential context to the specific operation. |
DeviceHandle |
getDeviceHandle(String deviceName)
Returns a handle for the device identified by the specified name. |
static Data |
getServiceContext()
Returns a copy of the RDA service context. |
static RDAService |
init()
Returns a reference to the RDAService singleton. |
static boolean |
initialized()
Returns true if the RDA service has been initialized. |
List<IRDAService.GetElement> |
listGet(List<String> parameters,
String cycleSelector)
Performs an optimized (bulk) call for multiple get operation. |
List<IRDAService.GetElement> |
listGet(List<String> parameters,
String cycleSelector,
Data context)
Performs an optimized (bulk) call for multiple get operation. |
List<String> |
listSet(List<String> parameters,
List<Data> values,
String cycleSelector)
Performs an optimized (bulk) call for multiple set operation. |
List<String> |
listSet(List<String> parameters,
List<Data> values,
String cycleSelector,
Data context)
Performs an optimized (bulk) call for multiple set operation. |
List<IRDAService.SubscriptionResult> |
listSubscribe(List<String> parameters,
String cycleSelector,
Data context,
ReplyHandler replyHandler)
Performs an optimized (bulk) call for multiple subscriptions, possibly with context. |
List<IRDAService.SubscriptionResult> |
listSubscribe(List<String> parameters,
String cycleSelector,
ReplyHandler replyHandler)
Performs an optimized (bulk) call for multiple subscriptions. |
void |
listUnsubscribe(List<ISubscriptionRequest> requests)
Performs an optimized (bulk) cancellation for multiple subscriptions. |
static void |
main(String[] args)
For tests. |
void |
send(GetRequest[] requests)
Submits for execution a group of requests to read property values. |
void |
send(SetRequest[] requests)
Submits for execution a group of requests to set property values. |
void |
setRBACToken(byte[] token)
Allows to set the RBAC token on all connections (it will be also sent when establishing a connection to the new server) |
static void |
setServiceContext(Data ctx)
Fills in the RDA service context with contents of the specified Data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String RBAC_TOKEN_TAG
public static boolean DEBUG
public static boolean DEBUG_ARRAY_CALLS
Method Detail |
---|
public static RDAService init()
public void setRBACToken(byte[] token) throws BadToken, TokenExpired
setRBACToken
in interface IRDAService
token
- The encoded RBAC token (together with its signature), or null
BadToken
- Token is malformed
TokenExpired
- Token is expiredpublic static boolean initialized()
true
if the RDA service has been initialized.
public static Data addTokenToCtx(Data ctx, byte[] fullToken)
fullToken
- Serialized RBAC token, fields together with signaturectx
- Data object to insert serialized token to
public static Data addTokenToCtx(Data ctx, byte[] token, byte[] signature)
token
- Serialized RBAC tokensignature
- Serialized RBAC token signaturectx
- Data object to insert serialized token to
public static void setServiceContext(Data ctx) throws InternalException
init
call). The service
context cannot be changed after the service has been initialized.
InternalException
- indicates an attempt to change context of the initialized service
\todo Real documentation: what is the service context and how it can be
accessed on the server side (rdaClientInfo).public static Data getServiceContext()
setServiceContext
public DeviceHandle getDeviceHandle(String deviceName) throws BadParameter, InternalException
getDeviceHandle
in interface IRDAService
BadParameter
- thrown to indicate that the device name is unknown in the system
InternalException
- thrown if the device could not be located due to an internal RDA
errorpublic List<IRDAService.SubscriptionResult> listSubscribe(List<String> parameters, String cycleSelector, ReplyHandler replyHandler) throws BadParameter, InternalException
listSubscribe
in interface IRDAService
BadParameter
- thrown to indicate that some parameter is malformed or does not
describe a valid device/property pair
InternalException
- thrown if the device could not be located due to an internal RDA
errorpublic List<IRDAService.SubscriptionResult> listSubscribe(List<String> parameters, String cycleSelector, Data context, ReplyHandler replyHandler) throws BadParameter, InternalException
listSubscribe
in interface IRDAService
BadParameter
- thrown to indicate that some parameter is malformed or does not
describe a valid device/property pair
InternalException
- thrown if the device could not be located due to an internal RDA
errorpublic void listUnsubscribe(List<ISubscriptionRequest> requests) throws BadParameter
listUnsubscribe
in interface IRDAService
BadParameter
public List<IRDAService.GetElement> listGet(List<String> parameters, String cycleSelector) throws BadParameter
IRDAService
listGet
in interface IRDAService
BadParameter
public List<IRDAService.GetElement> listGet(List<String> parameters, String cycleSelector, Data context) throws BadParameter
listGet
in interface IRDAService
BadParameter
public List<String> listSet(List<String> parameters, List<Data> values, String cycleSelector) throws BadParameter
IRDAService
listSet
in interface IRDAService
BadParameter
public List<String> listSet(List<String> parameters, List<Data> values, String cycleSelector, Data context) throws BadParameter
listSet
in interface IRDAService
BadParameter
public void send(GetRequest[] requests) throws BadParameter, InternalException
requests
- the array of request objects to be sent to devices
BadParameter
- if the requests array contains a null
value
InternalException
- if the method fails due to some internal RDA error; for
example, due to lack of memory.
createGetRequest
public void send(SetRequest[] requests) throws BadParameter, InternalException
requests
- the array of request objects to be sent to devices
BadParameter
- if the requests array contains a null
value
InternalException
- if the method fails due to some internal RDA error; for
example, due to lack of memory.
createSetRequest
public static void main(String[] args)
init
call.
public static void main(String[] args)
{
System.out.print("Initializing RDAService...");
try
{
long start = System.currentTimeMillis();
RDAService.init();
long stop = System.currentTimeMillis();
System.out.println(" done in "+(stop - start)+" ms");
}
catch(Throwable ex)
{
System.out.println(" error");
ex.printStackTrace();
}
System.exit(0);
}
Strictly speaking, the real execution time (the time needed to execute
bytecode) is only a small fraction of the measured time (typically, less
than 10%). Most of the time is spent loading RDA and CORBA classes.
This, depending on your environment and the JVM, may take up to several
seconds.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |