use of diskCacheV111.util.HTMLWriter in project dcache by dCache.
the class HttpBillingEngine method printMainStatisticsPage.
private void printMainStatisticsPage(OutputStream out) throws HttpException {
HTMLWriter html = new HTMLWriter(out, _context);
try {
Object[][] x = _billing.sendAndWait("get billing info", Object[][].class);
html.addHeader("/styles/billing.css", "dCache Billing");
printTotalStatistics(html, x);
try {
Map<String, long[]> map = _billing.sendAndWait("get pool statistics", Map.class);
printPoolStatistics(html, map, null);
} catch (InterruptedException | TimeoutCacheException e) {
throw e;
} catch (CacheException e) {
html.print("<p class=\"error\">This 'billingCell' doesn't support: 'get pool statistics':");
html.print("<blockquote><pre>" + e + "</pre></blockquote>");
}
} catch (NoRouteToCellException e) {
throw new HttpException(500, "No connection to billing");
} catch (TimeoutCacheException e) {
throw new HttpException(500, "Request Timed Out");
} catch (InterruptedException | CacheException e) {
throw new HttpException(500, "Problem : " + e.getMessage());
} finally {
html.addFooter(getClass().getName());
}
}
use of diskCacheV111.util.HTMLWriter in project dcache by dCache.
the class HttpPoolMgrEngineV3 method printRestoreInfo.
private void printRestoreInfo(OutputStream out, String sorting, String grep) {
HTMLWriter html = new HTMLWriter(out, _context);
html.addHeader("/styles/restoreHandler.css", "dCache Dataset Restore Monitor");
RestoreHandlerInfo[] list = _lazyRestoreList.stream().map(o -> o[0]).toArray(RestoreHandlerInfo[]::new);
Arrays.sort(list, new OurComparator(sorting));
html.beginTable("sortable", "pnfs", "PnfsId", "subnet", "Subnet", "candidate", "PoolCandidate", "started", "Started", "clients", "Clients", "retries", "Retries", "status", "Status");
for (RestoreHandlerInfo info : list) {
if ((grep == null) || grepOk(grep, info)) {
showRestoreInfo(html, info);
}
}
html.endTable();
html.addFooter(getClass().getName());
}
use of diskCacheV111.util.HTMLWriter in project dcache by dCache.
the class HttpBillingEngine method printPerPoolStatisticsPage.
private void printPerPoolStatisticsPage(OutputStream out, String pool) {
HTMLWriter html = new HTMLWriter(out, _context);
try {
html.addHeader("/styles/billing.css", "dCache Billing");
Map<String, long[]> map = _billing.sendAndWait("get pool statistics " + pool, Map.class);
printPoolStatistics(html, map, pool);
} catch (NoRouteToCellException e) {
html.print("<blockquote><pre>No connection to billing</pre></blockquote>");
} catch (TimeoutCacheException e) {
html.print("<blockquote><pre>Request Timed Out</pre></blockquote>");
} catch (InterruptedException | CacheException e) {
html.print("<blockquote><pre>" + e + "</pre></blockquote>");
} finally {
html.addFooter(getClass().getName());
}
}
use of diskCacheV111.util.HTMLWriter in project dcache by dCache.
the class HttpPoolMgrEngineV3 method printLazyRestoreInfo.
private void printLazyRestoreInfo(OutputStream out, String sorting, String grep) {
HTMLWriter html = new HTMLWriter(out, _context);
html.addHeader("/styles/restoreHandler.css", "dCache Dataset Restore Monitor (Lazy)");
html.beginTable("sortable", "pnfs", "PnfsId", "subnet", "Subnet", "candidate", "PoolCandidate", "started", "Started", "clients", "Clients", "retries", "Retries", "status", "Status");
List<Object[]> copy = new ArrayList<>(_lazyRestoreList);
Collections.sort(copy, new OurComparator(sorting));
for (Object[] a : copy) {
if ((grep == null) || grepOk(grep, a)) {
showRestoreInfo(html, (RestoreHandlerInfo) a[0], (String) a[1], (StorageInfo) a[2]);
}
}
html.endTable();
html.addFooter(getClass().getName());
}
use of diskCacheV111.util.HTMLWriter in project dcache by dCache.
the class PoolInfoObserverEngineV2 method queryUrl.
@Override
public void queryUrl(HttpRequest request) throws HttpException {
String[] urlItems = request.getRequestTokens();
int offset = request.getRequestTokenOffset();
OutputStream out = request.getOutputStream();
_requestCounter++;
request.printHttpHeader(0);
HTMLWriter html = new HTMLWriter(out, _context);
try {
html.addHeader("/styles/poolinfo.css", "Pool Property Tables");
if (urlItems.length < 1) {
return;
}
if (urlItems.length > 1 && urlItems[1].equals("list")) {
Object o = _context.get("poolgroup-map.ser");
if (o == null) {
html.println("<h3>Information not yet available</h3>");
return;
} else if (!(o instanceof PoolCellQueryContainer)) {
html.println("<h3>Internal error: poolgroup-map.ser contains unknown class</h3>");
return;
}
_container = (PoolCellQueryContainer) o;
String className = urlItems.length > 2 ? urlItems[2] : null;
String groupName = urlItems.length > 3 ? urlItems[3] : null;
String selection = urlItems.length > 4 ? urlItems[4] : null;
printClassMenu(html, className);
if (className == null) {
return;
}
if (_showPoolGroupUsage) {
printGroupList(html, className);
} else {
printGroupMenu(html, className, groupName);
}
if (groupName == null) {
return;
}
html.println("<h3>Pool group <emph>" + groupName + "</emph></h3>");
printMenuTable(html, _tableSelection.entrySet(), "/pools/list/" + className + "/" + groupName + "/", selection);
if (selection == null) {
return;
}
Map<String, Object> poolMap = _container.getPoolMap(className, groupName);
if (poolMap == null) {
return;
}
switch(selection) {
case "cells":
printCells(html, poolMap);
break;
case "spaces":
printPools(html, poolMap);
break;
case "queues":
printPoolActions(html, poolMap);
break;
}
}
} catch (Exception e) {
_errorCounter++;
showProblem(html, e.getMessage());
html.println("<ul>");
for (int i = 0; i < urlItems.length; i++) {
html.println("<li> [" + i + "] " + urlItems[i] + "</li>");
}
html.println("</ul>");
} finally {
html.addFooter(getClass().getName() + " [$Rev$]");
}
}
Aggregations