Search in sources :

Example 61 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class TaskListDataWatcher method addTaskListNames.

private void addTaskListNames(ExportedDataValue val) {
    SimpleData d = val.getSimpleValue();
    if (!d.test())
        return;
    ListData list = null;
    if (d instanceof ListData)
        list = (ListData) d;
    else if (d instanceof StringData)
        list = ((StringData) d).asList();
    if (list != null)
        for (int i = 0; i < list.size(); i++) taskListNames.add(list.get(i));
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) ListData(net.sourceforge.processdash.data.ListData) EVTaskListData(net.sourceforge.processdash.ev.EVTaskListData)

Example 62 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class ExportManager method getExportInstructionFromData.

private AbstractInstruction getExportInstructionFromData(String name) {
    if (!name.endsWith("/" + EXPORT_DATANAME))
        return null;
    SimpleData dataVal = data.getSimpleValue(name);
    if (dataVal == null || !dataVal.test())
        return null;
    String filename = Settings.translateFile(dataVal.format());
    String path = name.substring(0, name.length() - EXPORT_DATANAME.length() - 1);
    Vector filter = new Vector();
    filter.add(path);
    ExportMetricsFileInstruction instr = new ExportMetricsFileInstruction(filename, filter);
    instr.setAttribute(DATANAME_ATTR, name);
    String instrDataname = name + EXPORT_INSTRUCTIONS_SUFFIX;
    SimpleData instrVal = data.getSimpleValue(instrDataname);
    if (instrVal != null && instrVal.test())
        addXmlDataToInstruction(instr, instrVal.format());
    String disableDataname = name + EXPORT_DISABLED_SUFFIX;
    SimpleData disableVal = data.getSimpleValue(disableDataname);
    if (disableVal != null && disableVal.test())
        instr.setEnabled(false);
    String urlDataname = name + EXPORT_URL_SUFFIX;
    SimpleData urlVal = data.getSimpleValue(urlDataname);
    if (urlVal != null && urlVal.test())
        instr.setServerUrl(urlVal.format());
    return instr;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) Vector(java.util.Vector)

Example 63 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class ExportJanitor method startOneTimeExportOperation.

/**
     * Some export operations are performed manually by the user and are not
     * intended for repeated execution.  When we fail to see a repeat of such
     * an operation in the future, we should not interpret it as an indication
     * that the manually exported file is obsolete.  This method is used to
     * frame the beginning of such an operation.
     */
public void startOneTimeExportOperation() {
    SimpleData histList = data.getSimpleValue(HISTORICALLY_EXPORTED_DATANAME);
    if (histList instanceof ListData)
        histList = new ListData((ListData) histList);
    this.originalHistList = histList;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) ListData(net.sourceforge.processdash.data.ListData)

Example 64 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class TinyCGIBase method getPostToken.

/**
     * Retrieve the token that was previously generated by
     * {@link #generatePostToken(String)}
     *
     * @param dataNameSuffix the suffix that was used to generate the token
     * @since 1.14.0.1
     */
protected String getPostToken(String dataNameSuffix) {
    String dataName = getPostTokenDataName(dataNameSuffix);
    SimpleData storedToken = getDataRepository().getSimpleValue(dataName);
    SimpleData storedDate = getDataRepository().getSimpleValue(dataName + "/TS");
    if (storedToken != null && storedDate instanceof DateData) {
        DateData date = (DateData) storedDate;
        long age = System.currentTimeMillis() - date.getValue().getTime();
        if (age > 0 && age < getPostTokenAgeTimeout())
            return storedToken.format();
    }
    return null;
}
Also used : DateData(net.sourceforge.processdash.data.DateData) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 65 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class TimingMetricsRecorderTest method assertStartTime.

private void assertStartTime(String path, Date s) {
    String dataName = path + "/Started";
    SimpleData d = data.getSimpleValue(dataName);
    if (d == null && s == null)
        return;
    assertTrue(d instanceof DateData);
    DateData w = (DateData) d;
    assertEquals(s, w.getValue());
}
Also used : DateData(net.sourceforge.processdash.data.DateData) SimpleData(net.sourceforge.processdash.data.SimpleData)

Aggregations

SimpleData (net.sourceforge.processdash.data.SimpleData)164 ListData (net.sourceforge.processdash.data.ListData)20 DoubleData (net.sourceforge.processdash.data.DoubleData)15 SaveableData (net.sourceforge.processdash.data.SaveableData)14 StringData (net.sourceforge.processdash.data.StringData)13 IOException (java.io.IOException)11 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)11 DateData (net.sourceforge.processdash.data.DateData)10 Iterator (java.util.Iterator)9 List (java.util.List)7 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)6 NumberData (net.sourceforge.processdash.data.NumberData)6 Element (org.w3c.dom.Element)6 Map (java.util.Map)5 DataContext (net.sourceforge.processdash.data.DataContext)5 EscapeString (net.sourceforge.processdash.util.EscapeString)5 File (java.io.File)4