org.schmant.run
Interface TaskDependency

All Known Subinterfaces:
ExtProcessTask<T>, ProjectDependencies, Task
All Known Implementing Classes:
AbstractActionTask, AbstractAddTextTask, AbstractCallbackRecursiveActionTask, AbstractCallbackRecursiveProcessTask, AbstractExtJavaTask, AbstractExtJvmTask, AbstractExtProcessTask, AbstractGeneratorTask, AbstractJarTask, AbstractJavacTask, AbstractJavadocTask, AbstractJavaZipTask, AbstractLinkInsertionTask, AbstractParseXmlTask, AbstractProcessOneFileTask, AbstractProcessTask, AbstractProxyTask, AbstractSvnCommitTask, AbstractSvnTask, AbstractTask, AbstractTextInsertionTask, AbstractXmlCatalogActionTask, AbstractZipTask, AddSystemIdToCatalogTask, AddUriToCatalogTask, AlreadySatisfiedTaskDependency, AntTask, ApiLinksTask, ArgumentInterpreterLinksTask, At4JZipTask, BZip2Task, ChmodTask, ClosureTask, CompoundTask, CompoundTaskDependency, CopyTask, DeleteTask, DomParseXmlTask, EarTask, ErrorIgnoringTask, ExtFindbugsTask, ExtJarSignerTask, ExtJavacTask, ExtJavadocTask, ExtJavaTask, ExtJUnit4Task, ExtProcessTask, ForEachSourceTask, FormatCharacterFileTask, GZipTask, HtmlLinkValidationTask, IncludeFilesTask, JarTask, JavaProjectDependencies, Jdk6JavacTask, LzmaTask, ManualTaskDependency, MoveTask, RecursiveActionTask, RecursiveProcessTask, RedirectReportTask, ReplaceSourceFileTask, SchemaFactoryTask, SchmantTaskrefTask, SvnExportTask, SvnUrlToUrlCopyTask, TarTask, TaskFactoryLinksTask, TemplateCompilerTask, TextAppendTask, TextPrependTask, TextReplaceTask, TimedExecutionTask, TreeCopyTask, TreeDeleteTask, WarTask, XsltTask, ZipTask

public interface TaskDependency

This interface represents a dependency of a task. It may be another task, a collection of other task, a source of outside events, etc.

The interface is extended by Task and thus implemented by all task classes. (Not by TaskFactory :s, though.)

Implementation note: The task dependency implementation must be protected by its satisfied state lock so that a client doing the following will not miss any events:

 Lock l = td.getSatisfiedStateLock();
 l.lock();
 {
   if (!td.isSatisfied())
   {
     td.getDependencyObservable().add(this);
   }
 }
 finally
 {
   l.unlock();
 }
 

Holding the satisfied state lock should be a prerequisite for acquiring the implicit lock (synchronized).

Since:
0.5
Author:
Karl Gustafsson

Method Summary
 Observable getDependencyObservable()
          Observable that will fire with the dependency as argument when all dependencies are satisfied.
 Lock getSatisfiedStateLock()
          Get the Lock that protects the dependency's satisfied property.
 boolean isSatisfied()
          Is this dependency satisfied?
 

Method Detail

getDependencyObservable

Observable getDependencyObservable()
Observable that will fire with the dependency as argument when all dependencies are satisfied.

Implementation note: The thread firing an event must own the satisfied state lock on the task dependency object.

Returns:
An Observable to observe.

isSatisfied

boolean isSatisfied()
Is this dependency satisfied?

Implementation note: This method should be protected by the same lock that can be retrieved by calling getSatisfiedStateLock().

Returns:
true if the dependency is satisfied.

getSatisfiedStateLock

Lock getSatisfiedStateLock()
Get the Lock that protects the dependency's satisfied property. This lock must be locked before the dependency's satisfied state can be update.

An external class can lock this to ensure that the satisfied state is not updated while it holds the lock.

Returns:
The lock used to protect the satisfied state.
See Also:
isSatisfied()