cern.cmw.rda.client.group
Class DeviceGroup

java.lang.Object
  extended by cern.cmw.rda.client.group.DeviceGroup

public class DeviceGroup
extends Object

Allows to do get/set/subscribe operations on a group of devices, similary to DeviceHandle, which allows get/set/monitorOn operations on a single device (subscribe offers the same behaviour as in the Subscription class rather than that of the DeviceHandle). The purpose of this class is to create convenience methods to deal with groups of devices of same class. No effort has been made to optimize performance by actually grouping the communication, something we do not consider necessary today.

Author:
kostro

Constructor Summary
DeviceGroup(String[] deviceNames)
          Constructor.
 
Method Summary
 CmwException[] getDeviceExceptions()
          Returns exceptions thrown when creating deviceHandle's for this group.
 String[] getDeviceNames()
          Returns names of devices in this group as an String array.
static void main(String[] args)
          For tests. the format of the command is: property [deviceName, deviceName, ...]
 void subscribe(String propertyName, String cycleSelector, boolean onChange, Data[] context, GroupUpdateHandler replyHandler)
          Starts subscription on this group of devices.
 void unsubscribe()
          Cancels all subscriptions on this group and releases resources;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeviceGroup

public DeviceGroup(String[] deviceNames)
Constructor. Creates device group from array of strings each being a device name. This constructor will always succeed but if an exception occurs when creating a device handle, it will be remembered and returned or thrown as result of get/set/subscribe operation for this device.

Method Detail

getDeviceNames

public String[] getDeviceNames()
Returns names of devices in this group as an String array. The order is the same as the one used to create this group.


getDeviceExceptions

public CmwException[] getDeviceExceptions()
Returns exceptions thrown when creating deviceHandle's for this group. The index of exception is this of the device name for which exception was thrown. If no exception was thrown null array is returned.


subscribe

public void subscribe(String propertyName,
                      String cycleSelector,
                      boolean onChange,
                      Data[] context,
                      GroupUpdateHandler replyHandler)
Starts subscription on this group of devices. This call defines and starts subscriptions for each individual device. The results (updates, exceptions etc. are delivered via the GroupUpdateHandler interface.

See Also:
GroupUpdateHandler

unsubscribe

public void unsubscribe()
Cancels all subscriptions on this group and releases resources;


main

public static void main(String[] args)
For tests. the format of the command is: property [deviceName, deviceName, ...] [value, value, ...] cycleSelector



Copyright © 2007 CERN. All Rights Reserved.