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);
}
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();
}
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;
}
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);
}
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");
}
Aggregations