dk.netarkivet.harvester.harvesting.distribute
Class PersistentJobData

java.lang.Object
  extended by dk.netarkivet.harvester.harvesting.distribute.PersistentJobData

public class PersistentJobData
extends java.lang.Object

Class PersistentJobData holds information about an ongoing harvest. Presently the information is stored in a XML-file.


Nested Class Summary
static class PersistentJobData.HarvestDefinitionInfo
          Innerclass containing Info about a harvestjob.
 
Constructor Summary
PersistentJobData(java.io.File crawlDir)
          Constructor for class PersistentJobData.
 
Method Summary
 boolean exists()
          Returns true, if harvestInfo exists in crawDir, otherwise false.
static boolean existsIn(java.io.File crawlDir)
          Returns true if the given directory exists and contains a harvestInfo file.
 int getJobHarvestNum()
          Return the job harvestNum.
 java.lang.Long getJobID()
          Return the harvestInfo jobID.
 JobPriority getJobPriority()
          Return the job priority.
 long getMaxBytesPerDomain()
          Return the job maxBytesPerDomain value.
 long getMaxObjectsPerDomain()
          Return the job maxObjectsPerDomain value.
 java.lang.String getOrderXMLName()
          Return the job orderXMLName.
 java.lang.Long getOrigHarvestDefinitionID()
          Return the job origHarvestDefinitionID.
 void write(Job harvestJob, PersistentJobData.HarvestDefinitionInfo hdi)
          Write information about given Job to XML-structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentJobData

public PersistentJobData(java.io.File crawlDir)
Constructor for class PersistentJobData.

Parameters:
crawlDir - The directory where the harvestInfo can be found
Throws:
ArgumentNotValid - if crawlDir is null or does not exist.
Method Detail

exists

public boolean exists()
Returns true, if harvestInfo exists in crawDir, otherwise false.

Returns:
true, if harvestInfo exists, otherwise false

existsIn

public static boolean existsIn(java.io.File crawlDir)
Returns true if the given directory exists and contains a harvestInfo file.

Parameters:
crawlDir - A directory that may contain harvestInfo file.
Returns:
True if the harvestInfo file exists.

write

public void write(Job harvestJob,
                  PersistentJobData.HarvestDefinitionInfo hdi)
Write information about given Job to XML-structure.

Parameters:
harvestJob - the given Job
hdi - Information about the harvestJob.
Throws:
IOFailure - if any failure occurs while persisting data, or if the file has already been written.

getJobID

public java.lang.Long getJobID()
Return the harvestInfo jobID.

Returns:
the harvestInfo JobID
Throws:
IOFailure - if no harvestInfo exists or it is invalid.

getJobPriority

public JobPriority getJobPriority()
Return the job priority.

Returns:
the job priority
Throws:
IOFailure - if no harvestInfo exists or it is invalid.

getJobHarvestNum

public int getJobHarvestNum()
Return the job harvestNum.

Returns:
the job harvestNum
Throws:
IOFailure - if no harvestInfo exists or it is invalid.

getOrigHarvestDefinitionID

public java.lang.Long getOrigHarvestDefinitionID()
Return the job origHarvestDefinitionID.

Returns:
the job origHarvestDefinitionID
Throws:
IOFailure - if no harvestInfo exists or it is invalid.

getMaxBytesPerDomain

public long getMaxBytesPerDomain()
Return the job maxBytesPerDomain value.

Returns:
the job maxBytesPerDomain value.
Throws:
IOFailure - if no harvestInfo exists or it is invalid.

getMaxObjectsPerDomain

public long getMaxObjectsPerDomain()
Return the job maxObjectsPerDomain value.

Returns:
the job maxObjectsPerDomain value.
Throws:
IOFailure - if no harvestInfo exists or it is invalid.

getOrderXMLName

public java.lang.String getOrderXMLName()
Return the job orderXMLName.

Returns:
the job orderXMLName.
Throws:
IOFailure - if no harvestInfo exists or it is invalid.