mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-11-15 10:20:47 +00:00
use methods to specify which report rather than string constants
* MultiReporter
deleted. direct method calls are a better way to specify the kind of report desired
getReports was never used to choose from the array of strings. no use case for MultiReporter.
* ArchiveUtils
writeReportToString was not used, and it used the now deleted MultiReporter#reportTo
* DevUtils, Frontier, ToePool, AbstractFrontier, WorkQueueFrontier
MultiReporter -> Reporter and make methods that implemented named multireport public
* FrontierNonemptyReport, FrontierSummaryReport
call the appropriate report method instead of passing a string constant
This commit is contained in:
1 parent
493e2423f6
commit
07a2fc65ea
10 files changed
+147
-272
No files matched your search
@@ -741,22 +741,6 @@ public class ArchiveUtils {
|
||||
pw.flush();
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compose the requested report into a String. DANGEROUS IF REPORT
|
||||
* CAN BE LARGE.
|
||||
*
|
||||
* @param rep Reported
|
||||
* @param name String name of report to compose
|
||||
* @return String of report
|
||||
*/
|
||||
public static String writeReportToString(MultiReporter rep, String name) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
rep.reportTo(name,pw);
|
||||
pw.flush();
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enhance given object's default String display for appearing
|
||||
@@ -773,8 +757,8 @@ public class ArchiveUtils {
|
||||
} else if (obj instanceof Map) {
|
||||
return prettyString((Map) obj);
|
||||
} else {
|
||||
return "<"+obj+">";
|
||||
}
|
||||
return "<"+obj+">";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,8 +55,8 @@ public class DevUtils {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
final Thread current = Thread.currentThread();
|
||||
if (current instanceof MultiReporter) {
|
||||
MultiReporter tt = (MultiReporter)current;
|
||||
if (current instanceof Reporter) {
|
||||
Reporter tt = (Reporter)current;
|
||||
try {
|
||||
tt.reportTo(pw);
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Heritrix web crawler (crawler.archive.org).
|
||||
*
|
||||
* Licensed to the Internet Archive (IA) by one or more individual
|
||||
* contributors.
|
||||
*
|
||||
* The IA licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.archive.util;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* @contributor stack
|
||||
*/
|
||||
@Deprecated
|
||||
public interface MultiReporter extends Reporter {
|
||||
/**
|
||||
* Get an array of report names offered by this Reporter.
|
||||
* A name in brackets indicates a free-form String,
|
||||
* in accordance with the informal description inside
|
||||
* the brackets, may yield a useful report.
|
||||
*
|
||||
* @return String array of report names, empty if there is only
|
||||
* one report type
|
||||
*/
|
||||
public String[] getReports();
|
||||
|
||||
/**
|
||||
* Make a report of the given name to the passed-in Writer,
|
||||
* If null, give the default report.
|
||||
*
|
||||
* @param writer to receive report
|
||||
*/
|
||||
public void reportTo(String name, PrintWriter writer);
|
||||
}
|
||||
Reference in new issue
Block a user