Class IndexRequestMessage

    • Constructor Detail

      • IndexRequestMessage

        public IndexRequestMessage​(RequestType requestType,
                                   Set<Long> jobSet,
                                   RemoteFileSettings ftpconnectionInfo)
                            throws ArgumentNotValid
        Generate an index request message. Receiver is always the index server channel, replyTo is always this index client.
        Parameters:
        requestType - Type of index requested.
        jobSet - Type of index requested.
        ftpconnectionInfo - FTP connection parameters to be used (if null, we use the local settings)
        Throws:
        ArgumentNotValid - if any argument is null.
      • IndexRequestMessage

        public IndexRequestMessage​(RequestType requestType,
                                   Set<Long> jobSet,
                                   ChannelID replyTo,
                                   boolean returnIndex,
                                   Long harvestId)
        Generate an IndexRequestMessage that can send its reply to a specific channel.
        Parameters:
        requestType - Type of index requested.
        jobSet - Type of index requested.
        replyTo - The channel to send the reply to.
        returnIndex - If true, include the index in the reply.
        harvestId - The harvestId needing this index for its jobs
    • Method Detail

      • getRemoteFileSettings

        public RemoteFileSettings getRemoteFileSettings()
        Returns:
        the remoteFilesettings
      • getHarvestId

        public Long getHarvestId()
        Returns:
        the harvestId which will use this index, if available.
      • mustReturnIndex

        public boolean mustReturnIndex()
        Returns:
        true, if this index requested should be returned to the caller. False, if we instead should send a IndexReadyMessage to the HarvestJobManager queue.
      • getRequestedJobs

        public Set<Long> getRequestedJobs()
        Get list of requested jobs. Should never return null.
        Returns:
        Set of jobs for which an index is requested.
      • getRequestType

        public RequestType getRequestType()
        Get the request type. Should never be null.
        Returns:
        Type of index requested.
      • getFoundJobs

        public Set<Long> getFoundJobs()
        Get the set of jobs for which the index is found. This should always be set on replies, and should always be a subset of the jobs requested. If set of jobs found jobs is the same as the set of requested jobs, the index file should also be present.
        Returns:
        Set of jobs for which the index is found.
      • setFoundJobs

        public void setFoundJobs​(Set<Long> foundJobs)
                          throws ArgumentNotValid
        On reply, set the set of jobs for which an index is found. This should always be set on replies, and should always be a subset of the jobs requested. If set of jobs found jobs is the same as the set of requested jobs, the index file should also be set.
        Parameters:
        foundJobs - The set of jobs for which the index is found
        Throws:
        ArgumentNotValid - on null argument
      • getResultFile

        public RemoteFile getResultFile()
                                 throws IllegalState
        The index over the requested jobs. Only set on replies, and only if foundJobs is the same set as requestedJobs.
        Returns:
        index of requested jobs.
        Throws:
        IllegalState - if this message is a multiFile message.
      • getResultFiles

        public List<RemoteFile> getResultFiles()
                                        throws IllegalState
        Returns the list of result files for the requested jobs.
        Returns:
        index of requested jobs in the form of several possibly co-dependent files.
        Throws:
        IllegalState - if this message is not a multiFile message.
      • setResultFile

        public void setResultFile​(RemoteFile resultFile)
                           throws IllegalState,
                                  ArgumentNotValid
        On reply, set remote file containing index of requested jobs. Should _only_ be set when an index over ALL requested jobs is present.
        Parameters:
        resultFile - RemoteFile containing index over requested jobs.
        Throws:
        ArgumentNotValid - on null argument.
        IllegalState - if the result file has already been set.
      • setResultFiles

        public void setResultFiles​(List<RemoteFile> resultFiles)
                            throws IllegalState,
                                   ArgumentNotValid
        Set several result files making up an index of requested jobs. Should _only_ be set when an index over ALL requested jobs is present.
        Parameters:
        resultFiles - RemoteFiles containing index over requested jobs.
        Throws:
        ArgumentNotValid - on null argument or null element in list.
        IllegalState - if the result files have already been set.
      • isIndexIsStoredInDirectory

        public boolean isIndexIsStoredInDirectory()
        If true, this message may carry multiple files that should be stored in a directory.
        Returns:
        True if more than one file may be transferred with this message.