dk.netarkivet.harvester.scheduler.jobgen
Class DefaultJobGenerator

java.lang.Object
  extended by dk.netarkivet.harvester.scheduler.jobgen.AbstractJobGenerator
      extended by dk.netarkivet.harvester.scheduler.jobgen.DefaultJobGenerator
All Implemented Interfaces:
JobGenerator

public class DefaultJobGenerator
extends AbstractJobGenerator

The legacy job generator implementation. Aims at generating jobs that execute in a predictable time by taking advantage of previous crawls statistics.


Nested Class Summary
static class DefaultJobGenerator.CompareConfigsDesc
          Compare two configurations using the following order: 1) Harvest template 2) Byte limit 3) expected number of object a harvest of the configuration will produce.
 
Constructor Summary
DefaultJobGenerator()
           
 
Method Summary
protected  boolean checkSpecificAcceptConditions(Job job, DomainConfiguration cfg)
          Called by AbstractJobGenerator.canAccept(Job, DomainConfiguration).
protected  java.util.Comparator<DomainConfiguration> getDomainConfigurationSubsetComparator(HarvestDefinition harvest)
          Returns a comparator used to sort the subset of AbstractJobGenerator.DOMAIN_CONFIG_SUBSET_SIZE configurations that are scanned at each iteration.
static DefaultJobGenerator getInstance()
           
protected  int processDomainConfigurationSubset(HarvestDefinition harvest, java.util.Iterator<DomainConfiguration> domainConfSubset)
          Create new jobs from a collection of configurations.
static void reset()
          Only to be used by unittests.
 
Methods inherited from class dk.netarkivet.harvester.scheduler.jobgen.AbstractJobGenerator
canAccept, editJobOrderXml, generateJobs, getNewJob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJobGenerator

public DefaultJobGenerator()
Method Detail

getInstance

public static DefaultJobGenerator getInstance()
Returns:
the singleton instance, builds it if necessary.

getDomainConfigurationSubsetComparator

protected java.util.Comparator<DomainConfiguration> getDomainConfigurationSubsetComparator(HarvestDefinition harvest)
Description copied from class: AbstractJobGenerator
Returns a comparator used to sort the subset of AbstractJobGenerator.DOMAIN_CONFIG_SUBSET_SIZE configurations that are scanned at each iteration.

Specified by:
getDomainConfigurationSubsetComparator in class AbstractJobGenerator
Parameters:
harvest - the HarvestDefinition being processed.
Returns:
a comparator

processDomainConfigurationSubset

protected int processDomainConfigurationSubset(HarvestDefinition harvest,
                                               java.util.Iterator<DomainConfiguration> domainConfSubset)
Create new jobs from a collection of configurations. All configurations must use the same order.xml file.Jobs

Specified by:
processDomainConfigurationSubset in class AbstractJobGenerator
Parameters:
harvest - the HarvestDefinition being processed.
domainConfSubset - the configurations to use to create the jobs
Returns:
The number of jobs created
Throws:
ArgumentNotValid - if any of the parameters is null or if the cfglist does not contain any configurations

checkSpecificAcceptConditions

protected boolean checkSpecificAcceptConditions(Job job,
                                                DomainConfiguration cfg)
Description copied from class: AbstractJobGenerator
Called by AbstractJobGenerator.canAccept(Job, DomainConfiguration). Tests the implementation-specific conditions to accept the given DomainConfiguration in the given Job. It is assumed that AbstractJobGenerator.checkAddDomainConfInvariant(Job, DomainConfiguration) has already passed.

Specified by:
checkSpecificAcceptConditions in class AbstractJobGenerator
Parameters:
job - the Job n=being built
cfg - the DomainConfiguration to test
Returns:
true if the configuration passes the conditions.

reset

public static void reset()
Only to be used by unittests.