org.schmant.task
Interface TaskFactory<T extends TaskFactory<T,U>,U extends TaskSpecification<U>>

All Superinterfaces:
LoggingConfigurable<T>, TaskRunnable
All Known Subinterfaces:
ActionTaskFactory<T,U>, GeneratorTaskFactory<T,U>, JavacTaskFactory<T,U>, ProcessTaskFactory<T,U>, RecursiveActionTaskFactory<T,U>, RecursiveProcessTaskFactory<T,U>
All Known Implementing Classes:
AbstractActionTaskFactory, AbstractAddTextTaskFactory, AbstractExtJavaTaskFactory, AbstractExtJvmTaskFactory, AbstractExtProcessTaskFactory, AbstractGeneratorTaskFactory, AbstractJarTaskFactory, AbstractJavacTaskFactory, AbstractJavadocTaskFactory, AbstractJavaZipTaskFactory, AbstractLinkInsertionTaskFactory, AbstractParseXmlTaskFactory, AbstractProcessTaskFactory, AbstractProxyTaskFactory, AbstractRecursiveActionTaskFactory, AbstractRecursiveProcessTaskFactory, AbstractSvnCommitTaskFactory, AbstractSvnTaskFactory, AbstractTaskFactory, AbstractTextInsertionTaskFactory, AbstractXmlCatalogActionTaskFactory, AbstractZipTaskFactory, AddSystemIdToCatalogTF, AddUriToCatalogTF, AntTF, ApiLinksTF, ArgumentInterpreterLinksTF, At4JUnzipTF, At4JZipTF, BZip2TF, ChmodTF, CompoundTF, CopyTF, DeleteTF, DomParseXmlTF, EarTF, ErrorIgnoringTF, ExtFindbugsTF, ExtJarSignerTF, ExtJavacTF, ExtJavadocTF, ExtProcessTF, ForEachSourceTF, FormatCharacterFileTF, GZipTF, HtmlLinkValidationTF, IncludeFilesTF, JarTF, JavaTF, JavaWorkspaceBuilderTF, Jdk6JavacTF, JUnit4TF, LzmaTF, MoveTF, RecursiveActionTF, RecursiveProcessTF, RedirectReportTF, ReplaceSourceFileTF, SchemaFactoryTF, SchmantTaskrefTF, SvnExportTF, SvnUrlToUrlCopyTF, TarTF, TaskFactoryLinksTF, TemplateCompilerTF, TextAppendTF, TextPrependTF, TextReplaceTF, TimedExecutionTF, TreeCopyTF, TreeDeleteTF, UntarTF, WarTF, XsltTF, ZipTF

public interface TaskFactory<T extends TaskFactory<T,U>,U extends TaskSpecification<U>>
extends LoggingConfigurable<T>, TaskRunnable

All Task:s are created by a task factory. The task factory can be reused to create several Task objects.

The task factory creates a Task by configuring a TaskSpecification, and using that to create the Task when the build script calls create(). If setter methods on the task factory are called after creating a task, it makes a copy of the TaskSpecification and configures that object instead.

The task factory is TaskRunnable in itself. Running a task factory is a shortcut for calling create().run() on it.

A task factory is required to have a no-argument constructor. All configuration should be done through setter methods.

Task factories are not designed to be thread safe. They are used in the thread running the script. TaskExecutor:s use Task:s. If the task factory is used in a setting where it may be used concurrently by several threads, such as from another task, it must be locked for exclusive access using its intrinsic lock (synchronized).

Since:
0.5
Author:
Karl Gustafsson

Method Summary
 T copy()
          Create a copy of this task factory.
 Task create()
          Create a task.
 Task getLastCreated()
          Get the last created task.
 U getSpecification()
          Get the specification that this task factory object is currently working on.
 
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable
setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 
Methods inherited from interface org.schmant.task.TaskRunnable
run
 

Method Detail

create

Task create()
Create a task.

Returns:
The task.

getLastCreated

Task getLastCreated()
Get the last created task.

Returns:
The last created task.

copy

T copy()
Create a copy of this task factory. The copied factory will use a new (copied) TaskSpecification object having the same configuration as this task factory's specification object.

Returns:
A copy of this task factory.

getSpecification

U getSpecification()
Get the specification that this task factory object is currently working on.

Task factory implementations use this method to get the specification that they are currently configuring. This method takes care of creating new specification objects as needed.

Returns:
The current task specification.