Skip to content
Snippets Groups Projects
Commit d011aa4b authored by Gwenaelle ABEILLE's avatar Gwenaelle ABEILLE
Browse files

Merge branch 'TANGOARCH-939' into 'master'

Added getAttributesConfList(final String attributePattern)

Closes TANGOARCH-939

See merge request !6
parents b1109911 46c16125
Branches
No related tags found
1 merge request!6Added getAttributesConfList(final String attributePattern)
......@@ -12,9 +12,7 @@ import org.tango.server.attribute.log.LogAttribute;
import org.tango.server.dynamic.DynamicManager;
import org.tango.utils.DevFailedUtils;
import java.util.Arrays;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.*;
/**
* Class Description: Device of Archiving system <Br>
......@@ -402,6 +400,7 @@ public class ArchivingManager {
* archiving for the specified attributes, and following the specified mode.
* The configuration is given as a JSON array and you may specify a context id
* by adding a <code>;contextId</code> at the end of your input parameter.
*
* @param jsonAsString
* @throws DevFailed
*/
......@@ -592,6 +591,7 @@ public class ArchivingManager {
/**
* Moves an attribute from one archiver to another
*
* @param argin attributeName,archiverName
* @throws DevFailed if the attribute cannot be moved since it is not archived or if it failed
*/
......@@ -604,4 +604,19 @@ public class ArchivingManager {
databaseAccess.shiftArchiver(argin[0], argin[1]);
auditLogger.debug("Exiting ShiftArchiver");
}
@Command(name = "GetAttributesConfList", inTypeDesc = "Attribute pattern", outTypeDesc = "Attributes config list")
public String[] getAttributesConfList(final String attributePattern) throws DevFailed {
String[] attributes = databaseAccess.getAttributesByPattern(attributePattern);
List<String> res = new ArrayList<>();
for (String attribute : attributes) {
String[] modes = databaseAccess.getArchivingMode(attribute);
if (modes.length == 0) {
continue;
}
res.add(attribute);
res.addAll(Arrays.asList(modes));
}
return res.toArray(new String[0]);
}
}
......@@ -239,4 +239,9 @@ public class HDBTDBAccess implements IArchivingAccess {
throw e.toTangoException();
}
}
@Override
public String[] getAttributesByPattern(final String pattern) throws DevFailed {
throw DevFailedUtils.newDevFailed("Not supported for HDB or TDB");
}
}
......@@ -35,4 +35,6 @@ public interface IArchivingAccess {
int createNewContext(final String contextName, String description) throws DevFailed;
void shiftArchiver(final String attributeName, final String archiverName) throws DevFailed;
String[] getAttributesByPattern(final String attributeNamePattern) throws DevFailed;
}
......@@ -36,9 +36,9 @@ public class TimeseriesAccess implements IArchivingAccess {
private final static String SPECTRUM_CHARGE = "spectrumCharge";
private final static String IMAGE_CHARGE = "imageCharge";
private final static String INSERTION_RATE = "insertionRate";
private final Logger logger = LoggerFactory.getLogger(TimeseriesAccess.class);
protected TangoArchivingConfigService configService;
protected TangoArchivingInserterService inserterService;
private final Logger logger = LoggerFactory.getLogger(TimeseriesAccess.class);
private TangoArchivingSystemConfigurationService service;
@Override
......@@ -217,4 +217,9 @@ public class TimeseriesAccess implements IArchivingAccess {
service.startArchiving(configs);
});
}
@Override
public String[] getAttributesByPattern(final String archiverName) {
return configService.getAttributesByAttributePattern(archiverName).stream().map(AttributeConfig::getFullName).toArray(String[]::new);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment