Class ScheduleDBDAO
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.ScheduleDAO
-
- dk.netarkivet.harvester.datamodel.ScheduleDBDAO
-
public class ScheduleDBDAO extends ScheduleDAO
A database-based implementation of the ScheduleDAO.The statements to create the tables are now in scripts/sql/createfullhddb.sql and scripts/sql/createfullhddb.mysql.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ScheduleDBDAO()
Constructor for this class, that only checks that the schedules table has the expected version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
create(Schedule schedule)
Create a new schedule.boolean
exists(String scheduleName)
Returns whether a named schedule exists.Iterator<Schedule>
getAllSchedules()
Get iterator to all available schedules.int
getCountSchedules()
Get the number of defined schedules.Schedule
read(String scheduleName)
Read an existing schedule.void
update(Schedule schedule)
Update a schedule in the DAO.-
Methods inherited from class dk.netarkivet.harvester.datamodel.ScheduleDAO
existsDefaultSchedule, getDefaultScheduleName, getInstance, iterator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
create
public void create(Schedule schedule)
Create a new schedule.- Specified by:
create
in classScheduleDAO
- Parameters:
schedule
- The schedule to create- Throws:
ArgumentNotValid
- if schedule is nullPermissionDenied
- if a schedule already exists
-
exists
public boolean exists(String scheduleName)
Returns whether a named schedule exists.- Specified by:
exists
in classScheduleDAO
- Parameters:
scheduleName
- The name of a schedule- Returns:
- True if the schedule exists.
- Throws:
ArgumentNotValid
- if the schedulename is null or empty
-
read
public Schedule read(String scheduleName)
Read an existing schedule.- Specified by:
read
in classScheduleDAO
- Parameters:
scheduleName
- the name of the schedule- Returns:
- The schedule read
- Throws:
ArgumentNotValid
- if schedulename is null or emptyUnknownID
- if the schedule doesn't exist
-
update
public void update(Schedule schedule)
Update a schedule in the DAO.- Specified by:
update
in classScheduleDAO
- Parameters:
schedule
- The schedule to update- Throws:
ArgumentNotValid
- If the schedule is nullUnknownID
- If the schedule doesn't exist in the DAOPermissionDenied
- If the edition of the schedule to update is older than the DAO's
-
getAllSchedules
public Iterator<Schedule> getAllSchedules()
Get iterator to all available schedules.- Specified by:
getAllSchedules
in classScheduleDAO
- Returns:
- iterator to all available schedules
-
getCountSchedules
public int getCountSchedules()
Description copied from class:ScheduleDAO
Get the number of defined schedules.- Specified by:
getCountSchedules
in classScheduleDAO
- Returns:
- The number of defined schedules
-
-