mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-07-13 11:07:12 +00:00
Rename short report methods:
- singleLineReport() -> shortReportLine() - singleLineReportTo() -> shortReportLineTo() - singleLineReportData() -> shortReportMap()
This commit is contained in:
@@ -662,15 +662,15 @@ public class ArchiveUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to get a String singleLineReport from Reporter
|
||||
* @param rep Reporter to get singleLineReport from
|
||||
* Utility method to get a String shortReportLine from Reporter
|
||||
* @param rep Reporter to get shortReportLine from
|
||||
* @return String of report
|
||||
*/
|
||||
public static String singleLineReport(Reporter rep) {
|
||||
public static String shortReportLine(Reporter rep) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
try {
|
||||
rep.singleLineReportTo(pw);
|
||||
rep.shortReportLineTo(pw);
|
||||
} catch (IOException e) {
|
||||
// not really possible
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -37,13 +37,13 @@ public interface Reporter {
|
||||
*
|
||||
* @param writer to receive report
|
||||
*/
|
||||
public void singleLineReportTo(PrintWriter pw) throws IOException;
|
||||
public void shortReportLineTo(PrintWriter pw) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* @return Same data that's in the single line report, as key-value pairs
|
||||
*/
|
||||
public Map<String,Object> singleLineReportData();
|
||||
public Map<String,Object> shortReportMap();
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,5 +51,5 @@ public interface Reporter {
|
||||
*
|
||||
* @return String single-line summary legend
|
||||
*/
|
||||
public String singleLineLegend();
|
||||
public String shortReportLegend();
|
||||
}
|
||||
|
||||
@@ -594,16 +594,16 @@ implements Serializable,
|
||||
}
|
||||
|
||||
public String getToeThreadReportShort() {
|
||||
return (toePool == null) ? "" : ArchiveUtils.singleLineReport(toePool);
|
||||
return (toePool == null) ? "" : ArchiveUtils.shortReportLine(toePool);
|
||||
}
|
||||
|
||||
public Map<String,Object> getToeThreadReportShortData() {
|
||||
return toePool == null ? null : toePool.singleLineReportData();
|
||||
return toePool == null ? null : toePool.shortReportMap();
|
||||
|
||||
}
|
||||
|
||||
public String getFrontierReportShort() {
|
||||
return ArchiveUtils.singleLineReport(getFrontier());
|
||||
return ArchiveUtils.shortReportLine(getFrontier());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -826,7 +826,7 @@ public class CrawlJob implements Comparable<CrawlJob>, ApplicationListener {
|
||||
if (cc == null) {
|
||||
return null;
|
||||
}
|
||||
return cc.getFrontier().singleLineReportData();
|
||||
return cc.getFrontier().shortReportMap();
|
||||
}
|
||||
|
||||
public String frontierReport() {
|
||||
|
||||
@@ -252,16 +252,16 @@ public class ToePool extends ThreadGroup implements MultiReporter {
|
||||
ToeThread tt = (ToeThread) toes[i];
|
||||
if (tt != null) {
|
||||
if(!legendWritten) {
|
||||
writer.println(tt.singleLineLegend());
|
||||
writer.println(tt.shortReportLegend());
|
||||
legendWritten = true;
|
||||
}
|
||||
tt.singleLineReportTo(writer);
|
||||
tt.shortReportLineTo(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> singleLineReportData() {
|
||||
public Map<String, Object> shortReportMap() {
|
||||
Histotable<Object> steps = new Histotable<Object>();
|
||||
Histotable<Object> processors = new Histotable<Object>();
|
||||
Thread[] toes = getToes();
|
||||
@@ -289,7 +289,7 @@ public class ToePool extends ThreadGroup implements MultiReporter {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void singleLineReportTo(PrintWriter w) {
|
||||
public void shortReportLineTo(PrintWriter w) {
|
||||
Histotable<Object> steps = new Histotable<Object>();
|
||||
Histotable<Object> processors = new Histotable<Object>();
|
||||
Thread[] toes = getToes();
|
||||
@@ -333,7 +333,7 @@ public class ToePool extends ThreadGroup implements MultiReporter {
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.util.Reporter#singleLineLegend()
|
||||
*/
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
return "total: mostCommonStateTotal secondMostCommonStateTotal";
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ implements RecorderMarker, MultiReporter, ProgressStatisticsReporter,
|
||||
currentCuri.getAnnotations().add("err="+err.getClass().getName());
|
||||
currentCuri.getAnnotations().add("os"+currentCuri.getFetchStatus());
|
||||
currentCuri.setFetchStatus(S_SERIOUS_ERROR);
|
||||
context = currentCuri.singleLineReport() + " in " + currentProcessorName;
|
||||
context = currentCuri.shortReportLine() + " in " + currentProcessorName;
|
||||
}
|
||||
String message = "Serious error occured trying " +
|
||||
"to process '" + context + "'\n" + extraInfo;
|
||||
@@ -408,7 +408,7 @@ implements RecorderMarker, MultiReporter, ProgressStatisticsReporter,
|
||||
CrawlURI c = currentCuri;
|
||||
if(c != null) {
|
||||
pw.print(" ");
|
||||
c.singleLineReportTo(pw);
|
||||
c.shortReportLineTo(pw);
|
||||
pw.print(" ");
|
||||
pw.print(c.getFetchAttempts());
|
||||
pw.print(" attempts");
|
||||
@@ -481,7 +481,7 @@ implements RecorderMarker, MultiReporter, ProgressStatisticsReporter,
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> singleLineReportData() {
|
||||
public Map<String, Object> shortReportMap() {
|
||||
Map<String,Object> data = new LinkedHashMap<String, Object>();
|
||||
data.put("serialNumber", serialNumber);
|
||||
CrawlURI c = currentCuri;
|
||||
@@ -511,7 +511,7 @@ implements RecorderMarker, MultiReporter, ProgressStatisticsReporter,
|
||||
/**
|
||||
* @param w PrintWriter to write to.
|
||||
*/
|
||||
public void singleLineReportTo(PrintWriter w)
|
||||
public void shortReportLineTo(PrintWriter w)
|
||||
{
|
||||
w.print("#");
|
||||
w.print(this.serialNumber);
|
||||
@@ -558,10 +558,7 @@ implements RecorderMarker, MultiReporter, ProgressStatisticsReporter,
|
||||
w.flush();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.util.Reporter#singleLineLegend()
|
||||
*/
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
return "#serialNumber processorName currentUri (fetchAttempts) threadState threadStep";
|
||||
}
|
||||
|
||||
@@ -577,11 +574,8 @@ implements RecorderMarker, MultiReporter, ProgressStatisticsReporter,
|
||||
reportTo(null, writer);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.util.Reporter#singleLineReport()
|
||||
*/
|
||||
public String singleLineReport() {
|
||||
return ArchiveUtils.singleLineReport(this);
|
||||
public String shortReportLine() {
|
||||
return ArchiveUtils.shortReportLine(this);
|
||||
}
|
||||
|
||||
public void progressStatisticsLine(PrintWriter writer) {
|
||||
|
||||
@@ -1162,8 +1162,8 @@ public abstract class AbstractFrontier
|
||||
//
|
||||
// Reporter implementation
|
||||
//
|
||||
public String singleLineReport() {
|
||||
return ArchiveUtils.singleLineReport(this);
|
||||
public String shortReportLine() {
|
||||
return ArchiveUtils.shortReportLine(this);
|
||||
}
|
||||
|
||||
public void reportTo(PrintWriter writer) {
|
||||
|
||||
@@ -167,7 +167,7 @@ public class BdbMultipleWorkQueues {
|
||||
if(pattern.matcher(curi.toString()).matches()) {
|
||||
if (verbose) {
|
||||
results.add("[" + curi.getClassKey() + "] "
|
||||
+ curi.singleLineReport());
|
||||
+ curi.shortReportLine());
|
||||
} else {
|
||||
results.add(curi.toString());
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ public abstract class WorkQueue implements Frontier.FrontierGroup,
|
||||
reportTo(null,writer);
|
||||
}
|
||||
|
||||
public Map<String, Object> singleLineReportData() {
|
||||
public Map<String, Object> shortReportMap() {
|
||||
Map<String,Object> map = new LinkedHashMap<String, Object>();
|
||||
|
||||
map.put("queueName", classKey);
|
||||
@@ -558,10 +558,7 @@ public abstract class WorkQueue implements Frontier.FrontierGroup,
|
||||
return map;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.util.Reporter#singleLineReportTo(java.io.Writer)
|
||||
*/
|
||||
public void singleLineReportTo(PrintWriter writer) {
|
||||
public void shortReportLineTo(PrintWriter writer) {
|
||||
// queue name
|
||||
writer.print(classKey);
|
||||
writer.print(" ");
|
||||
@@ -608,20 +605,14 @@ public abstract class WorkQueue implements Frontier.FrontierGroup,
|
||||
writer.print("\n");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.util.Reporter#singleLineLegend()
|
||||
*/
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
return "queue precedence currentSize totalEnqueues sessionBalance " +
|
||||
"lastCost (averageCost) lastDequeueTime wakeTime " +
|
||||
"totalSpend/totalBudget errorCount lastPeekUri lastQueuedUri";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.util.Reporter#singleLineReport()
|
||||
*/
|
||||
public String singleLineReport() {
|
||||
return ArchiveUtils.singleLineReport(this);
|
||||
public String shortReportLine() {
|
||||
return ArchiveUtils.shortReportLine(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -659,13 +650,13 @@ public abstract class WorkQueue implements Frontier.FrontierGroup,
|
||||
writer.print(ArchiveUtils.doubleToString(
|
||||
((double) totalExpenditure / costCount), 1));
|
||||
writer.print(")\n ");
|
||||
writer.print(getSubstats().singleLineLegend());
|
||||
writer.print(getSubstats().shortReportLegend());
|
||||
writer.print("\n ");
|
||||
writer.print(getSubstats().singleLineReport());
|
||||
writer.print(getSubstats().shortReportLine());
|
||||
writer.print("\n ");
|
||||
writer.print(getPrecedenceProvider().singleLineLegend());
|
||||
writer.print(getPrecedenceProvider().shortReportLegend());
|
||||
writer.print("\n ");
|
||||
writer.print(getPrecedenceProvider().singleLineReport());
|
||||
writer.print(getPrecedenceProvider().shortReportLine());
|
||||
writer.print("\n\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -641,8 +641,8 @@ implements Closeable,
|
||||
// should not reach
|
||||
logger.severe("No CrawlURI from ready non-empty queue "
|
||||
+ readyQ.classKey + "\n"
|
||||
+ readyQ.singleLineLegend() + "\n"
|
||||
+ readyQ.singleLineReport() + "\n");
|
||||
+ readyQ.shortReportLegend() + "\n"
|
||||
+ readyQ.shortReportLine() + "\n");
|
||||
break returnauri;
|
||||
}
|
||||
|
||||
@@ -1114,7 +1114,7 @@ implements Closeable,
|
||||
return REPORTS;
|
||||
}
|
||||
|
||||
public Map<String, Object> singleLineReportData() {
|
||||
public Map<String, Object> shortReportMap() {
|
||||
if (this.allQueues == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -1151,7 +1151,7 @@ implements Closeable,
|
||||
/**
|
||||
* @param w Where to write to.
|
||||
*/
|
||||
public void singleLineReportTo(PrintWriter w) {
|
||||
public void shortReportLineTo(PrintWriter w) {
|
||||
if (this.allQueues == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1231,7 +1231,7 @@ implements Closeable,
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.util.Reporter#singleLineLegend()
|
||||
*/
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
return "total active in-process ready snoozed inactive retired exhausted";
|
||||
}
|
||||
|
||||
@@ -1329,10 +1329,10 @@ implements Closeable,
|
||||
writer.print(" ERROR: "+obj);
|
||||
}
|
||||
if(!legendWritten) {
|
||||
writer.println(q.singleLineLegend());
|
||||
writer.println(q.shortReportLegend());
|
||||
legendWritten = true;
|
||||
}
|
||||
q.singleLineReportTo(writer);
|
||||
q.shortReportLineTo(writer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-8
@@ -90,13 +90,13 @@ public class HighestUriQueuePrecedencePolicy extends BaseQueuePrecedencePolicy {
|
||||
return super.getPrecedence() + delta;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.crawler.frontier.precedence.PrecedenceProvider#singleLineLegend()
|
||||
/*
|
||||
* @see org.archive.crawler.frontier.precedence.PrecedenceProvider#shortReportLegend()()
|
||||
*/
|
||||
@Override
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(super.singleLineLegend());
|
||||
sb.append(super.shortReportLegend());
|
||||
sb.append(":");
|
||||
for(Integer p : enqueuedCounts.keySet()) {
|
||||
sb.append(" p");
|
||||
@@ -105,11 +105,8 @@ public class HighestUriQueuePrecedencePolicy extends BaseQueuePrecedencePolicy {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.crawler.frontier.precedence.PrecedenceProvider#singleLineReportTo(java.io.PrintWriter)
|
||||
*/
|
||||
@Override
|
||||
public void singleLineReportTo(PrintWriter writer) {
|
||||
public void shortReportLineTo(PrintWriter writer) {
|
||||
boolean betwixt = false;
|
||||
for(Long count : enqueuedCounts.values()) {
|
||||
if(betwixt) writer.print(" ");
|
||||
|
||||
+7
-7
@@ -57,8 +57,8 @@ FetchStats.CollectsFetchStats, Serializable {
|
||||
*/
|
||||
public void reportTo(String name, PrintWriter writer) {
|
||||
// name ignored, only one report
|
||||
writer.println(singleLineLegend());
|
||||
singleLineReportTo(writer);
|
||||
writer.println(shortReportLegend());
|
||||
shortReportLineTo(writer);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -68,21 +68,21 @@ FetchStats.CollectsFetchStats, Serializable {
|
||||
reportTo(null,writer);
|
||||
}
|
||||
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
public String singleLineReport() {
|
||||
return ArchiveUtils.singleLineReport(this);
|
||||
public String shortReportLine() {
|
||||
return ArchiveUtils.shortReportLine(this);
|
||||
}
|
||||
|
||||
public Map<String, Object> singleLineReportData() {
|
||||
public Map<String, Object> shortReportMap() {
|
||||
Map<String,Object> data = new LinkedHashMap<String, Object>();
|
||||
data.put("precedence", getPrecedence());
|
||||
return data;
|
||||
}
|
||||
|
||||
public void singleLineReportTo(PrintWriter writer) {
|
||||
public void shortReportLineTo(PrintWriter writer) {
|
||||
writer.print(getPrecedence());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
|
||||
PrintWriter diversionLog = getDiversionLog(target);
|
||||
diversionLog.print(cauri.getClassKey());
|
||||
diversionLog.print(" ");
|
||||
cauri.singleLineReportTo(diversionLog);
|
||||
cauri.shortReportLineTo(diversionLog);
|
||||
diversionLog.println();
|
||||
}
|
||||
|
||||
|
||||
@@ -1486,11 +1486,11 @@ implements MultiReporter, Serializable, OverlayContext {
|
||||
// Reporter implementation
|
||||
//
|
||||
|
||||
public String singleLineReport() {
|
||||
return ArchiveUtils.singleLineReport(this);
|
||||
public String shortReportLine() {
|
||||
return ArchiveUtils.shortReportLine(this);
|
||||
}
|
||||
|
||||
public Map<String, Object> singleLineReportData() {
|
||||
public Map<String, Object> shortReportMap() {
|
||||
Map<String,Object> map = new LinkedHashMap<String, Object>();
|
||||
map.put("class", getClass().getName());
|
||||
map.put("uri", getUURI().toString());
|
||||
@@ -1499,7 +1499,7 @@ implements MultiReporter, Serializable, OverlayContext {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void singleLineReportTo(PrintWriter w) {
|
||||
public void shortReportLineTo(PrintWriter w) {
|
||||
String className = this.getClass().getName();
|
||||
className = className.substring(className.lastIndexOf(".")+1);
|
||||
w.print(className);
|
||||
@@ -1514,7 +1514,7 @@ implements MultiReporter, Serializable, OverlayContext {
|
||||
/* (non-Javadoc)
|
||||
* @see org.archive.util.Reporter#singleLineLegend()
|
||||
*/
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
return "className uri hopsPath viaUri";
|
||||
}
|
||||
|
||||
@@ -1530,7 +1530,7 @@ implements MultiReporter, Serializable, OverlayContext {
|
||||
* @see org.archive.util.Reporter#reportTo(java.lang.String, java.io.Writer)
|
||||
*/
|
||||
public void reportTo(String name, PrintWriter writer) {
|
||||
singleLineReportTo(writer);
|
||||
shortReportLineTo(writer);
|
||||
writer.print("\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -94,18 +94,18 @@ implements Iterable<Processor>,
|
||||
writer.println();
|
||||
}
|
||||
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public Map<String, Object> singleLineReportData() {
|
||||
public Map<String, Object> shortReportMap() {
|
||||
Map<String,Object> data = new LinkedHashMap<String, Object>();
|
||||
data.put("processorCount", size());
|
||||
data.put("processors", getProcessors());
|
||||
return data;
|
||||
}
|
||||
|
||||
public void singleLineReportTo(PrintWriter pw) {
|
||||
public void shortReportLineTo(PrintWriter pw) {
|
||||
pw.print(size());
|
||||
pw.print(" processors: ");
|
||||
for(Processor p : this) {
|
||||
|
||||
@@ -194,8 +194,8 @@ public class FetchStats implements Serializable, FetchStatusCodes, MultiReporter
|
||||
*/
|
||||
public void reportTo(String name, PrintWriter writer) {
|
||||
// name ignored, only one report
|
||||
writer.println(singleLineLegend());
|
||||
singleLineReportTo(writer);
|
||||
writer.println(shortReportLegend());
|
||||
shortReportLineTo(writer);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -205,17 +205,17 @@ public class FetchStats implements Serializable, FetchStatusCodes, MultiReporter
|
||||
reportTo(null,writer);
|
||||
}
|
||||
|
||||
public String singleLineLegend() {
|
||||
public String shortReportLegend() {
|
||||
return "totalScheduled fetchSuccesses fetchFailures fetchDisregards " +
|
||||
"fetchResponses robotsDenials successBytes totalBytes " +
|
||||
"fetchNonResponses";
|
||||
}
|
||||
|
||||
public String singleLineReport() {
|
||||
return ArchiveUtils.singleLineReport(this);
|
||||
public String shortReportLine() {
|
||||
return ArchiveUtils.shortReportLine(this);
|
||||
}
|
||||
|
||||
public void singleLineReportTo(PrintWriter writer) {
|
||||
public void shortReportLineTo(PrintWriter writer) {
|
||||
writer.print(totalScheduled);
|
||||
writer.print(" ");
|
||||
writer.print(fetchSuccesses);
|
||||
@@ -235,7 +235,7 @@ public class FetchStats implements Serializable, FetchStatusCodes, MultiReporter
|
||||
writer.print(fetchNonResponses);
|
||||
}
|
||||
|
||||
public Map<String, Object> singleLineReportData() {
|
||||
public Map<String, Object> shortReportMap() {
|
||||
Map<String,Object> map = new LinkedHashMap<String, Object>();
|
||||
map.put("totalScheduled", totalScheduled);
|
||||
map.put("fetchSuccesses", fetchSuccesses);
|
||||
|
||||
Reference in New Issue
Block a user