Directory Service UseAs a first step, usually some DirectoryItem object must be acquired with a
static call like:
After this you can get details about the object with statements like:
Strings returned by methods are in whatever case found in the database.
/**
* Subscribe to data for all devices of an accelerator and renew the display
* when new data come in.
*/
public static void testSkeleton(String accelerator) {
WorkSet wset;
MetaProperty[] metaprops;
DeviceGroup[] groups;
ControlDevice[] devices;
DeviceGroup group;
ControlDeviceClass cls;
int prog = ControlDeviceClass.PROG_DISPLAY;
int groupno, deviceno;
try {
wset = WorkSet.getWorkSetByQuery("accelerator="+accelerator);
groups = wset.getDeviceGroups();
for(groupno=0; groupno<=wset.getGroupCount(); groupno++) {
group = groups[groupno];
cls = group.getDeviceClass();
metaProps = cls.getMetaProperties(prog);
// Now initialise some display structure for the group
String[] subscriptionProps = MetaProperty.getSubscriptionProperties(prog);
devices = group.getControlDeviceArray();
for (int deviceno=0; deviceno<=group.getGroupDeviceCount(groupno); deviceno++) {
ControlDevice device = wset.getControlDevice(groupno, deviceno);
// Subscribe to get data for device and subscription properties
}
}
// In an endless loop, wait for subscribed data and update the display structures
} catch(DataNotFoundException ex) {
// Do suitable exception handling
}
}