org.eobjects.analyzer.job.runner
Interface AnalysisResultFuture

All Superinterfaces:
AnalysisResult, ErrorAware
All Known Implementing Classes:
AnalysisResultFutureImpl

public interface AnalysisResultFuture
extends ErrorAware, AnalysisResult

Represents the result of an analysis. The analysis may still be running, which is why this interface contains the isDone(), await() and await(long,TimeUnit) methods. When the result is done it may either be successful or errornous. Clients can find out using the isSuccessful() or isErrornous() methods. If succesful, the results can be retrieved like specified in the AnalysisResult interface - using the getResults() method. If errornous the error messages can be retrieved using the getErrors() method. If the analysis was only partly errornous, there may be both result and errors, but isSuccesful() will return false.

Author:
Kasper Sørensen

Method Summary
 void await()
          Blocks the current thread until interrupted, most probably because the job has ended.
 void await(long timeout, TimeUnit timeUnit)
          Blocks the current thread until interrupted, either because the job has ended or because it has timed out.
 void cancel()
          Cancels the job, if it is still running.
 List<Throwable> getErrors()
           
 AnalyzerResult getResult(ComponentJob componentJob)
          Finds (and waits if nescesary) the results of a single Analyzer.
 Map<ComponentJob,AnalyzerResult> getResultMap()
          Finds (and waits if nescesary) the results mapped to the Analyzer jobs
 List<AnalyzerResult> getResults()
          Finds (and waits if nescesary) the results of this analysis.
 JobStatus getStatus()
           
 boolean isDone()
           
 boolean isSuccessful()
           
 
Methods inherited from interface org.eobjects.analyzer.job.runner.ErrorAware
isCancelled, isErrornous
 
Methods inherited from interface org.eobjects.analyzer.result.AnalysisResult
getCreationDate
 

Method Detail

isDone

boolean isDone()
Returns:
true if the job has finished

await

void await()
Blocks the current thread until interrupted, most probably because the job has ended.


cancel

void cancel()
Cancels the job, if it is still running.


await

void await(long timeout,
           TimeUnit timeUnit)
Blocks the current thread until interrupted, either because the job has ended or because it has timed out.

Parameters:
timeout -
timeUnit -

isSuccessful

boolean isSuccessful()
Returns:
true if the job has executed without errors

getStatus

JobStatus getStatus()
Returns:
SUCCESSFUL if the job is finished and successful, ERRORNOUS if errors have been reported and NOT_FINISHED if no errors have been reported but the job is not done yet

getResults

List<AnalyzerResult> getResults()
                                throws IllegalStateException
Finds (and waits if nescesary) the results of this analysis.

Specified by:
getResults in interface AnalysisResult
Returns:
the results from the Analyzers in the executed job
Throws:
IllegalStateException - if the analysis did not go well (use isSuccesfull() or isErrornous() to check)

getResult

AnalyzerResult getResult(ComponentJob componentJob)
                         throws IllegalStateException
Finds (and waits if nescesary) the results of a single Analyzer.

Specified by:
getResult in interface AnalysisResult
Parameters:
componentJob - the component (either analyzer or explorer) job to find the result for
Returns:
the result for a given component job
Throws:
IllegalStateException - if the analysis did not go well (use isSuccesfull() or isErrornous() to check)

getResultMap

Map<ComponentJob,AnalyzerResult> getResultMap()
                                              throws IllegalStateException
Finds (and waits if nescesary) the results mapped to the Analyzer jobs

Specified by:
getResultMap in interface AnalysisResult
Returns:
a map with ComponentJobs as keys to the corresponding AnalyzerResults.
Throws:
IllegalStateException - if the analysis did not go well (use isSuccesfull() or isErrornous() to check)

getErrors

List<Throwable> getErrors()
Specified by:
getErrors in interface ErrorAware
Returns:
any errors reported during execution, if the job was not successful


Copyright © 2012 eobjects.org. All Rights Reserved.