use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class DisplayState method doGet.
@Override
protected void doGet() throws IOException {
xml = null;
String script = (String) env.get("SCRIPT_NAME");
if (script.contains("getTimingState"))
writeTimingState();
else if (script.contains("getHierarchy"))
writeHierarchy();
else if (script.contains("getScripts"))
writeScripts();
else
throw new TinyCGIException(404, "Unrecognized request");
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class JoinTeamProject method maybeReroot.
/** If the current prefix doesn't name the root of a team project,
* search upward through the hierarchy to find the project root,
* and change the active prefix to name that node. */
protected void maybeReroot() throws TinyCGIException {
DashHierarchy hierarchy = getPSPProperties();
PropertyKey key = hierarchy.findExistingKey(getPrefix());
boolean rerooted = false;
String projectRoot = null;
do {
String templateID = hierarchy.getID(key);
if (templateID != null && templateID.endsWith("/TeamRoot")) {
projectRoot = key.path();
break;
}
rerooted = true;
key = key.getParent();
} while (key != null);
if (rerooted) {
if (projectRoot != null)
parameters.put("hierarchyPath", projectRoot);
else
throw new TinyCGIException(404, "Not Fount");
}
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class RepublishTeamSettings method writeContents.
@Override
protected void writeContents() throws IOException {
// ensure we are running in a team dashboard
if (!Settings.isTeamMode())
throw new TinyCGIException(400, "Only supported for team dashboards");
// perform the requested republish operation
List<String> errors = TeamSettingsRepublisher.getInstance().republish(true);
// write the results
out.write("<html><head><title>Republish Team Settings</title></head>\n");
out.write("<body><h1>Republish Team Settings</h1>\n");
out.write("Team settings files republished at " + new Date());
// if any errors were encountered, mention them
if (!errors.isEmpty()) {
out.write("<p>Settings for the following projects could " + "not be published:<ul>");
for (String project : errors) out.write("<li>" + HTMLUtils.escapeEntities(project) + "</li>");
out.write("</ul>The dashboard's <a href='showConsole.class'>debug " + "log</a> may have more information.</p>");
}
// end the document
out.write("</body></html>\n");
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class Wizard method getPage.
/** Get a page by its numbered position */
private WizardPage getPage(int pagePos) throws IOException {
try {
WizardPage result = (WizardPage) WIZARD_PAGES[pagePos].newInstance();
result.setOut(out);
result.setParams(parameters);
result.setData(getDataRepository());
result.setPrefix(getPrefix());
if (pagePos > 0)
result.setPrevPage(PAGE_KEYS[pagePos - 1]);
result.setCurrPage(PAGE_KEYS[pagePos]);
result.setNextPage(PAGE_KEYS[pagePos + 1]);
result.setStepNumber(pagePos);
result.settingDone();
return result;
} catch (Throwable t) {
t.printStackTrace();
TinyCGIException e = new TinyCGIException(500, "Internal Error");
e.initCause(t);
throw e;
}
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class OpenDefectDialog method openExistingDefectDialog.
private void openExistingDefectDialog(DefectLogID defectLog, String id) throws TinyCGIException {
DefectLog log = new DefectLog(defectLog.filename, defectLog.path.path(), getDataRepository());
Defect defect = log.getDefect(id);
if (defect == null)
throw new TinyCGIException(404, "No defect found with ID '" + id + "' in " + defectLog.path.path());
DefectDialog dlg = DefectDialog.getDialogForDefect(getDash(), defectLog.filename, defectLog.path, defect, true);
dlg.setTitle(defectLog.path.path());
dlg.toFront();
}
Aggregations