AttributesManager attributesManager = new AttributesManager(new AttributeFactory());
for (Device dev : configuration.getDevices()) {
String devName = dev.getName();
final Client devClient = clientsManager.getClient(devName);
for (DeviceAttribute attr : dev.getAttributes()) {
final String fullName = devName + "/" + attr.getName();
LOGGER.info("Initializing attribute " + fullName);
boolean isAttrOk = devClient.checkAttribute(attr.getName());
if (!isAttrOk) {
LOGGER.warn("DevClient reports bad attribute: " + fullName);
attributesManager.reportBadAttribute(fullName, "Attribute initialization failed.");
continue;
}
devClient.printAttributeInfo(attr.getName(), LOGGER);
try {
Class<?> attributeClass = devClient.getAttributeClass(attr.getName());
boolean isArray = devClient.isArrayAttribute(attr.getName());
attributesManager.initializeAttribute(attr, dev.getName(), devClient, attributeClass, isArray);
LOGGER.info("Initialization succeed.");
} catch (ClientException e) {
LOGGER.warn("Attribute initialization failed.", e);
attributesManager.reportBadAttribute(fullName, e.getMessage());