Skip to content
Snippets Groups Projects
Commit 8846a921 authored by gwen-soleil's avatar gwen-soleil
Browse files

fix regression: dynamic attributes were not created

parent e26dff50
No related branches found
No related tags found
No related merge requests found
package org.tango.server.snapextractor;
import java.lang.reflect.Array;
import fr.esrf.Tango.AttrDataFormat;
import fr.esrf.Tango.AttrWriteType;
import fr.esrf.Tango.DevFailed;
import fr.esrf.TangoDs.TimedAttrData;
import fr.soleil.archiving.common.api.tools.DbData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tango.server.StateMachineBehavior;
......@@ -11,17 +14,13 @@ import org.tango.server.attribute.AttributeValue;
import org.tango.server.attribute.IAttributeBehavior;
import org.tango.server.idl.TangoIDLUtil;
import fr.esrf.Tango.AttrDataFormat;
import fr.esrf.Tango.AttrWriteType;
import fr.esrf.Tango.DevFailed;
import fr.esrf.TangoDs.TimedAttrData;
import fr.soleil.archiving.common.api.tools.DbData;
import java.lang.reflect.Array;
public class SnapDynamicAttribute implements IAttributeBehavior {
final TimedAttrData[] timedAttrDatas;
private final Logger logger = LoggerFactory.getLogger(SnapDynamicAttribute.class);
private final AttributeConfiguration config = new AttributeConfiguration();
final TimedAttrData[] timedAttrDatas;
private final AttributeValue readValue;
public SnapDynamicAttribute(final String name, final DbData dbData) throws DevFailed {
......@@ -31,6 +30,7 @@ public class SnapDynamicAttribute implements IAttributeBehavior {
final AttributePropertiesImpl props = new AttributePropertiesImpl();
props.setLabel(dbData.getName());
config.setAttributeProperties(props);
logger.debug("create attribute {}", config);
timedAttrDatas = dbData.getDataAsTimedAttrData();
final TimedAttrData timeData = timedAttrDatas[0];
......
......@@ -660,8 +660,10 @@ public class SnapExtractor implements DBExtractionConst {
final String writeName = names[1];
int writable = -1;
for (DbData dbData : dbDatas) {
if ((dbData != null) && (dbData.getDataType() == TangoConst.Tango_DEV_STATE)) {
if ((dbData != null)) {
if ((dbData.getDataType() == TangoConst.Tango_DEV_STATE)) {
dbData.setDataType(TangoConst.Tango_DEV_LONG);
}
writable = dbData.getWritable();
}
}
......@@ -670,7 +672,6 @@ public class SnapExtractor implements DBExtractionConst {
logger.debug("read part = {}, write part = {}", readDbData, writeDbData);
// Create the attributes
if (writable == AttrWriteType._READ || writable == AttrWriteType._READ_WRITE) {
logger.debug("create attribute {}", readName);
dynMngt.addAttribute(new SnapDynamicAttribute(readName, readDbData));
}
if (writable == AttrWriteType._WRITE) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment