Class 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.

    HarvestDefinitions are mapped to a HarvestChannel, and HarvestControllers listen to jobs sent on a specific channel.

    Harvest channels are stored in the harvest database, as well as mappings to HarvestDefinitions 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 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 name
        isSnapshot - whether this channels type is snapshot or focused
        isDefault - whether this channel is the default one
        comments - 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 id
        name - channel name
        isSnapshot - whether this channels type is snapshot or focused
        isDefault - whether this channel is the default one for the given type
        comments - 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