Class HarvestDefinitionDAO

    • Constructor Detail

      • HarvestDefinitionDAO

        protected HarvestDefinitionDAO()
        Default constructor. Does not do anything, however.
    • Method Detail

      • getInstance

        public static HarvestDefinitionDAO getInstance()
        Creates the singleton.
        Returns:
        the HarvestDefinitionDAO singleton.
        Throws:
        IOFailure - if unable to create the singleton.
      • create

        public abstract Long create​(HarvestDefinition harvestDefinition)
        Create a harvest definition in persistent storage.
        Parameters:
        harvestDefinition - A new harvest definition to write out.
        Returns:
        The harvestId for the just created harvest definition.
      • read

        public abstract HarvestDefinition read​(Long harvestDefinitionID)
                                        throws UnknownID,
                                               IOFailure
        Read the stored harvest definition for the given ID.
        Parameters:
        harvestDefinitionID - An ID number for a harvest definition
        Returns:
        A harvest definition that has been read from persistent storage.
        Throws:
        UnknownID - if no file with that ID exists
        IOFailure - if the File does not exist, does not have the correct ID, or otherwise fails to load correctly.
      • update

        public abstract void update​(HarvestDefinition harvestDefinition)
        Update an existing harvest definition with new info in persistent storage.
        Parameters:
        harvestDefinition - An updated harvest definition object to be persisted.
      • flipActive

        public abstract void flipActive​(SparsePartialHarvest harvestDefinition)
        Activates or deactivates a partial harvest definition, depending on its activation status.
        Parameters:
        harvestDefinition - the harvest definition object
      • exists

        public abstract boolean exists​(Long oid)
        Check, if there exists a HarvestDefinition identified by a given OID.
        Parameters:
        oid - a given OID
        Returns:
        true, if such a harvestdefinition exists.
      • exists

        public abstract boolean exists​(String name)
        Check, if there exists a HarvestDefinition identified by a given name.
        Parameters:
        name - a given name
        Returns:
        true, if such a harvestdefinition exists.
      • getAllHarvestDefinitions

        public abstract Iterator<HarvestDefinition> getAllHarvestDefinitions()
        Get a list of all existing harvest definitions.
        Returns:
        An iterator that give the existing harvest definitions in turn
      • getSnapShotConfigurations

        public abstract Iterator<DomainConfiguration> getSnapShotConfigurations()
        Gets default configurations for all domains.
        Returns:
        Iterator containing the default DomainConfiguration for all domains
      • getReadyHarvestDefinitions

        public abstract Iterable<Long> getReadyHarvestDefinitions​(Date now)
        Get the IDs of the harvest definitions that are ready to run.
        Parameters:
        now -
        Returns:
        IDs of the harvest definitions that are currently ready to be scheduled. Some of these might already be in the process of being scheduled.
      • getHarvestDefinition

        public abstract HarvestDefinition getHarvestDefinition​(String name)
        Get the harvest definition that has the given name, or null, if no harvestdefinition exist with this name.
        Parameters:
        name - The name of a harvest definition.
        Returns:
        The HarvestDefinition object with that name, or null if none has that name.
      • getHarvestRunInfo

        public abstract List<HarvestRunInfo> getHarvestRunInfo​(long harvestID)
        Returns a list with information on the runs of a particular harvest. The list is ordered by descending run number.
        Parameters:
        harvestID - ID of an existing harvest
        Returns:
        List of objects with selected information.
      • getSparseDomainConfigurations

        public abstract List<SparseDomainConfiguration> getSparseDomainConfigurations​(Long harvestDefinitionID)
        Get all domain,configuration pairs for a harvest definition in sparse version for GUI purposes.
        Parameters:
        harvestDefinitionID - The ID of the harvest definition.
        Returns:
        Domain, configuration pairs for that HD. Returns an empty list for unknown harvest definitions.
        Throws:
        ArgumentNotValid - on null argument.
      • getSparsePartialHarvest

        public abstract SparsePartialHarvest getSparsePartialHarvest​(String harvestName)
        Get a sparse version of a partial harvest for GUI purposes.
        Parameters:
        harvestName - Name of harvest definition.
        Returns:
        Sparse version of partial harvest or null for none.
        Throws:
        ArgumentNotValid - on null or empty name.
      • getSparsePartialHarvestDefinitions

        public abstract Iterable<SparsePartialHarvest> getSparsePartialHarvestDefinitions​(boolean excludeInactive)
        Get all sparse versions of partial harvests for GUI purposes.
        Parameters:
        excludeInactive - If true only active harvest definitions are returned.
        Returns:
        An iterable (possibly empty) of SparsePartialHarvests
      • getSparseFullHarvest

        public abstract SparseFullHarvest getSparseFullHarvest​(String harvestName)
        Get a sparse version of a full harvest for GUI purposes.
        Parameters:
        harvestName - Name of harvest definition.
        Returns:
        Sparse version of full harvest or null for none.
        Throws:
        ArgumentNotValid - on null or empty name.
      • getAllSparseFullHarvestDefinitions

        public abstract Iterable<SparseFullHarvest> getAllSparseFullHarvestDefinitions()
        Get all sparse versions of full harvests for GUI purposes.
        Returns:
        An iterable (possibly empty) of SparseFullHarvests
      • getHarvestName

        public abstract String getHarvestName​(Long harvestDefinitionID)
        Get the name of a harvest given its ID.
        Parameters:
        harvestDefinitionID - The ID of a harvest
        Returns:
        The name of the given harvest.
        Throws:
        ArgumentNotValid - on null argument
        UnknownID - if no harvest has the given ID.
        IOFailure - on any other error talking to the database
      • isSnapshot

        public abstract boolean isSnapshot​(Long harvestDefinitionID)
        Get whether a given harvest is a snapshot or selective harvest.
        Parameters:
        harvestDefinitionID - ID of a harvest
        Returns:
        True if the given harvest is a snapshot harvest, false otherwise.
        Throws:
        ArgumentNotValid - on null argument
        UnknownID - if no harvest has the given ID.
        IOFailure - on any other error talking to the database
      • getListOfDomainsOfHarvestDefinition

        public abstract List<String> getListOfDomainsOfHarvestDefinition​(String harvestName)
        Get a sorted list of all domainnames of a HarvestDefintion
        Parameters:
        harvestName - of HarvestDefintion
        Returns:
        List of all domains of the HarvestDefinition.
        Throws:
        ArgumentNotValid - on null argument
        IOFailure - on any other error talking to the database
      • getListOfSeedsOfDomainOfHarvestDefinition

        public abstract List<String> getListOfSeedsOfDomainOfHarvestDefinition​(String harvestName,
                                                                               String domainName,
                                                                               boolean needSort)
        Get a list of all seeds of a Domain in a HarvestDefinition.
        Parameters:
        harvestName - of HarvestDefinition
        domainName - of Domain
        needSort - boolean if sort results
        Returns:
        List of all seeds of the Domain in the HarvestDefinition.
      • getJobIdsForSnapshotDeduplicationIndex

        public abstract Set<Long> getJobIdsForSnapshotDeduplicationIndex​(Long harvestId)
        Get a collection of jobIds for snapshot deduplication index.
        Parameters:
        harvestId - the id of the harvest
        Returns:
        a collection of jobIds to create a deduplication index.
      • setIndexIsReady

        public abstract void setIndexIsReady​(Long harvestId,
                                             boolean newValue)
        Set the isindexready field available for snapshot harvests.
        Parameters:
        harvestId - the ID of the harvest.
        newValue - the new isindexready value
      • removeDomainConfiguration

        public abstract void removeDomainConfiguration​(Long harvestId,
                                                       SparseDomainConfiguration key)
        Remove Domain configuration from a specific PartialHarvest.
        Parameters:
        harvestId - Id for a specific PartialHarvest
        key - a SparseDomainConfiguration uniquely identifying the domainconfig.
      • updateNextdate

        public abstract void updateNextdate​(long harvestId,
                                            Date nextdate)
        Update the given PartialHarvest (i.e. Selective Harvest) with a new time for the next harvestrun. If no selective harvest matching the given id is found in the storage, the method should silently return.
        Parameters:
        harvestId - A given PartialHarvest id (i.e. Selective Harvest).
        nextdate - A new date for the next harvest run.
      • addDomainConfiguration

        public abstract void addDomainConfiguration​(PartialHarvest hdd,
                                                    SparseDomainConfiguration sparseDomainConfiguration)
        Add a domainconfiguration to a PartialHarvest.
        Parameters:
        hdd - a given PartialHarvest
        sparseDomainConfiguration - a reduced domainconfiguration object
      • resetDomainConfigurations

        public abstract void resetDomainConfigurations​(PartialHarvest hdd,
                                                       List<DomainConfiguration> dcList)
        Reset the list of domainconfiguration for a PartialHarvest.
        Parameters:
        hdd - a given PartialHarvest
        dcList - the new list of domainconfigurations
      • mapToHarvestChannel

        public abstract void mapToHarvestChannel​(long harvestDefinitionId,
                                                 HarvestChannel channel)
        Maps a harvest definition to a harvest channel.
        Parameters:
        harvestDefinitionId - the harvest definition id
        channel - the harvest channel