Modifier and Type | Field and Description |
---|---|
protected static String |
GET_JOB_BY_ID_SQL |
Modifier | Constructor and Description |
---|---|
protected |
JobDBDAO()
Create a new JobDAO implemented using database.
|
Modifier and Type | Method and Description |
---|---|
void |
create(Job job)
Creates an instance in persistent storage of the given job.
|
boolean |
exists(Long jobID)
Check whether a particular job exists.
|
Iterator<Job> |
getAll()
Return a list of all jobs.
|
Iterator<Job> |
getAll(JobStatus status)
Return a list of all jobs with the given status, ordered by id.
|
Iterator<Long> |
getAllJobIds()
Return a list of all job_ids .
|
Iterator<Long> |
getAllJobIds(JobStatus status)
Return a list of all job_id's representing jobs with the given status.
|
Iterator<Long> |
getAllJobIds(JobStatus status,
HarvestChannel channel)
Return a list of all job_id's representing jobs with the given status and channel.
|
int |
getCountJobs()
Returns the number of existing jobs.
|
List<AliasInfo> |
getJobAliasInfo(Job job)
Get a list of AliasInfo objects for all the domains included in the job.
|
List<Long> |
getJobIDsForDuplicateReduction(long jobID)
Calculate all jobIDs to use for duplication reduction.
|
JobStatus |
getJobStatus(Long jobID)
Get Jobstatus for the job with the given id.
|
HarvestStatus |
getStatusInfo(HarvestStatusQuery query)
Get a list of small and immediately usable status information for given job status and in given job id order.
|
List<JobStatusInfo> |
getStatusInfo(JobStatus status)
Get a list of small and immediately usable status information for given job status.
|
Job |
read(long jobID)
Read a single job from the job database.
|
long |
rescheduleJob(long oldJobID)
Reschedule a job by creating a new job (in status NEW) and setting the old job to status RESUBMITTED.
|
void |
update(Job job)
Update a Job in persistent storage.
|
getInstance, iterator, reset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected static final String GET_JOB_BY_ID_SQL
protected JobDBDAO()
public void create(Job job)
create
in class JobDAO
job
- a given job to add to persistent storagePermissionDenied
- If a job already exists in persistent storage with the same id as the given jobIOFailure
- If some IOException occurs while writing the job to persistent storagepublic void update(Job job)
update
in class JobDAO
job
- The Job to updateArgumentNotValid
- If the Job is nullUnknownID
- If the Job doesn't exist in the DAOIOFailure
- If writing the job to persistent storage failsPermissionDenied
- If the job has been updated behind our backspublic Iterator<Job> getAll(JobStatus status)
public Iterator<Long> getAllJobIds(JobStatus status)
getAllJobIds
in class JobDAO
status
- A given status.ArgumentNotValid
- If the given status is not one of the five valid statuses specified in Job.public Iterator<Long> getAllJobIds(JobStatus status, HarvestChannel channel)
JobDAO
getAllJobIds
in class JobDAO
status
- A given statuschannel
- A given HarvestChannel
public Iterator<Long> getAllJobIds()
getAllJobIds
in class JobDAO
public List<JobStatusInfo> getStatusInfo(JobStatus status)
getStatusInfo
in class JobDAO
status
- The status asked for.ArgumentNotValid
- for invalid jobStatusIOFailure
- on trouble getting data from databasepublic HarvestStatus getStatusInfo(HarvestStatusQuery query)
getStatusInfo
in class JobDAO
query
- the user queryIOFailure
- on trouble getting data from databasepublic List<Long> getJobIDsForDuplicateReduction(long jobID) throws UnknownID
More precisely, this method calculates the following: If the job ID corresponds to a partial harvest, all jobIDs from the previous scheduled harvest are returned, or the empty list if this harvest hasn't been scheduled before.
If the job ID corresponds to a full harvest, the entire chain of harvests this is based on is returned, and all jobIDs from the previous chain of full harvests is returned.
This method is synchronized to avoid DB locking.
getJobIDsForDuplicateReduction
in class JobDAO
jobID
- The job ID to find duplicate reduction data for.UnknownID
- if job ID is unknownIOFailure
- on trouble querying databasepublic int getCountJobs()
getCountJobs
in class JobDAO
public long rescheduleJob(long oldJobID)
JobDAO
Notice the slightly confusing naming: The only job is marked RESUBMITTED, but the new job is not really submitted, that happens in a separate stage, the new job is in status NEW.
rescheduleJob
in class JobDAO
oldJobID
- ID of a job to reschedulepublic JobStatus getJobStatus(Long jobID)
getJobStatus
in class JobDAO
jobID
- A given JobidUnknownID
- if no job exists with id jobIDpublic List<AliasInfo> getJobAliasInfo(Job job)
getJobAliasInfo
in class JobDAO
Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.