org.eobjects.analyzer.job.runner
Class AnalysisResultFutureImpl

java.lang.Object
  extended by org.eobjects.analyzer.job.runner.AnalysisResultFutureImpl
All Implemented Interfaces:
AnalysisResultFuture, ErrorAware, AnalysisResult

public final class AnalysisResultFutureImpl
extends Object
implements AnalysisResultFuture


Constructor Summary
AnalysisResultFutureImpl(Queue<JobAndResult> resultQueue, StatusAwareTaskListener jobCompletionListener, ErrorAware errorAware)
           
 
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.
 Date getCreationDate()
          Gets the time that the results were created
 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 isCancelled()
           
 boolean isDone()
           
 boolean isErrornous()
           
 boolean isSuccessful()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnalysisResultFutureImpl

public AnalysisResultFutureImpl(Queue<JobAndResult> resultQueue,
                                StatusAwareTaskListener jobCompletionListener,
                                ErrorAware errorAware)
Method Detail

isDone

public boolean isDone()
Specified by:
isDone in interface AnalysisResultFuture
Returns:
true if the job has finished

getCreationDate

public Date getCreationDate()
Description copied from interface: AnalysisResult
Gets the time that the results were created

Specified by:
getCreationDate in interface AnalysisResult
Returns:
the time that the results were created

cancel

public void cancel()
Description copied from interface: AnalysisResultFuture
Cancels the job, if it is still running.

Specified by:
cancel in interface AnalysisResultFuture

await

public void await(long timeout,
                  TimeUnit timeUnit)
Description copied from interface: AnalysisResultFuture
Blocks the current thread until interrupted, either because the job has ended or because it has timed out.

Specified by:
await in interface AnalysisResultFuture

await

public void await()
Description copied from interface: AnalysisResultFuture
Blocks the current thread until interrupted, most probably because the job has ended.

Specified by:
await in interface AnalysisResultFuture

getResults

public List<AnalyzerResult> getResults()
                                throws IllegalStateException
Description copied from interface: AnalysisResultFuture
Finds (and waits if nescesary) the results of this analysis.

Specified by:
getResults in interface AnalysisResultFuture
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

public AnalyzerResult getResult(ComponentJob componentJob)
                         throws IllegalStateException
Description copied from interface: AnalysisResultFuture
Finds (and waits if nescesary) the results of a single Analyzer.

Specified by:
getResult in interface AnalysisResultFuture
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

public Map<ComponentJob,AnalyzerResult> getResultMap()
                                              throws IllegalStateException
Description copied from interface: AnalysisResultFuture
Finds (and waits if nescesary) the results mapped to the Analyzer jobs

Specified by:
getResultMap in interface AnalysisResultFuture
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)

isSuccessful

public boolean isSuccessful()
Specified by:
isSuccessful in interface AnalysisResultFuture
Returns:
true if the job has executed without errors

getErrors

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

isErrornous

public boolean isErrornous()
Specified by:
isErrornous in interface ErrorAware

getStatus

public JobStatus getStatus()
Specified by:
getStatus in interface AnalysisResultFuture
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

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface ErrorAware


Copyright © 2012 eobjects.org. All Rights Reserved.