Class HarvestChannel
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.HarvestChannel
-
- All Implemented Interfaces:
Serializable
public class HarvestChannel extends Object implements Serializable
Harvest channels are used to dispatch harvest jobs to specific pools of crawlers. Channels can accept either only snapshot jobs or only focused jobs. Snapshot crawls all use a single hard-coded channel.Harvest channels names must only contain alphanumeric characters, the constraint is enforced at creation time.
HarvestDefinition
s are mapped to aHarvestChannel
, and HarvestControllers listen to jobs sent on a specific channel.Harvest channels are stored in the harvest database, as well as mappings to
HarvestDefinition
s and HarvestControllers through two association tables.There must be exactly one channel defined as default for every type of job (snapshot and focused). This constraint will be enforced by the DAO.
- Author:
- ngiraud
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACCEPTABLE_NAME_PATTERN
Defines acceptable channel names: at least one word character.
-
Constructor Summary
Constructors Constructor Description HarvestChannel(long id, String name, boolean isSnapshot, boolean isDefault, String comments)
Constructor from persistent storage.HarvestChannel(String name, boolean isSnapshot, boolean isDefault, String comments)
Constructor from name and comments.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getComments()
long
getId()
String
getName()
static String
getSnapshotDescription(javax.servlet.jsp.PageContext context)
Renders a localized description for the singleton.static boolean
isAcceptableName(String input)
Returns true if the given input is an acceptable channel name.boolean
isDefault()
boolean
isSnapshot()
void
setComments(String comments)
Sets the associated commentsvoid
setDefault(boolean isDefault)
Set whether if the channel is the default one for the harvest type (snapshot or focused).void
setName(String name)
Sets the harvest channel namevoid
setSnapshot(boolean isSnapshot)
Set the harvest type to snapshot or focused.String
toString()
-
-
-
Field Detail
-
ACCEPTABLE_NAME_PATTERN
public static final String ACCEPTABLE_NAME_PATTERN
Defines acceptable channel names: at least one word character.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HarvestChannel
public HarvestChannel(String name, boolean isSnapshot, boolean isDefault, String comments)
Constructor from name and comments.- Parameters:
name
- channel nameisSnapshot
- whether this channels type is snapshot or focusedisDefault
- whether this channel is the default onecomments
- user comments (snapshot or focused)- Throws:
ArgumentNotValid
- if the name is incorrect.
-
HarvestChannel
public HarvestChannel(long id, String name, boolean isSnapshot, boolean isDefault, String comments)
Constructor from persistent storage.- Parameters:
id
- the channel idname
- channel nameisSnapshot
- whether this channels type is snapshot or focusedisDefault
- whether this channel is the default one for the given typecomments
- user comments- Throws:
ArgumentNotValid
- if the name is incorrect.
-
-
Method Detail
-
getId
public long getId()
- Returns:
- the unique identifier in the persistent storage
-
getName
public String getName()
- Returns:
- the harvest channel name.
-
setName
public void setName(String name)
Sets the harvest channel name- Parameters:
name
- the name to set
-
isSnapshot
public boolean isSnapshot()
- Returns:
- true if this channel is intended for snaphsot harvests, false if it is intended for focused ones.
-
setSnapshot
public void setSnapshot(boolean isSnapshot)
Set the harvest type to snapshot or focused.- Parameters:
isSnapshot
- true if snapshot, false if focused
-
isDefault
public boolean isDefault()
- Returns:
- true if the channel is the default one for the harvest type (snapshot or focused), false otherwise.
-
setDefault
public void setDefault(boolean isDefault)
Set whether if the channel is the default one for the harvest type (snapshot or focused).- Parameters:
isDefault
- true if default, false otherwise
-
getComments
public String getComments()
- Returns:
- the associated comments.
-
setComments
public void setComments(String comments)
Sets the associated comments- Parameters:
comments
- the comments to set
-
getSnapshotDescription
public static String getSnapshotDescription(javax.servlet.jsp.PageContext context)
Renders a localized description for the singleton.- Parameters:
context
-- Returns:
- a localized description.
-
isAcceptableName
public static boolean isAcceptableName(String input)
Returns true if the given input is an acceptable channel name.- Parameters:
input
- the candidate name.- Returns:
- true if the name complies to the defined
ACCEPTABLE_NAME_PATTERN
, false otherwise
-
-