Class GlobalCrawlerTrapListDAO
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.GlobalCrawlerTrapListDAO
-
- All Implemented Interfaces:
DAO
- Direct Known Subclasses:
GlobalCrawlerTrapListDBDAO
public abstract class GlobalCrawlerTrapListDAO extends Object implements DAO
A Data Access Object for managing persistent collections of global crawler traps.
-
-
Constructor Summary
Constructors Constructor Description GlobalCrawlerTrapListDAO()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addGlobalCrawlerTraps(HeritrixTemplate orderXmlDoc)
Reads a list of all active global crawler trap expressions from the database and adds them to the crawl template.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(String name)
Does crawlertrap with this name already exist.abstract List<GlobalCrawlerTrapList>
getAllActive()
Get all active crawler traps.abstract List<String>
getAllActiveTrapExpressions()
Get a merged list (without duplicates) of all currently-active crawler trap expressions.abstract 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.
-
-
-
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 List<GlobalCrawlerTrapList> getAllActive()
Get all active crawler traps.- Returns:
- a list of all active crawler traps.
-
getAllInActive
public abstract List<GlobalCrawlerTrapList> getAllInActive()
Get all inactive crawler traps.- Returns:
- a list of all inactive crawler traps.
-
getAllActiveTrapExpressions
public abstract List<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(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
-
addGlobalCrawlerTraps
public abstract void addGlobalCrawlerTraps(HeritrixTemplate orderXmlDoc)
Reads a list of all active global crawler trap expressions from the database and adds them to the crawl template.
-
-