Change scope of most/all default-scope i.e. package-scoped class members to protected, to make heritrix more friendly to third-party extensions. (I don't think there was ever an intent to limit the scope of any of these to package-only.)

This commit is contained in:
Noah Levitt committed 2012-06-05 17:55:41 -07:00
1 parent e965421281
commit 3dce1e909d
161 files changed
+454 -473

No files matched your search

@@ -33,7 +33,7 @@ import org.springframework.context.ApplicationEvent;
*/
public class StatSnapshotEvent extends ApplicationEvent {
private static final long serialVersionUID = 1L;
CrawlStatSnapshot snapshot;
protected CrawlStatSnapshot snapshot;
public StatSnapshotEvent(StatisticsTracker stats, CrawlStatSnapshot snapshot) {
super(stats);
@@ -82,7 +82,7 @@ public class ActionDirectory implements ApplicationContextAware, Lifecycle, Runn
final private static Logger LOGGER =
Logger.getLogger(ActionDirectory.class.getName());
ScheduledExecutorService executor;
protected ScheduledExecutorService executor;
/** how long after crawl start to first scan action directory */
protected int initialDelaySeconds = 10;
@@ -119,7 +119,7 @@ public class ActionDirectory implements ApplicationContextAware, Lifecycle, Runn
this.doneDir = doneDir;
}
ApplicationContext appCtx;
protected ApplicationContext appCtx;
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.appCtx = applicationContext;
}
@@ -278,7 +278,7 @@ public class ActionDirectory implements ApplicationContextAware, Lifecycle, Runn
/** shared ScriptEngineManager */
static ScriptEngineManager MANAGER = new ScriptEngineManager();
protected static ScriptEngineManager MANAGER = new ScriptEngineManager();
/**
* Try the actionFile as a script, deducing the proper scripting
@@ -67,9 +67,9 @@ public class CheckpointService implements Lifecycle, ApplicationContextAware, Ha
/** Next overall series checkpoint number */
protected int nextCheckpointNumber = 1;
Checkpoint checkpointInProgress;
protected Checkpoint checkpointInProgress;
CrawlStatSnapshot lastCheckpointSnapshot = null;
protected CrawlStatSnapshot lastCheckpointSnapshot = null;
/** service for auto-checkpoint tasks at an interval */
protected Timer timer = new Timer(true);
@@ -90,7 +90,7 @@ public class CheckpointService implements Lifecycle, ApplicationContextAware, Ha
* Period at which to create automatic checkpoints; -1 means
* no auto checkpointing.
*/
long checkpointIntervalMinutes = -1;
protected long checkpointIntervalMinutes = -1;
public long getCheckpointIntervalMinutes() {
return checkpointIntervalMinutes;
}
@@ -102,7 +102,7 @@ public class CheckpointService implements Lifecycle, ApplicationContextAware, Ha
}
}
Checkpoint recoveryCheckpoint;
protected Checkpoint recoveryCheckpoint;
@Autowired(required=false)
public void setRecoveryCheckpoint(Checkpoint checkpoint) {
this.recoveryCheckpoint = checkpoint;
@@ -122,7 +122,7 @@ public class CheckpointService implements Lifecycle, ApplicationContextAware, Ha
}
// ApplicationContextAware implementation, for eventing
AbstractApplicationContext appCtx;
protected AbstractApplicationContext appCtx;
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.appCtx = (AbstractApplicationContext)applicationContext;
}
@@ -186,7 +186,7 @@ public class CheckpointService implements Lifecycle, ApplicationContextAware, Ha
periodMs + " milliseconds.");
}
boolean isRunning = false;
protected boolean isRunning = false;
public synchronized boolean isRunning() {
return isRunning;
}
@@ -346,7 +346,7 @@ public class CheckpointService implements Lifecycle, ApplicationContextAware, Ha
}
}
static Validator VALIDATOR = new CheckpointValidator();
protected static Validator VALIDATOR = new CheckpointValidator();
@Override
public Validator getValidator() {
return VALIDATOR;
@@ -30,7 +30,7 @@ import org.springframework.context.ApplicationEvent;
*/
public class CheckpointSuccessEvent extends ApplicationEvent {
private static final long serialVersionUID = 1L;
Checkpoint checkpoint;
protected Checkpoint checkpoint;
public Checkpoint getCheckpoint() {
return checkpoint;
@@ -72,12 +72,12 @@ implements Serializable,
private static final long serialVersionUID = 1L;
// ApplicationContextAware implementation, for eventing
AbstractApplicationContext appCtx;
protected AbstractApplicationContext appCtx;
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.appCtx = (AbstractApplicationContext)applicationContext;
}
CrawlMetadata metadata;
protected CrawlMetadata metadata;
public CrawlMetadata getMetadata() {
return metadata;
}
@@ -181,7 +181,7 @@ implements Serializable,
/**
* Maximum number of threads processing URIs at the same time.
*/
int maxToeThreads;
protected int maxToeThreads;
public int getMaxToeThreads() {
return maxToeThreads;
}
@@ -194,7 +194,7 @@ implements Serializable,
}
/** whether to keep running (without pause or finish) when frontier is empty */
boolean runWhileEmpty = false;
protected boolean runWhileEmpty = false;
public boolean getRunWhileEmpty() {
return runWhileEmpty;
}
@@ -203,7 +203,7 @@ implements Serializable,
}
/** whether to pause at crawl start */
boolean pauseAtStart = true;
protected boolean pauseAtStart = true;
public boolean getPauseAtStart() {
return pauseAtStart;
}
@@ -215,7 +215,7 @@ implements Serializable,
* Size in bytes of in-memory buffer to record outbound traffic. One such
* buffer is reserved for every ToeThread.
*/
int recorderOutBufferBytes = 16 * 1024; // 16KiB
protected int recorderOutBufferBytes = 16 * 1024; // 16KiB
public int getRecorderOutBufferBytes() {
return recorderOutBufferBytes;
}
@@ -227,7 +227,7 @@ implements Serializable,
* Size in bytes of in-memory buffer to record inbound traffic. One such
* buffer is reserved for every ToeThread.
*/
int recorderInBufferBytes = 512 * 1024; // 512KiB
protected int recorderInBufferBytes = 512 * 1024; // 512KiB
public int getRecorderInBufferBytes() {
return recorderInBufferBytes;
}
@@ -274,7 +274,7 @@ implements Serializable,
public CrawlController() {
}
transient AlertThreadGroup alertThreadGroup;
transient protected AlertThreadGroup alertThreadGroup;
public void start() {
// cache AlertThreadGroup for later ToePool launch
@@ -300,7 +300,7 @@ implements Serializable,
isRunning = true;
}
boolean isRunning = false;
protected boolean isRunning = false;
public boolean isRunning() {
return isRunning;
}
@@ -328,13 +328,13 @@ implements Serializable,
// TODO: provide better knowledge/guard against twice-starting
boolean hasStarted = false;
protected boolean hasStarted = false;
public boolean hasStarted() {
return hasStarted;
}
boolean isStopComplete = false;
protected boolean isStopComplete = false;
public boolean isStopComplete() {
return isStopComplete;
}
@@ -666,7 +666,7 @@ implements Serializable,
public void startCheckpoint(Checkpoint checkpointInProgress) {}
public void doCheckpoint(Checkpoint checkpointInProgress) throws IOException {}
public void finishCheckpoint(Checkpoint checkpointInProgress) {}
Checkpoint recoveryCheckpoint;
protected Checkpoint recoveryCheckpoint;
public void setRecoveryCheckpoint(Checkpoint recoveryCheckpoint) {
this.recoveryCheckpoint = recoveryCheckpoint;
}
@@ -85,15 +85,15 @@ public class CrawlJob implements Comparable<CrawlJob>, ApplicationListener<Appli
private final static Logger LOGGER =
Logger.getLogger(CrawlJob.class.getName());
File primaryConfig;
PathSharingContext ac;
int launchCount;
boolean isLaunchInfoPartial;
DateTime lastLaunch;
AlertThreadGroup alertThreadGroup;
protected File primaryConfig;
protected PathSharingContext ac;
protected int launchCount;
protected boolean isLaunchInfoPartial;
protected DateTime lastLaunch;
protected AlertThreadGroup alertThreadGroup;
DateTime xmlOkAt = new DateTime(0L);
Logger jobLogger;
protected DateTime xmlOkAt = new DateTime(0L);
protected Logger jobLogger;
public CrawlJob(File cxml) {
primaryConfig = cxml;
@@ -39,7 +39,7 @@ public class CrawlLimitEnforcer implements ApplicationListener {
* Maximum number of bytes to download. Once this number is exceeded
* the crawler will stop. A value of zero means no upper limit.
*/
long maxBytesDownload = 0L;
protected long maxBytesDownload = 0L;
public long getMaxBytesDownload() {
return maxBytesDownload;
}
@@ -51,7 +51,7 @@ public class CrawlLimitEnforcer implements ApplicationListener {
* Maximum number of documents to download. Once this number is exceeded the
* crawler will stop. A value of zero means no upper limit.
*/
long maxDocumentsDownload = 0L;
protected long maxDocumentsDownload = 0L;
public long getMaxDocumentsDownload() {
return maxDocumentsDownload;
}
@@ -63,7 +63,7 @@ public class CrawlLimitEnforcer implements ApplicationListener {
* Maximum amount of time to crawl (in seconds). Once this much time has
* elapsed the crawler will stop. A value of zero means no upper limit.
*/
long maxTimeSeconds = 0L;
protected long maxTimeSeconds = 0L;
public long getMaxTimeSeconds() {
return maxTimeSeconds;
}
@@ -79,7 +79,7 @@ public abstract class Scoper extends Processor implements Lifecycle {
super();
}
boolean isRunning = false;
protected boolean isRunning = false;
public void start() {
if(isRunning) {
return;
@@ -94,7 +94,7 @@ public abstract class AbstractFrontier
private static final Logger logger = Logger
.getLogger(AbstractFrontier.class.getName());
KeyedProperties kp = new KeyedProperties();
protected KeyedProperties kp = new KeyedProperties();
public KeyedProperties getKeyedProperties() {
return kp;
}
@@ -233,7 +233,7 @@ public abstract class AbstractFrontier
this.scope = scope;
}
FrontierPreparer preparer;
protected FrontierPreparer preparer;
public FrontierPreparer getFrontierPreparer() {
return this.preparer;
}
@@ -298,12 +298,12 @@ public abstract class AbstractFrontier
* of URI queues and queues/maps of queues for proper ordering/delay of
* URI processing.
*/
Thread managerThread;
protected Thread managerThread;
/** last Frontier.State reached; used to suppress duplicate notifications */
State lastReachedState = null;
protected State lastReachedState = null;
/** Frontier.state that manager thread should seek to reach */
volatile State targetState = State.PAUSE;
protected volatile State targetState = State.PAUSE;
/**
* Start the dedicated thread with an independent view of the frontier's
@@ -86,12 +86,12 @@ implements Checkpointable, BeanNameAware {
this.bdb = bdb;
}
String beanName;
protected String beanName;
public void setBeanName(String name) {
this.beanName = name;
}
boolean dumpPendingAtClose = false;
protected boolean dumpPendingAtClose = false;
public boolean getDumpPendingAtClose() {
return dumpPendingAtClose;
}
@@ -103,7 +103,7 @@ implements Checkpointable, BeanNameAware {
* @see org.archive.crawler.frontier.WorkQueueFrontier#getInactiveQueuesByPrecedence()
*/
@Override
SortedMap<Integer, Queue<String>> getInactiveQueuesByPrecedence() {
protected SortedMap<Integer, Queue<String>> getInactiveQueuesByPrecedence() {
return inactiveQueuesByPrecedence;
}
@@ -111,7 +111,7 @@ implements Checkpointable, BeanNameAware {
* @see org.archive.crawler.frontier.WorkQueueFrontier#getRetiredQueues()
*/
@Override
Queue<String> getRetiredQueues() {
protected Queue<String> getRetiredQueues() {
return retiredQueues;
}
@@ -276,7 +276,7 @@ implements Checkpointable, BeanNameAware {
dispositionInProgressLock.writeLock().unlock();
}
Checkpoint recoveryCheckpoint;
protected Checkpoint recoveryCheckpoint;
@Autowired(required=false)
public void setRecoveryCheckpoint(Checkpoint checkpoint) {
this.recoveryCheckpoint = checkpoint;
@@ -357,14 +357,14 @@ implements Checkpointable, BeanNameAware {
* @see org.archive.crawler.frontier.WorkQueueFrontier#createInactiveQueueForPrecedence(int)
*/
@Override
Queue<String> createInactiveQueueForPrecedence(int precedence) {
protected Queue<String> createInactiveQueueForPrecedence(int precedence) {
return createInactiveQueueForPrecedence(precedence, false);
}
/**
* Optionally reuse prior data, for use when resuming from a checkpoint
*/
Queue<String> createInactiveQueueForPrecedence(int precedence, boolean usePriorData) {
protected Queue<String> createInactiveQueueForPrecedence(int precedence, boolean usePriorData) {
return bdb.getStoredQueue("inactiveQueues-"+precedence, String.class, usePriorData);
}
@@ -386,7 +386,7 @@ public class BdbMultipleWorkQueues {
* @param classKey String key to derive origin byte key from
* @return a byte array key
*/
static byte[] calculateOriginKey(String classKey) {
protected static byte[] calculateOriginKey(String classKey) {
byte[] classKeyBytes = null;
int len = 0;
try {
@@ -422,7 +422,7 @@ public class BdbMultipleWorkQueues {
* @param curi
* @return a DatabaseEntry key for the CrawlURI
*/
static DatabaseEntry calculateInsertKey(CrawlURI curi) {
protected static DatabaseEntry calculateInsertKey(CrawlURI curi) {
byte[] classKeyBytes = null;
int len = 0;
classKeyBytes = curi.getClassKey().getBytes(Charsets.UTF_8);
@@ -441,7 +441,7 @@ public class BdbMultipleWorkQueues {
}
static String insertKeyToString(DatabaseEntry holderKey) {
protected static String insertKeyToString(DatabaseEntry holderKey) {
StringBuilder result = new StringBuilder();
byte[] data = holderKey.getData();
int p = findFirstZero(data);
@@ -503,7 +503,7 @@ public class BdbMultipleWorkQueues {
* need access.
* @see <a href="http://www.sleepycat.com/jedocs/GettingStartedGuide/DB.html">Deferred Write Databases</a>
*/
void sync() {
protected void sync() {
if (this.pendingUrisDB == null) {
return;
}
@@ -33,7 +33,7 @@ import org.archive.spring.KeyedProperties;
public abstract class QueueAssignmentPolicy implements Serializable, HasKeyedProperties {
private static final long serialVersionUID = 1L;
KeyedProperties kp = new KeyedProperties();
protected KeyedProperties kp = new KeyedProperties();
public KeyedProperties getKeyedProperties() {
return kp;
}
@@ -40,7 +40,7 @@ public class RecyclingSerialBinding<K> extends SerialBinding<K> {
/**
* Thread-local cache of reusable FastOutputStream
*/
ThreadLocal<FastOutputStream> fastOutputStreamHolder
protected ThreadLocal<FastOutputStream> fastOutputStreamHolder
= new ThreadLocal<FastOutputStream>();
private ClassCatalog classCatalog;
@@ -38,7 +38,7 @@ implements
//for when neat class-key fails us
protected static String DEFAULT_CLASS_KEY = "default...";
LongToIntConsistentHash conhash = new LongToIntConsistentHash();
protected LongToIntConsistentHash conhash = new LongToIntConsistentHash();
/**
* Whether to always defer to a previously-assigned key inside
@@ -211,7 +211,7 @@ public abstract class WorkQueue implements Frontier.FrontierGroup,
*
* @param balance to use
*/
void setSessionBudget(int budget) {
protected void setSessionBudget(int budget) {
this.sessionBudget = budget;
}
@@ -248,7 +248,7 @@ public abstract class WorkQueue implements Frontier.FrontierGroup,
*
* @param budget
*/
void setTotalBudget(long budget) {
protected void setTotalBudget(long budget) {
this.totalBudget = budget;
}
@@ -609,7 +609,7 @@ public abstract class WorkQueue implements Frontier.FrontierGroup,
*
* @param b new value for retired status
*/
void setRetired(boolean b) {
protected void setRetired(boolean b) {
this.retired = b;
}
@@ -98,7 +98,7 @@ implements Closeable,
* will be "long snoozed" instead of "short snoozed". A "long snoozed"
* queue may be swapped to disk because it's not needed soon.
*/
long snoozeLongMs = 5L*60L*1000L;
protected long snoozeLongMs = 5L*60L*1000L;
public long getSnoozeLongMs() {
return snoozeLongMs;
}
@@ -110,7 +110,7 @@ implements Closeable,
Logger.getLogger(WorkQueueFrontier.class.getName());
// ApplicationContextAware implementation, for eventing
AbstractApplicationContext appCtx;
protected AbstractApplicationContext appCtx;
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.appCtx = (AbstractApplicationContext)applicationContext;
}
@@ -482,14 +482,14 @@ implements Closeable,
* Return a sorted map of all queues of WorkQueue keys, keyed by precedence
* @return SortedMap<Integer, Queue<String>> of inactiveQueues
*/
abstract SortedMap<Integer, Queue<String>> getInactiveQueuesByPrecedence();
protected abstract SortedMap<Integer, Queue<String>> getInactiveQueuesByPrecedence();
/**
* Create an inactiveQueue to hold queue names at the given precedence
* @param precedence
* @return Queue<String> for names of inactive queues
*/
abstract Queue<String> createInactiveQueueForPrecedence(int precedence);
protected abstract Queue<String> createInactiveQueueForPrecedence(int precedence);
/**
* Put the given queue on the retiredQueues queue
@@ -513,7 +513,7 @@ implements Closeable,
*
* @return Queue<String> of retired queue names
*/
abstract Queue<String> getRetiredQueues();
protected abstract Queue<String> getRetiredQueues();
/**
* Accommodate any changes in retirement-determining settings (like
@@ -25,7 +25,7 @@ package org.archive.crawler.frontier.precedence;
public class SimplePrecedenceProvider extends PrecedenceProvider {
private static final long serialVersionUID = 3132028374638763487L;
int precedence;
protected int precedence;
public SimplePrecedenceProvider(int p) {
this.precedence = p;
@@ -61,7 +61,7 @@ public class MigrateH1to3Tool {
protected Document sourceOrderXmlDom;
static DocumentBuilder DOCUMENT_BUILDER;
protected static DocumentBuilder DOCUMENT_BUILDER;
static {
try {
@@ -34,11 +34,11 @@ import org.springframework.context.ApplicationListener;
public class DiskSpaceMonitor implements ApplicationListener {
private static final Logger logger = Logger.getLogger(DiskSpaceMonitor.class.getName());
List<String> monitorPaths = new ArrayList<String>();
long pauseThresholdMiB = 500;
CrawlController controller;
ConfigPathConfigurer configPathConfigurer;
boolean monitorConfigPaths = true;
protected List<String> monitorPaths = new ArrayList<String>();
protected long pauseThresholdMiB = 500;
protected CrawlController controller;
protected ConfigPathConfigurer configPathConfigurer;
protected boolean monitorConfigPaths = true;
/**
* @param monitorPaths List of filesystem paths that should be monitored for available space.
@@ -151,7 +151,7 @@ public class DispositionProcessor extends Processor {
* Auto-discovered module providing configured (or overridden)
* User-Agent value and RobotsHonoringPolicy
*/
CrawlMetadata metadata;
protected CrawlMetadata metadata;
public CrawlMetadata getMetadata() {
return metadata;
}
@@ -67,7 +67,7 @@ public class LowDiskPauseProcessor extends Processor {
* List of filessystem mounts whose 'available' space should be monitored
* via 'df' (if available).
*/
List<String> monitorMounts = new ArrayList<String>();
protected List<String> monitorMounts = new ArrayList<String>();
public List<String> getMonitorMounts() {
return this.monitorMounts;
}
@@ -79,7 +79,7 @@ public class LowDiskPauseProcessor extends Processor {
* When available space on any monitored mounts falls below this threshold,
* the crawl will be paused.
*/
int pauseThresholdKb = 500*1024; // 500MB
protected int pauseThresholdKb = 500*1024; // 500MB
public int getPauseThresholdKb() {
return this.pauseThresholdKb;
}
@@ -91,7 +91,7 @@ public class LowDiskPauseProcessor extends Processor {
* Available space via 'df' is rechecked after every increment of this much
* content (uncompressed) is observed.
*/
int recheckThresholdKb = 200*1024; // 200MB
protected int recheckThresholdKb = 200*1024; // 200MB
public int getRecheckThresholdKb() {
return this.recheckThresholdKb;
}
@@ -104,7 +104,7 @@ public class PreconditionEnforcer extends Processor {
* Auto-discovered module providing configured (or overridden)
* User-Agent value and RobotsHonoringPolicy
*/
CrawlMetadata metadata;
protected CrawlMetadata metadata;
public CrawlMetadata getMetadata() {
return metadata;
}
@@ -99,7 +99,7 @@ public class RuntimeLimitEnforcer extends Processor {
* The amount of time, in seconds, that the crawl will be allowed to run
* before this processor performs it's 'end operation.'
*/
long runtimeSeconds = 24*60*60L; // 1 day
protected long runtimeSeconds = 24*60*60L; // 1 day
public long getRuntimeSeconds() {
return this.runtimeSeconds;
}
@@ -122,7 +122,7 @@ public class RuntimeLimitEnforcer extends Processor {
* processor) fetch status code. This will cause all the URIs queued to wind
* up in the crawl.log.
*/
Operation expirationOperation = Operation.PAUSE;
protected Operation expirationOperation = Operation.PAUSE;
public Operation getExpirationOperation() {
return this.expirationOperation;
}
@@ -84,7 +84,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
* Whether to apply the mapping to a URI being processed itself, for example
* early in processing (while its status is still 'unattempted').
*/
boolean checkUri = true;
protected boolean checkUri = true;
public boolean getCheckUri() {
return this.checkUri;
}
@@ -96,7 +96,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
* Whether to apply the mapping to discovered outlinks, for example after
* extraction has occurred.
*/
boolean checkOutlinks = true;
protected boolean checkOutlinks = true;
public boolean getCheckOutlinks() {
return this.checkOutlinks;
}
@@ -107,7 +107,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
/**
* Decide rules to determine if an outlink is subject to mapping.
*/
DecideRule outlinkRule = new AcceptDecideRule();
protected DecideRule outlinkRule = new AcceptDecideRule();
public DecideRule getOutlinkRule() {
return this.outlinkRule;
}
@@ -119,7 +119,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
* Name of local crawler node; mappings to this name result in normal
* processing (no diversion).
*/
String localName = ".";
protected String localName = ".";
public String getLocalName() {
return this.localName;
}
@@ -130,7 +130,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
/**
* Directory to write diversion logs.
*/
ConfigPath diversionDir =
protected ConfigPath diversionDir =
new ConfigPath("diverted URIs subdirectory","diversions");
public ConfigPath getDiversionDir() {
return this.diversionDir;
@@ -145,7 +145,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
* rotation).
*
*/
int rotationDigits = 10;
protected int rotationDigits = 10;
public int getRotationDigits() {
return this.rotationDigits;
}
@@ -156,7 +156,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
/**
* Mapping of target crawlers to logs (PrintWriters)
*/
HashMap<String,PrintWriter> diversionLogs
protected HashMap<String,PrintWriter> diversionLogs
= new HashMap<String,PrintWriter>();
/**
@@ -164,7 +164,7 @@ public abstract class CrawlMapper extends Processor implements Lifecycle {
* current time doesn't match, it's time to close all
* current logs.
*/
String logGeneration = "";
protected String logGeneration = "";
protected ArrayLongFPCache cache;
@@ -52,7 +52,7 @@ public class HashCrawlMapper extends CrawlMapper {
* Number of crawlers among which to split up the URIs. Their names are
* assumed to be 0..N-1.
*/
long crawlerCount = 1L;
protected long crawlerCount = 1L;
public long getCrawlerCount() {
return this.crawlerCount;
}
@@ -86,7 +86,7 @@ public class LexicalCrawlMapper extends CrawlMapper {
* range, the second the crawler node to which URIs in the key range should
* be mapped. This setting is ignored if MAP_URI is specified.
*/
ConfigPath mapPath = new ConfigPath("map specification file","lexicalcrawlmapper.config");
protected ConfigPath mapPath = new ConfigPath("map specification file","lexicalcrawlmapper.config");
public ConfigPath getMapPath() {
return this.mapPath;
}
@@ -102,7 +102,7 @@ public class LexicalCrawlMapper extends CrawlMapper {
* be mapped. This setting takes precedence over MAP_PATH; if both are
* specified, then MAP_PATH is ignored.
*/
String mapUri = "";
protected String mapUri = "";
public String getMapUri() {
return this.mapUri;
}
@@ -123,7 +123,7 @@ public class LexicalCrawlMapper extends CrawlMapper {
* Mapping of classKey ranges (as represented by their start) to
* crawlers (by abstract name/filename)
*/
TreeMap<String, String> map = new TreeMap<String, String>();
protected TreeMap<String, String> map = new TreeMap<String, String>();
/**
* Constructor.
@@ -76,7 +76,7 @@ public class CrawlerLoggerModule
* Whether to include the "extra info" field for each entry in crawl.log.
* "Extra info" is arbitrary JSON. It is the last field of the log line.
*/
boolean logExtraInfo = false;
protected boolean logExtraInfo = false;
public boolean getLogExtraInfo() {
return logExtraInfo;
}
@@ -221,7 +221,7 @@ public class CrawlerLoggerModule
isRunning = true;
}
boolean isRunning = false;
protected boolean isRunning = false;
public boolean isRunning() {
return this.isRunning;
}
@@ -386,7 +386,7 @@ public class CrawlerLoggerModule
public void finishCheckpoint(Checkpoint checkpointInProgress) {}
Checkpoint recoveryCheckpoint;
protected Checkpoint recoveryCheckpoint;
@Autowired(required=false)
public void setRecoveryCheckpoint(Checkpoint checkpoint) {
this.recoveryCheckpoint = checkpoint;
@@ -180,7 +180,7 @@ public class StatisticsTracker
this.liveHostReportSize = liveHostReportSize;
}
ApplicationContext appCtx;
protected ApplicationContext appCtx;
public void setApplicationContext(ApplicationContext appCtx) throws BeansException {
this.appCtx = appCtx;
}
@@ -195,7 +195,7 @@ public class StatisticsTracker
* Whether to maintain seed disposition records (expensive in
* crawls with millions of seeds)
*/
boolean trackSeeds = true;
protected boolean trackSeeds = true;
public boolean getTrackSeeds() {
return this.trackSeeds;
}
@@ -208,7 +208,7 @@ public class StatisticsTracker
* crawls with large numbers of source-tags (seeds) or large crawls
* over many hosts
*/
boolean trackSources = true;
protected boolean trackSources = true;
public boolean getTrackSources() {
return this.trackSources;
}
@@ -219,7 +219,7 @@ public class StatisticsTracker
/**
* The interval between writing progress information to log.
*/
int intervalSeconds = 20;
protected int intervalSeconds = 20;
public int getIntervalSeconds() {
return this.intervalSeconds;
}
@@ -231,7 +231,7 @@ public class StatisticsTracker
* Number of crawl-stat sample snapshots to keep for calculation
* purposes.
*/
int keepSnapshotsCount = 5;
protected int keepSnapshotsCount = 5;
public int getKeepSnapshotsCount() {
return this.keepSnapshotsCount;
}
@@ -249,24 +249,24 @@ public class StatisticsTracker
}
/** wall-clock time the crawl started */
long crawlStartTime;
protected long crawlStartTime;
/** wall-clock time the crawl ended */
long crawlEndTime = -1; // Until crawl ends, this value is -1.
protected long crawlEndTime = -1; // Until crawl ends, this value is -1.
/** wall-clock time of last pause, while pause in progres */
long crawlPauseStarted = 0;
protected long crawlPauseStarted = 0;
/** duration tally of all time spent in paused state */
long crawlTotalPausedTime = 0;
protected long crawlTotalPausedTime = 0;
/** snapshots of crawl tallies and rates */
LinkedList<CrawlStatSnapshot> snapshots = new LinkedList<CrawlStatSnapshot>();
protected LinkedList<CrawlStatSnapshot> snapshots = new LinkedList<CrawlStatSnapshot>();
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
protected ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
/*
* Cumulative data
*/
/** tally sizes novel, verified (same hash), vouched (not-modified) */
CrawledBytesHistotable crawledBytes = new CrawledBytesHistotable();
protected CrawledBytesHistotable crawledBytes = new CrawledBytesHistotable();
public CrawledBytesHistotable getCrawledBytes() {
return crawledBytes;
@@ -298,8 +298,8 @@ public class StatisticsTracker
*/
protected ObjectIdentityCache<SeedRecord> processedSeedsRecords =
new ObjectIdentityMemCache<SeedRecord>();
long seedsTotal = -1;
long seedsCrawled = -1;
protected long seedsTotal = -1;
protected long seedsCrawled = -1;
public StatisticsTracker() {
@@ -330,7 +330,7 @@ public class StatisticsTracker
this.reports = reports;
}
boolean isRunning = false;
protected boolean isRunning = false;
public boolean isRunning() {
return isRunning;
}
@@ -1053,7 +1053,7 @@ public class StatisticsTracker
}
// BeanNameAware
String beanName;
protected String beanName;
public void setBeanName(String name) {
this.beanName = name;
}
@@ -1093,7 +1093,7 @@ public class StatisticsTracker
}
}
public void finishCheckpoint(Checkpoint checkpointInProgress) {}
Checkpoint recoveryCheckpoint;
protected Checkpoint recoveryCheckpoint;
public void setRecoveryCheckpoint(Checkpoint recoveryCheckpoint) {
this.recoveryCheckpoint = recoveryCheckpoint;
}
@@ -55,8 +55,8 @@ import org.springframework.beans.BeansException;
* @contributor nlevitt
*/
public class BeanBrowseResource extends JobRelatedResource {
PathSharingContext appCtx;
String beanPath;
protected PathSharingContext appCtx;
protected String beanPath;
public BeanBrowseResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
@@ -40,8 +40,8 @@ import org.restlet.resource.FileRepresentation;
* @contributor gojomo
*/
public class EditRepresentation extends CharacterRepresentation {
FileRepresentation fileRepresentation;
EnhDirectoryResource dirResource;
protected FileRepresentation fileRepresentation;
protected EnhDirectoryResource dirResource;
public EditRepresentation(FileRepresentation representation, EnhDirectoryResource resource) {
super(MediaType.TEXT_HTML);
@@ -48,7 +48,7 @@ import org.restlet.util.Template;
* @contributor gojomo
*/
public class EngineApplication extends Application {
Engine engine;
protected Engine engine;
public EngineApplication(Engine engine) {
this.engine = engine;
getMetadataService().addExtension("log", MediaType.TEXT_PLAIN );
@@ -76,7 +76,7 @@ public class EngineApplication extends Application {
getContext(),
engine.getJobsDir().toURI().toString() /*TODO: changeme*/) {
@Override
Reference determineRootRef(Request request) {
protected Reference determineRootRef(Request request) {
String ref = "file:/";
return new Reference(ref);
}};
@@ -90,7 +90,7 @@ public class EngineApplication extends Application {
getContext(),
engine.getJobsDir().toURI().toString() /*TODO: changeme*/) {
@Override
Reference determineRootRef(Request request) {
protected Reference determineRootRef(Request request) {
try {
return new Reference(
EngineApplication.this.getEngine()
@@ -40,9 +40,9 @@ import org.restlet.data.Response;
* @contributor gojomo
*/
public abstract class EnhDirectory extends org.restlet.Directory {
IOFileFilter editFilter = FileFilterUtils.falseFileFilter();
IOFileFilter pageFilter = FileFilterUtils.falseFileFilter();
IOFileFilter tailFilter = FileFilterUtils.falseFileFilter();
protected IOFileFilter editFilter = FileFilterUtils.falseFileFilter();
protected IOFileFilter pageFilter = FileFilterUtils.falseFileFilter();
protected IOFileFilter tailFilter = FileFilterUtils.falseFileFilter();
public EnhDirectory(Context context, Reference rootLocalReference) {
super(context, rootLocalReference);
@@ -72,7 +72,7 @@ public abstract class EnhDirectory extends org.restlet.Directory {
return retVal;
}
abstract Reference determineRootRef(Request request);
protected abstract Reference determineRootRef(Request request);
public boolean allowsEdit(File file) {
return editFilter.accept(file);
@@ -46,8 +46,8 @@ public class Flash {
/** usual types */
public enum Kind {ACK, NACK, ADVISORY}
static long nextdrop = RandomUtils.nextLong();
static Map<Long,Flash> dropboxes = new LinkedHashMap<Long, Flash>() {
protected static long nextdrop = RandomUtils.nextLong();
protected static Map<Long,Flash> dropboxes = new LinkedHashMap<Long, Flash>() {
private static final long serialVersionUID = 1L;
@Override
protected boolean removeEldestEntry(Entry<Long, Flash> eldest) {
@@ -55,9 +55,9 @@ import org.springframework.beans.InvalidPropertyException;
* @contributor nlevitt
*/
public abstract class JobRelatedResource extends BaseResource {
CrawlJob cj;
protected CrawlJob cj;
IdentityHashMap<Object, String> beanToNameMap;
protected IdentityHashMap<Object, String> beanToNameMap;
public JobRelatedResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
@@ -517,7 +517,7 @@ public abstract class JobRelatedResource extends BaseResource {
}
/** suppress problematic properties */
static HashSet<String> HIDDEN_PROPS = new HashSet<String>(
protected static HashSet<String> HIDDEN_PROPS = new HashSet<String>(
Arrays.asList(new String[]
{"class","declaringClass","keyedProperties","running","first","last","empty", "inbound", "outbound", "cookiesMap"}
));
@@ -50,24 +50,24 @@ import org.restlet.resource.FileRepresentation;
public class PagedRepresentation extends CharacterRepresentation {
// passed-in at construction
/** wrapped FileRepresentation **/
FileRepresentation fileRepresentation;
protected FileRepresentation fileRepresentation;
/** wrapped EnhDirectoryResource; used to formulate self-links **/
EnhDirectoryResource dirResource;
protected EnhDirectoryResource dirResource;
/** position in file around which to fetch lines **/
long position;
protected long position;
/** desired line count; negative to go back from position; default 128 **/
int lineCount;
protected int lineCount;
/** whether to display lines in reversed order (latest first) **/
boolean reversedOrder;
protected boolean reversedOrder;
// created when file is scanned
/** text lines **/
List<String> lines;
protected List<String> lines;
/** position range [start-of-first-line, past-end-of-last-line] in file **/
LongRange range;
protected LongRange range;
/** File **/
File file;
protected File file;
// TODO: maybe, freeze length for more consistent display of growing files
// (now, as length/%/bumper are written after lines retrieved, they
// sometimes are indicative the file has grown before the page is
@@ -37,7 +37,7 @@ public class RateLimitGuard extends Guard {
private static final Logger logger = Logger.getLogger(RateLimitGuard.class.getName());
long lastFailureTime = 0;
protected long lastFailureTime = 0;
public RateLimitGuard(Context context, ChallengeScheme scheme, String realm) throws IllegalArgumentException {
super(context, scheme, realm);
@@ -37,7 +37,7 @@ import org.restlet.resource.Variant;
* @contributor gojomo
*/
public class ReportGenResource extends JobRelatedResource {
String reportClass;
protected String reportClass;
public ReportGenResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
@@ -62,9 +62,9 @@ import org.restlet.resource.WriterRepresentation;
* @contributor gojomo
*/
public class ScriptResource extends JobRelatedResource {
static ScriptEngineManager MANAGER = new ScriptEngineManager();
protected static ScriptEngineManager MANAGER = new ScriptEngineManager();
// oddly, ordering is different each call to getEngineFactories, so cache
static LinkedList<ScriptEngineFactory> FACTORIES = new LinkedList<ScriptEngineFactory>();
protected static LinkedList<ScriptEngineFactory> FACTORIES = new LinkedList<ScriptEngineFactory>();
static {
FACTORIES.addAll(MANAGER.getEngineFactories());
// Sort factories alphabetically so that they appear in the UI consistently
@@ -75,12 +75,12 @@ public class ScriptResource extends JobRelatedResource {
}
});
}
String script = "";
Exception ex = null;
int linesExecuted = 0;
String rawOutput = "";
String htmlOutput = "";
String chosenEngine = FACTORIES.isEmpty() ? "" : FACTORIES.getFirst().getNames().get(0);
protected String script = "";
protected Exception ex = null;
protected int linesExecuted = 0;
protected String rawOutput = "";
protected String htmlOutput = "";
protected String chosenEngine = FACTORIES.isEmpty() ? "" : FACTORIES.getFirst().getNames().get(0);
public ScriptResource(Context ctx, Request req, Response res) throws ResourceException {
super(ctx, req, res);
@@ -32,8 +32,8 @@ import org.springframework.core.Ordered;
*/
public class DecideRuledSheetAssociation extends SheetAssociation
implements Ordered, Comparable<DecideRuledSheetAssociation>, BeanNameAware {
DecideRule rules;
int order = 0;
protected DecideRule rules;
protected int order = 0;
public DecideRule getRules() {
return rules;
@@ -59,7 +59,7 @@ implements Ordered, Comparable<DecideRuledSheetAssociation>, BeanNameAware {
return name.compareTo(o.name);
}
String name;
protected String name;
public void setBeanName(String name) {
this.name = name;
}
@@ -32,7 +32,7 @@ import java.util.List;
* @contributor gojomo
*/
public abstract class SheetAssociation {
List<String> targetSheetNames = new LinkedList<String>();
protected List<String> targetSheetNames = new LinkedList<String>();
public List<String> getTargetSheetNames() {
return targetSheetNames;
}
@@ -57,14 +57,14 @@ BeanFactoryAware, OverlayMapsSource, ApplicationListener {
private static final Logger logger = Logger.getLogger(SheetOverlaysManager.class.getName());
BeanFactory beanFactory;
protected BeanFactory beanFactory;
/** all SheetAssociations by DecideRule evaluation */
SortedSet<DecideRuledSheetAssociation> ruleAssociations =
protected SortedSet<DecideRuledSheetAssociation> ruleAssociations =
new ConcurrentSkipListSet<DecideRuledSheetAssociation>();
NavigableMap<String,List<String>> sheetNamesBySurt = new ConcurrentSkipListMap<String,List<String>>();
protected NavigableMap<String,List<String>> sheetNamesBySurt = new ConcurrentSkipListMap<String,List<String>>();
/** all sheets by (bean)name*/
Map<String,Sheet> sheetsByName = new ConcurrentHashMap<String, Sheet>();
protected Map<String,Sheet> sheetsByName = new ConcurrentHashMap<String, Sheet>();
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
@@ -29,7 +29,7 @@ import org.springframework.beans.factory.annotation.Required;
* @contributor gojomo
*/
public class SurtPrefixesSheetAssociation extends SheetAssociation {
List<String> surtPrefixes;
protected List<String> surtPrefixes;
public List<String> getSurtPrefixes() {
return surtPrefixes;
@@ -91,7 +91,7 @@ implements Lifecycle, Checkpointable, BeanNameAware, DisposableBean {
this.bdb = bdb;
}
String beanName;
protected String beanName;
public void setBeanName(String name) {
this.beanName = name;
}
@@ -99,7 +99,7 @@ implements Lifecycle, Checkpointable, BeanNameAware, DisposableBean {
public BdbUriUniqFilter() {
}
boolean isRunning = false;
protected boolean isRunning = false;
public void start() {
if(isRunning()) {
return;
@@ -391,7 +391,7 @@ implements Lifecycle, Checkpointable, BeanNameAware, DisposableBean {
}
}
public void finishCheckpoint(Checkpoint checkpointInProgress) {}
Checkpoint recoveryCheckpoint;
protected Checkpoint recoveryCheckpoint;
public void setRecoveryCheckpoint(Checkpoint recoveryCheckpoint) {
this.recoveryCheckpoint = recoveryCheckpoint;
}
@@ -39,7 +39,7 @@ public class BenchmarkUriUniqFilters implements UriUniqFilter.CrawlUriReceiver {
// Logger.getLogger(BenchmarkUriUniqFilters.class.getName());
private BufferedWriter out; // optional to dump uniq items
String current; // current line/URI being checked
protected String current; // current line/URI being checked
/**
* Test the UriUniqFilter implementation (MemUriUniqFilter,
@@ -60,7 +60,7 @@ implements Serializable, InitializingBean {
private static Logger LOGGER =
Logger.getLogger(BloomUriUniqFilter.class.getName());
BloomFilter bloom; // package access for testing convenience
protected BloomFilter bloom; // package access for testing convenience
public BloomFilter getBloomFilter() {
return bloom;
}
@@ -41,13 +41,13 @@ import org.archive.util.ArchiveUtils;
* @author gojomo
*/
public class DiskFPMergeUriUniqFilter extends FPMergeUriUniqFilter {
long count = 0;
File scratchDir;
File currentFps;
File newFpsFile;
DataOutputStream newFps;
long newCount;
DataInputStream oldFps;
protected long count = 0;
protected File scratchDir;
protected File currentFps;
protected File newFpsFile;
protected DataOutputStream newFps;
protected long newCount;
protected DataInputStream oldFps;
public DiskFPMergeUriUniqFilter(File scratchDir) {
super();
@@ -39,7 +39,7 @@ implements Serializable {
private transient FPGenerator fpgen = FPGenerator.std64;
LongFPSet fpset;
protected LongFPSet fpset;
public LongFPSet getFpset() {
return this.fpset;
}
@@ -33,7 +33,7 @@ public enum Logs{
NONFATAL_ERRORS ("nonfatal-errors.log"),
URI_ERRORS ("uri-errors.log");
String filename;
protected String filename;
Logs(String filename){
this.filename = filename;
@@ -30,7 +30,7 @@ import java.util.HashSet;
public class MemUriUniqFilter
extends SetBasedUriUniqFilter {
private static final long serialVersionUID = 1L;
HashSet<CharSequence> hashSet;
protected HashSet<CharSequence> hashSet;
protected synchronized boolean setAdd(CharSequence uri) {
return hashSet.add(uri);
@@ -47,12 +47,12 @@ public class TopNSet implements Serializable {
private static final long serialVersionUID = 1L;
int maxsize;
ConcurrentMap<String, Long> set;
volatile long smallestKnownValue;
volatile String smallestKnownKey;
volatile long largestKnownValue;
volatile String largestKnownKey;
protected int maxsize;
protected ConcurrentMap<String, Long> set;
protected volatile long smallestKnownValue;
protected volatile String smallestKnownKey;
protected volatile long largestKnownValue;
protected volatile String largestKnownKey;
public TopNSet(int size){
maxsize = size;