Class RunningJobsInfoDBDAO
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.RunningJobsInfoDAO
-
- dk.netarkivet.harvester.datamodel.RunningJobsInfoDBDAO
-
- All Implemented Interfaces:
DAO
public class RunningJobsInfoDBDAO extends RunningJobsInfoDAO
Class implementing the persistence of running job infos.
-
-
Constructor Summary
Constructors Constructor Description RunningJobsInfoDBDAO()
The constructor of RunningJobsInfoDBDAO.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
deleteFrontierReports(long jobId)
Deletes all frontier report data pertaining to the given job id from the persistent storage.InMemoryFrontierReport
getFrontierReport(long jobId, int limit, boolean sort)
Retrieve a frontier report from a job id, with limited results and possibility to sort by totalenqueues DESCInMemoryFrontierReport
getFrontierReport(long jobId, String filterId)
Retrieve a frontier report from a job id and a given filter class.InMemoryFrontierReport
getFrontierReport(long jobId, String filterId, int limit, boolean sort)
Retrieve a frontier report from a job id, with limited results and possibility to sort by totalenqueues DESCString[]
getFrontierReportFilterTypes()
Returns the list of the available frontier report types.StartedJobInfo[]
getFullJobHistory(long jobId)
Returns an array of all progress records chronologically sorted for the given job ID.Set<Long>
getHistoryRecordIds()
Returns the ids of jobs for which history records exist as an immutable set.Map<String,List<StartedJobInfo>>
getMostRecentByHarvestName()
Returns the most recent record for every job, partitioned by harvest definition name.StartedJobInfo
getMostRecentByJobId(long jobId)
Returns the most recent progress record for the given job ID.StartedJobInfo[]
getMostRecentByJobId(long jobId, long startTime, int limit)
Returns an array of chronologically sorted progress records for the given job ID, starting at a given crawl time, and limited to a given number of record.int
removeInfoForJob(long jobId)
Removes all records pertaining to the given job ID from the persistent storage.void
store(StartedJobInfo startedJobInfo)
Stores aStartedJobInfo
record to the persistent storage.int
storeFrontierReport(String filterId, InMemoryFrontierReport report, Long jobId)
Store frontier report data to the persistent storage.-
Methods inherited from class dk.netarkivet.harvester.datamodel.RunningJobsInfoDAO
getInstance
-
-
-
-
Method Detail
-
store
public void store(StartedJobInfo startedJobInfo)
Stores aStartedJobInfo
record to the persistent storage. The record is stored in the monitor table, and if the elapsed time since the last history sample is equal or superior to the history sample rate, also to the history table.- Specified by:
store
in classRunningJobsInfoDAO
- Parameters:
startedJobInfo
- the record to store.
-
getFullJobHistory
public StartedJobInfo[] getFullJobHistory(long jobId)
Returns an array of all progress records chronologically sorted for the given job ID.- Specified by:
getFullJobHistory
in classRunningJobsInfoDAO
- Parameters:
jobId
- the job id.- Returns:
- an array of all progress records chronologically sorted for the given job ID.
-
getMostRecentByHarvestName
public Map<String,List<StartedJobInfo>> getMostRecentByHarvestName()
Returns the most recent record for every job, partitioned by harvest definition name.- Specified by:
getMostRecentByHarvestName
in classRunningJobsInfoDAO
- Returns:
- the full listing of started job information, partitioned by harvest definition name.
-
getHistoryRecordIds
public Set<Long> getHistoryRecordIds()
Returns the ids of jobs for which history records exist as an immutable set.- Specified by:
getHistoryRecordIds
in classRunningJobsInfoDAO
- Returns:
- the ids of jobs for which history records exist.
-
getMostRecentByJobId
public StartedJobInfo[] getMostRecentByJobId(long jobId, long startTime, int limit)
Returns an array of chronologically sorted progress records for the given job ID, starting at a given crawl time, and limited to a given number of record.- Specified by:
getMostRecentByJobId
in classRunningJobsInfoDAO
- Parameters:
jobId
- the job id.startTime
- the crawl time (in seconds) to begin.limit
- the maximum number of records to fetch.- Returns:
- an array of chronologically sorted progress records for the given job ID, starting at a given crawl time, and limited to a given number of record.
-
getMostRecentByJobId
public StartedJobInfo getMostRecentByJobId(long jobId)
Returns the most recent progress record for the given job ID.- Specified by:
getMostRecentByJobId
in classRunningJobsInfoDAO
- Parameters:
jobId
- the job id.- Returns:
- the most recent progress record for the given job ID.
-
removeInfoForJob
public int removeInfoForJob(long jobId)
Removes all records pertaining to the given job ID from the persistent storage.- Specified by:
removeInfoForJob
in classRunningJobsInfoDAO
- Parameters:
jobId
- the job id.- Returns:
- the number of deleted records.
-
storeFrontierReport
public int storeFrontierReport(String filterId, InMemoryFrontierReport report, Long jobId)
Store frontier report data to the persistent storage.- Specified by:
storeFrontierReport
in classRunningJobsInfoDAO
- Parameters:
report
- the report to storefilterId
- the id of the filter that produced the reportjobId
- The ID of the job responsible for this report- Returns:
- the update count
-
getFrontierReportFilterTypes
public String[] getFrontierReportFilterTypes()
Returns the list of the available frontier report types.- Specified by:
getFrontierReportFilterTypes
in classRunningJobsInfoDAO
- Returns:
- the list of the available frontier report types.
- See Also:
FrontierReportFilter.getFilterId()
-
getFrontierReport
public InMemoryFrontierReport getFrontierReport(long jobId, String filterId)
Retrieve a frontier report from a job id and a given filter class.- Specified by:
getFrontierReport
in classRunningJobsInfoDAO
- Parameters:
jobId
- the job idfilterId
- the id of the filter that produced the report- Returns:
- a frontier report
-
getFrontierReport
public InMemoryFrontierReport getFrontierReport(long jobId, String filterId, int limit, boolean sort)
Retrieve a frontier report from a job id, with limited results and possibility to sort by totalenqueues DESC- Specified by:
getFrontierReport
in classRunningJobsInfoDAO
- Parameters:
jobId
- the job idlimit
- the limit of result to queryfilterId
- the id of the filter that produced the reportsort
- if true, sort the results by totalenqueues DESC- Returns:
- a frontier report
-
getFrontierReport
public InMemoryFrontierReport getFrontierReport(long jobId, int limit, boolean sort)
Retrieve a frontier report from a job id, with limited results and possibility to sort by totalenqueues DESC- Specified by:
getFrontierReport
in classRunningJobsInfoDAO
- Parameters:
jobId
- the job idlimit
- the limit of result to querysort
- if true, sort the results by totalenqueues DESC- Returns:
- a frontier report
-
deleteFrontierReports
public int deleteFrontierReports(long jobId)
Deletes all frontier report data pertaining to the given job id from the persistent storage.- Specified by:
deleteFrontierReports
in classRunningJobsInfoDAO
- Parameters:
jobId
- the job id- Returns:
- the update count
-
-