dk.netarkivet.harvester.datamodel
Class GlobalCrawlerTrapListDAO

java.lang.Object
  extended by dk.netarkivet.harvester.datamodel.GlobalCrawlerTrapListDAO
Direct Known Subclasses:
GlobalCrawlerTrapListDBDAO

public abstract class GlobalCrawlerTrapListDAO
extends java.lang.Object

A Data Access Object for managing persistent collections of global crawler traps.


Constructor Summary
GlobalCrawlerTrapListDAO()
           
 
Method Summary
abstract  int create(GlobalCrawlerTrapList trapList)
          This method creates the object in the database and has the side effect of setting the trapLists id field to the auto-generated id in the database.
abstract  void delete(int id)
          Deletes a crawler trap list from the database.
abstract  boolean exists(java.lang.String name)
          Does crawlertrap with this name already exist
abstract  java.util.List<GlobalCrawlerTrapList> getAllActive()
          Get all active crawler traps.
abstract  java.util.List<java.lang.String> getAllActiveTrapExpressions()
          Get a merged list (without duplicates) of all currently-active crawler trap expressions.
abstract  java.util.List<GlobalCrawlerTrapList> getAllInActive()
          Get all inactive crawler traps.
static GlobalCrawlerTrapListDAO getInstance()
          Factory method to return the singleton instance of this class.
abstract  GlobalCrawlerTrapList read(int id)
          Get a traplist from the database.
static void reset()
          Resets the singleton instance of this class.
abstract  void update(GlobalCrawlerTrapList trapList)
          Updates a given global crawler trap list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalCrawlerTrapListDAO

public GlobalCrawlerTrapListDAO()
Method Detail

getInstance

public static GlobalCrawlerTrapListDAO getInstance()
Factory method to return the singleton instance of this class.

Returns:
the singleton instance of this class.

reset

public static void reset()
Resets the singleton instance of this class. Mostly for testing.


getAllActive

public abstract java.util.List<GlobalCrawlerTrapList> getAllActive()
Get all active crawler traps.

Returns:
a list of all active crawler traps.

getAllInActive

public abstract java.util.List<GlobalCrawlerTrapList> getAllInActive()
Get all inactive crawler traps.

Returns:
a list of all inactive crawler traps.

getAllActiveTrapExpressions

public abstract java.util.List<java.lang.String> getAllActiveTrapExpressions()
Get a merged list (without duplicates) of all currently-active crawler trap expressions.

Returns:
a list os all active crawler trap expressions.

create

public abstract int create(GlobalCrawlerTrapList trapList)
                    throws ArgumentNotValid
This method creates the object in the database and has the side effect of setting the trapLists id field to the auto-generated id in the database.

Parameters:
trapList - The list to persist
Returns:
the id of the created list
Throws:
ArgumentNotValid - if the trapList is null.

delete

public abstract void delete(int id)
                     throws UnknownID
Deletes a crawler trap list from the database.

Parameters:
id - the id of the list to be deleted
Throws:
UnknownID - if the argument doesn not correspond to a known trap list.

update

public abstract void update(GlobalCrawlerTrapList trapList)
                     throws UnknownID
Updates a given global crawler trap list.

Parameters:
trapList - the trap list to update
Throws:
UnknownID - if the id of the trapList argument does not correspond to an existing trap list in the database.

read

public abstract GlobalCrawlerTrapList read(int id)
                                    throws UnknownID
Get a traplist from the database.

Parameters:
id - the id of the traplist to be read.
Returns:
the trap list.
Throws:
UnknownID - if the id does not correspond to a known traplist in the database.

exists

public abstract boolean exists(java.lang.String name)
Does crawlertrap with this name already exist

Parameters:
name - The name for a crawlertrap
Returns:
true, if a crawlertrap with the given name already exists in the database; otherwise false