Class GlobalCrawlerTrapListDBDAO
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.GlobalCrawlerTrapListDAO
-
- dk.netarkivet.harvester.datamodel.GlobalCrawlerTrapListDBDAO
-
- All Implemented Interfaces:
DAO
public class GlobalCrawlerTrapListDBDAO extends GlobalCrawlerTrapListDAO
A singleton giving access to global crawler traps.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GlobalCrawlerTrapListDBDAO()
protected constructor of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGlobalCrawlerTraps(HeritrixTemplate orderXmlDoc)
Reads a list of all active global crawler trap expressions from the database and adds them to the crawl template for this job.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.void
delete(int id)
Deletes a crawler trap list from the database.boolean
exists(java.lang.String name)
Does crawlertrap with this name already exist.java.util.List<GlobalCrawlerTrapList>
getAllActive()
Get all active crawler traps.java.util.List<java.lang.String>
getAllActiveTrapExpressions()
Get a merged list (without duplicates) of all currently-active crawler trap expressions.java.util.List<GlobalCrawlerTrapList>
getAllInActive()
Get all inactive crawler traps.GlobalCrawlerTrapList
read(int id)
Get a traplist from the database.void
update(GlobalCrawlerTrapList trapList)
Update a trap list.-
Methods inherited from class dk.netarkivet.harvester.datamodel.GlobalCrawlerTrapListDAO
getInstance, reset
-
-
-
-
Constructor Detail
-
GlobalCrawlerTrapListDBDAO
protected GlobalCrawlerTrapListDBDAO()
protected constructor of this class. Checks if any migration are needed before operation starts.
-
-
Method Detail
-
getAllActive
public java.util.List<GlobalCrawlerTrapList> getAllActive()
Description copied from class:GlobalCrawlerTrapListDAO
Get all active crawler traps.- Specified by:
getAllActive
in classGlobalCrawlerTrapListDAO
- Returns:
- a list of all active crawler traps.
-
getAllInActive
public java.util.List<GlobalCrawlerTrapList> getAllInActive()
Description copied from class:GlobalCrawlerTrapListDAO
Get all inactive crawler traps.- Specified by:
getAllInActive
in classGlobalCrawlerTrapListDAO
- Returns:
- a list of all inactive crawler traps.
-
getAllActiveTrapExpressions
public java.util.List<java.lang.String> getAllActiveTrapExpressions()
Description copied from class:GlobalCrawlerTrapListDAO
Get a merged list (without duplicates) of all currently-active crawler trap expressions.- Specified by:
getAllActiveTrapExpressions
in classGlobalCrawlerTrapListDAO
- Returns:
- a list os all active crawler trap expressions.
-
create
public int create(GlobalCrawlerTrapList trapList)
Description copied from class:GlobalCrawlerTrapListDAO
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.- Specified by:
create
in classGlobalCrawlerTrapListDAO
- Parameters:
trapList
- The list to persist- Returns:
- the id of the created list
-
delete
public void delete(int id)
Description copied from class:GlobalCrawlerTrapListDAO
Deletes a crawler trap list from the database.- Specified by:
delete
in classGlobalCrawlerTrapListDAO
- Parameters:
id
- the id of the list to be deleted
-
update
public void update(GlobalCrawlerTrapList trapList)
Update a trap list. In order to update the trap expressions for this list, we first delete all the existing trap expressions for the list then add all those in the updated version.- Specified by:
update
in classGlobalCrawlerTrapListDAO
- Parameters:
trapList
- the trap list to update
-
read
public GlobalCrawlerTrapList read(int id)
Description copied from class:GlobalCrawlerTrapListDAO
Get a traplist from the database.- Specified by:
read
in classGlobalCrawlerTrapListDAO
- Parameters:
id
- the id of the traplist to be read.- Returns:
- the trap list.
-
exists
public boolean exists(java.lang.String name)
Does crawlertrap with this name already exist.- Specified by:
exists
in classGlobalCrawlerTrapListDAO
- 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 void addGlobalCrawlerTraps(HeritrixTemplate orderXmlDoc)
Reads a list of all active global crawler trap expressions from the database and adds them to the crawl template for this job.- Specified by:
addGlobalCrawlerTraps
in classGlobalCrawlerTrapListDAO
- Parameters:
orderXmlDoc
- The template to add crawlertraps to.
-
-