dk.netarkivet.harvester.scheduler.jobgen
Class FixedDomainConfigurationCountJobGenerator

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

public class FixedDomainConfigurationCountJobGenerator
extends AbstractJobGenerator

Job generator implementation. Generates jobs with a fixed number of domain configurations. Configuration allows to choose a different count for partial and full harvests. The last job generated may have less configurations in it, as job generation happens on a per-harvest basis.

See Also:
HarvesterSettings.JOBGEN_FIXED_CONFIG_COUNT_SNAPSHOT, HarvesterSettings.JOBGEN_FIXED_CONFIG_COUNT_FOCUSED

Field Summary
static FixedDomainConfigurationCountJobGenerator instance
          The singleton instance.
 
Method Summary
protected  boolean checkSpecificAcceptConditions(Job job, DomainConfiguration cfg)
          Called by AbstractJobGenerator.canAccept(Job, DomainConfiguration).
 int generateJobs(HarvestDefinition harvest)
          Generates a series of jobs for the given harvest definition.
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 FixedDomainConfigurationCountJobGenerator getInstance()
           
protected  int processDomainConfigurationSubset(HarvestDefinition harvest, java.util.Iterator<DomainConfiguration> domainConfSubset)
          Create new jobs from a collection of configurations.
 
Methods inherited from class dk.netarkivet.harvester.scheduler.jobgen.AbstractJobGenerator
canAccept, editJobOrderXml, getNewJob
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static FixedDomainConfigurationCountJobGenerator instance
The singleton instance.

Method Detail

getInstance

public static FixedDomainConfigurationCountJobGenerator 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

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.

generateJobs

public int generateJobs(HarvestDefinition harvest)
Description copied from interface: JobGenerator
Generates a series of jobs for the given harvest definition. Note that a job generator is expected to follow the singleton pattern, so implementations of this method should be thread-safe.

Specified by:
generateJobs in interface JobGenerator
Overrides:
generateJobs in class AbstractJobGenerator
Parameters:
harvest - the harvest definition to process.
Returns:
the number of jobs that were generated.

processDomainConfigurationSubset

protected int processDomainConfigurationSubset(HarvestDefinition harvest,
                                               java.util.Iterator<DomainConfiguration> domainConfSubset)
Description copied from class: AbstractJobGenerator
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