Class AbstractJob

    • Field Detail

      • m_JobInfo

        protected String m_JobInfo
        identifying name of job.
      • m_Complete

        protected boolean m_Complete
        Has this job completed processing?
      • m_JobCompleteListener

        protected JobCompleteListener m_JobCompleteListener
        Object to call once job has been completed.
      • m_ExecutionError

        protected String m_ExecutionError
        whether an error occurred in the execution.
      • m_Stopped

        protected boolean m_Stopped
        whether the job has been stopped.
    • Constructor Detail

      • AbstractJob

        public AbstractJob()
        Job constructor.
    • Method Detail

      • setJobInfo

        public void setJobInfo​(String value)
        Sets the job info/identifier.
        value - the info
      • getJobInfo

        public String getJobInfo()
        Returns the job info/identifier.
        Specified by:
        getJobInfo in interface Job
        the info
      • jobCompleted

        public void jobCompleted​(Job j,
                                 JobResult jr)
        Called once a job has completed execution.
        Specified by:
        jobCompleted in interface Job
        j - Job
        jr - Result of Job
      • setJobCompleteListener

        public void setJobCompleteListener​(JobCompleteListener l)
        Sets the listener that gets notified when the job got finished.
        Specified by:
        setJobCompleteListener in interface Job
        l - the listener
      • getJobCompleteListener

        public JobCompleteListener getJobCompleteListener()
        Returns the listener that gets notified when the job got finished.
        Specified by:
        getJobCompleteListener in interface Job
        the listener, can be null
      • isComplete

        public boolean isComplete()
        Whether the job has been finished.
        Specified by:
        isComplete in interface Job
        true if the job has finished, false otherwise
      • preProcessCheck

        protected abstract String preProcessCheck()
        Checks whether all pre-conditions have been met.
        null if everything is OK, otherwise an error message
      • process

        protected abstract void process()
                                 throws Exception
        Does the actual execution of the job.
        Exception - if fails to execute job
      • postProcessCheck

        protected abstract String postProcessCheck()
        Checks whether all post-conditions have been met.
        null if everything is OK, otherwise an error message
      • getAdditionalErrorInformation

        protected String getAdditionalErrorInformation()
        Returns additional information to be added to the error message. Default returns an empty string.
        the additional information
      • execute

        public JobResult execute()
        Override to do computation.
        Specified by:
        execute in interface Job
      • hasExecutionError

        public boolean hasExecutionError()
        Checks whether there was a problem with the job execution.
        Specified by:
        hasExecutionError in interface Job
        true if an error occurred
      • getExecutionError

        public String getExecutionError()
        Returns the execution error, if any.
        Specified by:
        getExecutionError in interface Job
        the error, null if none occurred
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory. Removes dependencies and job parameters.
        Specified by:
        cleanUp in interface CleanUpHandler
        Specified by:
        cleanUp in interface Job
      • stopExecution

        public void stopExecution()
        Stops the execution.
        Specified by:
        stopExecution in interface Stoppable
      • isStopped

        public boolean isStopped()
        Whether the execution has been stopped.
        Specified by:
        isStopped in interface StoppableWithFeedback
        true if stopped
      • toString

        public abstract String toString()
        Returns a string representation of this job.
        toString in class Object
        the job as string