dk.netarkivet.harvester.datamodel
Class GlobalCrawlerTrapList

java.lang.Object
  extended by dk.netarkivet.harvester.datamodel.GlobalCrawlerTrapList

public class GlobalCrawlerTrapList
extends java.lang.Object

Class representing one or more global crawler traps, modelled as a list of regular expressions.


Constructor Summary
  GlobalCrawlerTrapList(java.io.InputStream is, java.lang.String name, java.lang.String description, boolean isActive)
          Construct a new GlobalCrawlerTrapList from an input stream consisting of newline-separated regular expressions.
protected GlobalCrawlerTrapList(int id, java.util.List<java.lang.String> traps, java.lang.String name, java.lang.String description, boolean isActive)
          Protected constructor used by the DAO to create instances of this class.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getDescription()
          Get the description of this list.
 int getId()
          Get the id of this list.
 java.lang.String getName()
          Get the name of the list.
 java.util.Set<java.lang.String> getTraps()
          Get the trap expressions for this list.
 int hashCode()
           
 boolean isActive()
          Retruns true if this list is active.
 void setActive(boolean active)
          Set the activity state of the list.
 void setDescription(java.lang.String description)
          Set the description of this list.
protected  void setId(int id)
          Set the id of this list.
 void setName(java.lang.String name)
          Set the name of the list.
 void setTraps(java.util.Set<java.lang.String> traps)
          Set the trap expressions for this list.
 void setTrapsFromInputStream(java.io.InputStream is)
          A utility method to read the list of traps from an InputStream, line-by-line.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalCrawlerTrapList

protected GlobalCrawlerTrapList(int id,
                                java.util.List<java.lang.String> traps,
                                java.lang.String name,
                                java.lang.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(java.io.InputStream is,
                             java.lang.String name,
                             java.lang.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 or the name is null or empty.
Method Detail

getName

public java.lang.String getName()
Get the name of the list.

Returns:
the name.

setName

public void setName(java.lang.String name)
Set the name of the list.

Parameters:
name - the name.

setTrapsFromInputStream

public void setTrapsFromInputStream(java.io.InputStream is)
A utility method to read the list of traps from an InputStream, line-by-line.

Parameters:
is - The input stream from which to read.
Throws:
IOFailure - if the input stream cannot be read.
ArgumentNotValid - if the input stream is null

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.

getTraps

public java.util.Set<java.lang.String> getTraps()
Get the trap expressions for this list.

Returns:
the trap expressions.

setTraps

public void setTraps(java.util.Set<java.lang.String> traps)
Set the trap expressions for this list.

Parameters:
traps - the trap expressions.

getDescription

public java.lang.String getDescription()
Get the description of this list.

Returns:
the description.

setDescription

public void setDescription(java.lang.String description)
Set the description of this list.

Parameters:
description - the description.

isActive

public boolean isActive()
Retruns 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.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object