|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.harvester.datamodel.JobDAO
dk.netarkivet.harvester.datamodel.JobDBDAO
public class JobDBDAO
A database-based implementation of the JobDAO class. If no jobs are found in the database, it will attempt to migrate from the XML-based implementation. The statements to create the tables are now in scripts/sql/createfullhddb.sql
Constructor Summary | |
---|---|
protected |
JobDBDAO()
Create a new JobDAO implemented using database. |
Method Summary | |
---|---|
void |
create(Job job)
Creates an instance in persistent storage of the given job. |
boolean |
exists(java.lang.Long jobID)
Check whether a particular job exists. |
(package private) java.lang.Long |
generateNextID()
Generates the next id of job. |
java.util.Iterator<Job> |
getAll()
Return a list of all jobs . |
java.util.Iterator<Job> |
getAll(JobStatus status)
Return a list of all jobs with the given status, ordered by id. |
java.util.Iterator<java.lang.Long> |
getAllJobIds()
Return a list of all job_ids . |
java.util.Iterator<java.lang.Long> |
getAllJobIds(JobStatus status)
Return a list of all job_id's representing jobs with the given status. |
int |
getCountJobs()
Returns the number of existing jobs. |
java.util.List<java.lang.Long> |
getJobIDsForDuplicateReduction(long jobID)
Calculate all jobIDs to use for duplication reduction. |
java.util.List<JobStatusInfo> |
getStatusInfo()
Get a list of small and immediately usable status information |
java.util.List<JobStatusInfo> |
getStatusInfo(boolean asc)
Get a list of small and immediately usable status information in given job id order. |
java.util.List<JobStatusInfo> |
getStatusInfo(JobStatus status)
Get a list of small and immediately usable status information for given job status. |
java.util.List<JobStatusInfo> |
getStatusInfo(JobStatus status,
boolean asc)
Get a list of small and immediately usable status information for given job status and in given job id order. |
java.util.List<JobStatusInfo> |
getStatusInfo(long harvestId,
long numEvent)
Get a list of small and immediately usable status information for a given harvest run. |
Job |
read(java.lang.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. |
Methods inherited from class dk.netarkivet.harvester.datamodel.JobDAO |
---|
getInstance, iterator, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected JobDBDAO()
Method Detail |
---|
public void create(Job job)
create
in class JobDAO
job
-
PermissionDenied
- If a job already exists in persistent storage
with id of the given job
IOFailure
- If some IOException occurs while
writing the job_public boolean exists(java.lang.Long jobID)
exists
in class JobDAO
jobID
- Id of the job.
java.lang.Long generateNextID()
JobDAO
generateNextID
in class JobDAO
public void update(Job job)
update
in class JobDAO
job
- The Job to update
ArgumentNotValid
- If the Job is null
UnknownID
- If the Job doesn't exist in the DAO
IOFailure
- If writing the job to persistent storage fails
PermissionDenied
- If the job has been updated behind our backspublic Job read(java.lang.Long jobID)
read
in class JobDAO
jobID
- ID of the job.
UnknownID
- if the job id does not exist.
IOFailure
- if there was some problem talking to the database.public java.util.Iterator<Job> getAll(JobStatus status)
getAll
in class JobDAO
status
- A given status.
public java.util.Iterator<java.lang.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 java.util.Iterator<Job> getAll()
getAll
in class JobDAO
public java.util.Iterator<java.lang.Long> getAllJobIds()
getAllJobIds
in class JobDAO
public java.util.List<JobStatusInfo> getStatusInfo()
getStatusInfo
in class JobDAO
IOFailure
- on trouble getting data from databasepublic java.util.List<JobStatusInfo> getStatusInfo(JobStatus status)
getStatusInfo
in class JobDAO
status
- The status asked for.
ArgumentNotValid
- for invalid jobStatus
IOFailure
- on trouble getting data from databasepublic java.util.List<JobStatusInfo> getStatusInfo(boolean asc)
getStatusInfo
in class JobDAO
asc
- True if result must be given in ascending order, false
if result must be given in descending order
IOFailure
- on trouble getting data from databasepublic java.util.List<JobStatusInfo> getStatusInfo(JobStatus status, boolean asc)
getStatusInfo
in class JobDAO
status
- The status asked for.asc
- True if result must be given in ascending order, false
if result must be given in descending order
ArgumentNotValid
- for invalid jobStatusCode
IOFailure
- on trouble getting data from databasepublic java.util.List<JobStatusInfo> getStatusInfo(long harvestId, long numEvent)
getStatusInfo
in class JobDAO
harvestId
- The ID of the harvestnumEvent
- The harvest run number
IOFailure
- on trouble getting data from databasepublic java.util.List<java.lang.Long> getJobIDsForDuplicateReduction(long jobID) throws UnknownID
getJobIDsForDuplicateReduction
in class JobDAO
jobID
- The job ID to find duplicate reduction data for.
UnknownID
- if job ID is unknown
IOFailure
- on trouble querying databasepublic int getCountJobs()
getCountJobs
in class JobDAO
public long rescheduleJob(long oldJobID)
JobDAO
rescheduleJob
in class JobDAO
oldJobID
- ID of a job to reschedule
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |