Search in sources :

Example 6 with DataContext

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

the class ProbeConsistencyCheck method writeContents.

@Override
protected void writeContents() throws IOException {
    DataContext data = getDataContext();
    out.println(HEADER);
    maybePrintOutputMismatch(data, "PROBE_Size_Output_Mismatch", "Estimated Added & Modified Size", SIZE_FMT, "Size_Mismatch_FMT");
    maybePrintOutputMismatch(data, "PROBE_Time_Output_Mismatch", "Estimated Time", TIME_FMT, "Time_Mismatch_FMT");
    out.println(FOOTER);
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext)

Example 7 with DataContext

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

the class StudataExporter method writeXmlFile.

private void writeXmlFile(File outputFile, List projectPaths, ResultSet data) throws IOException {
    OutputStream out = new BufferedOutputStream(new FileOutputStream(outputFile));
    DataContext profileData = getDataRepository().getSubcontext(getStudentProfilePath());
    StudataExporterXml.writeXmlData(out, profileData, projectPaths, data);
    out.close();
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) BufferedOutputStream(java.io.BufferedOutputStream)

Example 8 with DataContext

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

the class WebAppScriptSource method getScripts.

public List<ScriptID> getScripts(String path) {
    List<ScriptID> result = new ArrayList<ScriptID>();
    while (path != null) {
        DataContext ctx = data.getSubcontext(path);
        for (ItemDefinition item : SCRIPT_ITEMS) if (item.test(ctx))
            result.add(item.getScriptID(path));
        path = DataRepository.chopPath(path);
    }
    return result;
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) ArrayList(java.util.ArrayList) ScriptID(net.sourceforge.processdash.process.ScriptID)

Example 9 with DataContext

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

the class MoveTeamDirMessageHandler method handle.

public void handle(MessageEvent message) {
    Element xml = message.getMessageXml();
    String projectId = getString(xml, PROJECT_ID_ATTR);
    if (!StringUtils.hasValue(projectId))
        return;
    String path = findProject(PropertyKey.ROOT, projectId);
    if (path == null)
        return;
    String directory = getString(xml, DIR_ATTR);
    String directoryUNC = getString(xml, DIR_UNC_ATTR);
    String url = getString(xml, URL_ATTR);
    NetworkDriveList dl = new NetworkDriveList();
    if (dl.wasSuccessful()) {
        if (StringUtils.hasValue(directoryUNC)) {
            if (directory == null || !directory.startsWith("\\\\")) {
                String newDir = dl.fromUNCName(directoryUNC);
                if (StringUtils.hasValue(newDir))
                    directory = newDir;
            }
        } else if (StringUtils.hasValue(directory)) {
            String newUNC = dl.toUNCName(directory);
            if (StringUtils.hasValue(newUNC))
                directoryUNC = newUNC;
        }
    }
    logger.info("Moving team data directory for project '" + path + "' to:\n" + "\tdirectory=" + directory + "\n" + "\tdirectoryUNC=" + directoryUNC + "\n" + "\turl=" + url);
    DataContext data = ctx.getData().getSubcontext(path);
    saveString(data, TeamDataConstants.TEAM_DIRECTORY, directory);
    saveString(data, TeamDataConstants.TEAM_DIRECTORY_UNC, directoryUNC);
    saveString(data, TeamDataConstants.TEAM_DATA_DIRECTORY_URL, url);
    RepairImportInstruction.maybeRepairForIndividual(data);
}
Also used : NetworkDriveList(net.sourceforge.processdash.util.NetworkDriveList) DataContext(net.sourceforge.processdash.data.DataContext) Element(org.w3c.dom.Element)

Example 10 with DataContext

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

the class MigrationToolTeam method checkConversionPreconditions.

private void checkConversionPreconditions() throws MigrationException {
    if (Settings.isReadOnly())
        throw new MigrationException("isReadOnly");
    ProcessDashboard dash = (ProcessDashboard) ctx;
    if (dash.isHierarchyEditorOpen())
        throw new MigrationException("hierarchyEditorOpen");
    DataContext data = ctx.getData().getSubcontext(projectPath);
    SimpleData sd = data.getSimpleValue("Master_Project_Path");
    if (sd != null && sd.test())
        throw new MigrationException("belongsToMasterProject");
    sd = data.getSimpleValue("Team_Process_PID");
    currentPID = (sd == null ? null : sd.format());
    if (targetPID == null || targetPID.equals(currentPID))
        throw new MigrationException("targetPIDIsNoChange").add("targetPID", targetPID);
    newRootTemplateID = targetPID + TEAM_ROOT;
    if (!DashController.getTemplates().containsKey(newRootTemplateID))
        throw new MigrationException("targetTemplateNotInstalled").add("targetPID", targetPID);
    sd = data.getSimpleValue("Team_Data_Directory");
    if (sd == null || !sd.test())
        throw new MigrationException("noTeamDataDir");
    teamDataDirectory = new File(sd.format());
    if (!teamDataDirectory.isDirectory())
        throw new MigrationException("cannotFindTeamDataDir");
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) SimpleData(net.sourceforge.processdash.data.SimpleData) File(java.io.File)

Aggregations

DataContext (net.sourceforge.processdash.data.DataContext)18 SimpleData (net.sourceforge.processdash.data.SimpleData)5 ArrayList (java.util.ArrayList)4 Iterator (java.util.Iterator)4 List (java.util.List)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)2 DateData (net.sourceforge.processdash.data.DateData)2 ListData (net.sourceforge.processdash.data.ListData)2 ProcessUtil (net.sourceforge.processdash.process.ProcessUtil)2 BufferedOutputStream (java.io.BufferedOutputStream)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 URL (java.net.URL)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 DoubleData (net.sourceforge.processdash.data.DoubleData)1