Skip to content
Snippets Groups Projects
Commit dd1952aa authored by Guillaume PICHON's avatar Guillaume PICHON
Browse files

Correction of the init command. Lists where not emptied during the delete and...

Correction of the init command. Lists where not emptied during the delete and a method of JTango is bugged, a workarround is used.
parent bfc1048a
Branches main
No related tags found
No related merge requests found
target
.svn
*/.svn/*
bin
.project
.settings
.classpath
......@@ -12,7 +12,7 @@
<groupId>fr.soleil.deviceservers</groupId>
<artifactId>AttributeListWriter</artifactId>
<version>2.1.10</version>
<version>2.1.11</version>
<name>Attribute List Writer</name>
<description>Attribute List Writer Device Server</description>
<developers>
......
......@@ -7,12 +7,14 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.StringTokenizer;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.apache.commons.lang3.tuple.Triple;
import org.slf4j.Logger;
......@@ -234,7 +236,8 @@ public final class AttributeListWriter implements IAuditListener {
@Override
public void getFallback() throws DevFailed {
partialDelete();
dynMngt.clearAttributesWithExclude("log");
// dynMngt.clearAttributesWithExclude("log"); //It doesn't work, a workaround is used until debug.
clearAttributesWithExclude("log");
}
@Override
......@@ -246,6 +249,28 @@ public final class AttributeListWriter implements IAuditListener {
}
}
private void clearAttributesWithExclude(final String... exclude) throws DevFailed {
final String[] toExclude = new String[exclude.length];
for (int i = 0; i < toExclude.length; i++) {
toExclude[i] = exclude[i].toLowerCase(Locale.ENGLISH);
}
final List<String> attributes = new ArrayList<>(dynMngt.getDynamicAttributes().size());
dynMngt.getDynamicAttributes().forEach(attr -> {
try {
attributes.add(attr.getConfiguration().getName());
} catch (DevFailed e) {
logger.error("Attribute removal error.", e);
}
});
for (final String attributeName : attributes) {
if (!ArrayUtils.contains(toExclude, attributeName)) {
dynMngt.removeAttribute(attributeName);
}
}
}
/**
* check if the attributs are scalar, writable and create TangoAttribute
*
......@@ -398,6 +423,8 @@ public final class AttributeListWriter implements IAuditListener {
lastError = "";
executedCommand = "";
executedTimeStamp = "";
preWritingTripleList.clear();
postWritingTripleList.clear();
if (stateReader != null) {
stateReader.stop();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment