Class GlobalCrawlerTrapList
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.GlobalCrawlerTrapList
-
public class GlobalCrawlerTrapList extends Object
Class representing one or more global crawler traps, modeled as a set of regular expressions.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GlobalCrawlerTrapList(int id, List<String> traps, String name, String description, boolean isActive)
Protected constructor used by the DAO to create instances of this class.GlobalCrawlerTrapList(InputStream is, String name, String description, boolean isActive)
Construct a new GlobalCrawlerTrapList from an input stream consisting of newline-separated regular expressions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getDescription()
Get the description of this list.int
getId()
Get the id of this list.String
getName()
Get the name of the list.Set<String>
getTraps()
Get the trap expressions for this list.int
hashCode()
boolean
isActive()
Returns true if this list is active.void
setActive(boolean active)
Set the activity state of the list.void
setDescription(String description)
Set the description of this list.protected void
setId(int id)
Set the id of this list.void
setName(String name)
Set the name of the list.void
setTraps(Set<String> traps)
Set the trap expressions for this list.void
setTrapsFromInputStream(InputStream is, String listName)
A utility method to read the list of traps from an InputStream, line-by-line.
-
-
-
Constructor Detail
-
GlobalCrawlerTrapList
protected GlobalCrawlerTrapList(int id, List<String> traps, String name, String description, boolean isActive) throws ArgumentNotValid
Protected constructor used by the DAO to create instances of this class.- Parameters:
id
- the id of this list.name
- a name by which this list is known.traps
- the set of trap expressions.description
- A textual description of this list (may be null).isActive
- flag indicating whether this list is isActive.- Throws:
ArgumentNotValid
- if the name is empty or null
-
GlobalCrawlerTrapList
public GlobalCrawlerTrapList(InputStream is, String name, String description, boolean isActive) throws IOFailure, ArgumentNotValid
Construct a new GlobalCrawlerTrapList from an input stream consisting of newline-separated regular expressions.- Parameters:
is
- an input stream from which the list of trap expressions can be read.name
- a name by which this list is known.description
- A textual description of this list.isActive
- flag indicating whether this list is isActive.- Throws:
IOFailure
- if the input stream cannot be found or read.ArgumentNotValid
- if the input stream is null, the name is null or empty, or the list contains invalid expressions
-
-
Method Detail
-
setTrapsFromInputStream
public void setTrapsFromInputStream(InputStream is, String listName) throws ArgumentNotValid
A utility method to read the list of traps from an InputStream, line-by-line.- Parameters:
is
- The input stream from which to read.listName
- the name of the list being constructed- Throws:
IOFailure
- if the input stream cannot be read.ArgumentNotValid
- if the input stream is null or if any of the specified traps are not valid regular expressions and valid XML
-
getId
public int getId()
Get the id of this list.- Returns:
- the id.
-
setId
protected void setId(int id)
Set the id of this list.- Parameters:
id
- the id.
-
getName
public String getName()
Get the name of the list.- Returns:
- the name.
-
setName
public void setName(String name)
Set the name of the list.- Parameters:
name
- the name.
-
getTraps
public Set<String> getTraps()
Get the trap expressions for this list.- Returns:
- the trap expressions.
-
setTraps
public void setTraps(Set<String> traps)
Set the trap expressions for this list.- Parameters:
traps
- the trap expressions.
-
getDescription
public String getDescription()
Get the description of this list.- Returns:
- the description.
-
setDescription
public void setDescription(String description)
Set the description of this list.- Parameters:
description
- the description.
-
isActive
public boolean isActive()
Returns true if this list is active.- Returns:
- the activity state of the list.
-
setActive
public void setActive(boolean active)
Set the activity state of the list.- Parameters:
active
- the activity state.
-
-