Class HarvestChannel

  • All Implemented Interfaces:
    java.io.Serializable

    public class HarvestChannel
    extends java.lang.Object
    implements java.io.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 Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACCEPTABLE_NAME_PATTERN
      Defines acceptable channel names: at least one word character.
    • Constructor Summary

      Constructors 
      Constructor Description
      HarvestChannel​(long id, java.lang.String name, boolean isSnapshot, boolean isDefault, java.lang.String comments)
      Constructor from persistent storage.
      HarvestChannel​(java.lang.String name, boolean isSnapshot, boolean isDefault, java.lang.String comments)
      Constructor from name and comments.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getComments()  
      long getId()  
      java.lang.String getName()  
      static java.lang.String getSnapshotDescription​(javax.servlet.jsp.PageContext context)
      Renders a localized description for the singleton.
      static boolean isAcceptableName​(java.lang.String input)
      Returns true if the given input is an acceptable channel name.
      boolean isDefault()  
      boolean isSnapshot()  
      void setComments​(java.lang.String comments)
      Sets the associated comments
      void setDefault​(boolean isDefault)
      Set whether if the channel is the default one for the harvest type (snapshot or focused).
      void setName​(java.lang.String name)
      Sets the harvest channel name
      void setSnapshot​(boolean isSnapshot)
      Set the harvest type to snapshot or focused.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • HarvestChannel

        public HarvestChannel​(java.lang.String name,
                              boolean isSnapshot,
                              boolean isDefault,
                              java.lang.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,
                              java.lang.String name,
                              boolean isSnapshot,
                              boolean isDefault,
                              java.lang.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 java.lang.String getName()
        Returns:
        the harvest channel name.
      • setName

        public void setName​(java.lang.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 java.lang.String getComments()
        Returns:
        the associated comments.
      • setComments

        public void setComments​(java.lang.String comments)
        Sets the associated comments
        Parameters:
        comments - the comments to set
      • getSnapshotDescription

        public static java.lang.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​(java.lang.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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object