dk.netarkivet.harvester.datamodel
Class ScheduleDBDAO

java.lang.Object
  extended by dk.netarkivet.harvester.datamodel.ScheduleDAO
      extended by dk.netarkivet.harvester.datamodel.ScheduleDBDAO
All Implemented Interfaces:
java.lang.Iterable<Schedule>

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
protected ScheduleDBDAO()
          Constructor for this class, that only checks that the schedules table has the expected version (1).
 
Method Summary
 void create(Schedule schedule)
          Create a new schedule.
 boolean exists(java.lang.String scheduleName)
          Returns whether a named schedule exists.
 java.util.Iterator<Schedule> getAllSchedules()
          Get iterator to all available schedules.
 int getCountSchedules()
          Get the number of defined schedules.
 Schedule read(java.lang.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
getInstance, iterator, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScheduleDBDAO

protected ScheduleDBDAO()
Constructor for this class, that only checks that the schedules table has the expected version (1).

Method Detail

create

public void create(Schedule schedule)
Create a new schedule.

Specified by:
create in class ScheduleDAO
Parameters:
schedule - The schedule to create
Throws:
ArgumentNotValid - if schedule is null
PermissionDenied - if a schedule already exists

exists

public boolean exists(java.lang.String scheduleName)
Returns whether a named schedule exists.

Specified by:
exists in class ScheduleDAO
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(java.lang.String scheduleName)
Read an existing schedule.

Specified by:
read in class ScheduleDAO
Parameters:
scheduleName - the name of the schedule
Returns:
The schedule read
Throws:
ArgumentNotValid - if schedulename is null or empty
UnknownID - if the schedule doesn't exist

update

public void update(Schedule schedule)
Update a schedule in the DAO.

Specified by:
update in class ScheduleDAO
Parameters:
schedule - The schedule to update
Throws:
ArgumentNotValid - If the schedule is null
UnknownID - If the schedule doesn't exist in the DAO
PermissionDenied - If the edition of the schedule to update is older than the DAO's

getAllSchedules

public java.util.Iterator<Schedule> getAllSchedules()
Get iterator to all available schedules.

Specified by:
getAllSchedules in class ScheduleDAO
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 class ScheduleDAO
Returns:
The number of defined schedules
See Also:
ScheduleDAO.getCountSchedules()