org.schmant.task.findbugs
Class ExtFindbugsTask

java.lang.Object
  extended by org.schmant.support.AbstractArgumentChecker
      extended by org.schmant.task.stub.AbstractTask<T>
          extended by org.schmant.task.template.process.AbstractExtProcessTask<T>
              extended by org.schmant.task.template.jdk.java.AbstractExtJvmTask<ExtFindbugsTask>
                  extended by org.schmant.task.findbugs.ExtFindbugsTask
All Implemented Interfaces:
Producer<File>, TaskDependency, ActionTaskConfigurable<ExtFindbugsTask>, ActionTaskSpec<ExtFindbugsTask>, LoggingConfigurable<ExtFindbugsTask>, OverwriteConfigurable<ExtFindbugsTask>, SourceConfigurable<ExtFindbugsTask>, SourceConfigured, TargetConfigurable<ExtFindbugsTask>, TargetConfigured, GeneratorTaskConfigurable<ExtFindbugsTask>, GeneratorTaskSpec<ExtFindbugsTask>, ProcessTaskConfigurable<ExtFindbugsTask>, ProcessTaskSpec<ExtFindbugsTask>, Task, TaskRunnable, TaskSpecification<ExtFindbugsTask>, ExtProcessConfigured, ExtProcessTask<ExtFindbugsTask>

public final class ExtFindbugsTask
extends AbstractExtJvmTask<ExtFindbugsTask>
implements Producer<File>, ProcessTaskSpec<ExtFindbugsTask>

Task for running Findbugs in an external process.

See ExtFindbugsTF

Since:
0.5
Author:
Karl Gustafsson
See Also:
ExtFindbugsTF
Task_package:
net.findbugs

Field Summary
 
Fields inherited from interface org.schmant.task.confable.OverwriteConfigurable
DEFAULT_OVERWRITE_STRATEGY
 
Method Summary
 ExtFindbugsTask addSource(Object o)
          Add one or several sources.
 ExtFindbugsTask addSources(Object o)
          This method does the same as SourceConfigurable.addSource(Object)
 ExtFindbugsTask clearSources()
          Clear the collection of sources.
 void copyProperties(ExtFindbugsTask spec)
          Copy the properties to the target object.
 File get()
          Returns the produced object, or null if nothing is produced yet.
protected  String getDefaultLogHeader()
          Get the default log header to log (to level INFO) before the task is run if the task user has not set a custom header.
 Object getSource()
          Get the first source set.
 List<Object> getSources()
          Get the source list.
 Object getTarget()
          Get the target.
protected  void runInternal(Report r)
          Subclasses implement this.
 ExtFindbugsTask setOverwrite(boolean b)
          Should things be overwritten? If this is set to true, it is equivalent to setting the overwrite strategy to DoOverwriteAndLogWarning.
 ExtFindbugsTask setOverwriteStrategy(OverwriteStrategy strat)
          Set a strategy for how to react to existing entities in locations where the task wants to write.
 ExtFindbugsTask setRelativeToBase(RelativeLocation rel)
          This is ignored.
 ExtFindbugsTask setSource(Object o)
          Set one or several sources, discarding previously set sources.
 ExtFindbugsTask setSources(Object o)
          This method does the same as SourceConfigurable.setSource(Object)
 ExtFindbugsTask setTarget(Object o)
          Set the target.
 String toString()
          Default implementation for tasks.
protected  Collection<String> validate(Report r)
          This method may be overridden by subclasses to validate their configuration (including their TaskFactory:s) before the task is run.
 
Methods inherited from class org.schmant.task.template.jdk.java.AbstractExtJvmTask
getClasspathDecorators, getClasspathEntries, getJavaExecutable, getJavaHome, getJvmOptions
 
Methods inherited from class org.schmant.task.template.process.AbstractExtProcessTask
addArgumentsToCommandList, execAndWait, getArguments, getEnvironmentVariables, getProcessResult, getStderrStrategy, getStdoutStrategy, getWorkingDirectory, isFailOnErrors, isInheritEnvironmentVariables
 
Methods inherited from class org.schmant.task.stub.AbstractTask
cancel, createTask, getDefaultLogFooter, getDependencyForTasksScheduledByThisTask, getDependencyObservable, getFailureCause, getLogFooter, getLogHeader, getSatisfiedStateLock, getThis, isCancelled, isDone, isInterrupted, isRunning, isSatisfied, isSuccessful, run, setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 
Methods inherited from class org.schmant.support.AbstractArgumentChecker
check, check, check, check
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.schmant.task.TaskSpecification
createTask
 
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable
setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 
Methods inherited from interface org.schmant.task.Task
cancel, getDependencyForTasksScheduledByThisTask, getFailureCause, isCancelled, isDone, isInterrupted, isRunning, isSuccessful
 
Methods inherited from interface org.schmant.run.TaskDependency
getDependencyObservable, getSatisfiedStateLock, isSatisfied
 
Methods inherited from interface org.schmant.task.TaskRunnable
run
 

Method Detail

setOverwrite

public ExtFindbugsTask setOverwrite(boolean b)
Description copied from interface: OverwriteConfigurable
Should things be overwritten? If this is set to true, it is equivalent to setting the overwrite strategy to DoOverwriteAndLogWarning. If this is set to false, it is equivalent to setting the overwrite strategy to DontOverwriteAndLogWarning.

Specified by:
setOverwrite in interface OverwriteConfigurable<ExtFindbugsTask>
Parameters:
b - Should things be overwritten?
Returns:
this

setOverwriteStrategy

public ExtFindbugsTask setOverwriteStrategy(OverwriteStrategy strat)
Description copied from interface: OverwriteConfigurable
Set a strategy for how to react to existing entities in locations where the task wants to write.

Specified by:
setOverwriteStrategy in interface OverwriteConfigurable<ExtFindbugsTask>
Parameters:
strat - The overwrite strategy.
Returns:
this

setTarget

public ExtFindbugsTask setTarget(Object o)
Description copied from interface: TargetConfigurable
Set the target.

Specified by:
setTarget in interface TargetConfigurable<ExtFindbugsTask>
Parameters:
o - The target.
Returns:
this

getTarget

public Object getTarget()
Description copied from interface: TargetConfigured
Get the target.

Specified by:
getTarget in interface TargetConfigured
Returns:
The target or null if it is not set.

setSource

public ExtFindbugsTask setSource(Object o)
Description copied from interface: SourceConfigurable
Set one or several sources, discarding previously set sources.

Specified by:
setSource in interface SourceConfigurable<ExtFindbugsTask>
Parameters:
o - The source. If this is a Collection or an array, it is flattened (see FlatteningList), and all objects in the collection or array are set.
Returns:
this

setSources

public ExtFindbugsTask setSources(Object o)
Description copied from interface: SourceConfigurable
This method does the same as SourceConfigurable.setSource(Object)

Specified by:
setSources in interface SourceConfigurable<ExtFindbugsTask>
Parameters:
o - The source or sources.
Returns:
this

addSource

public ExtFindbugsTask addSource(Object o)
Description copied from interface: SourceConfigurable
Add one or several sources.

Specified by:
addSource in interface SourceConfigurable<ExtFindbugsTask>
Parameters:
o - The source. If this is a Collection or an array, it is flattened (see FlatteningList), and all sources in the collection or array are added.
Returns:
this

addSources

public ExtFindbugsTask addSources(Object o)
Description copied from interface: SourceConfigurable
This method does the same as SourceConfigurable.addSource(Object)

Specified by:
addSources in interface SourceConfigurable<ExtFindbugsTask>
Parameters:
o - The source or sources.
Returns:
this

clearSources

public ExtFindbugsTask clearSources()
Description copied from interface: SourceConfigurable
Clear the collection of sources.

Specified by:
clearSources in interface SourceConfigurable<ExtFindbugsTask>
Returns:
this.

getSource

public Object getSource()
Description copied from interface: SourceConfigured
Get the first source set.

Specified by:
getSource in interface SourceConfigured
Returns:
The first source in the source list or null if no source is set.

getSources

public List<Object> getSources()
Description copied from interface: SourceConfigured
Get the source list.

Specified by:
getSources in interface SourceConfigured
Returns:
The source list. Possibly empty but never null.

setRelativeToBase

public ExtFindbugsTask setRelativeToBase(RelativeLocation rel)
This is ignored.

Specified by:
setRelativeToBase in interface SourceConfigurable<ExtFindbugsTask>
Parameters:
rel - The source's location relative to the base location.
Returns:
this

get

public File get()
Description copied from interface: Producer
Returns the produced object, or null if nothing is produced yet.

This method should be implemented thread-safe.

Specified by:
get in interface Producer<File>
Returns:
The produced object.

getDefaultLogHeader

protected String getDefaultLogHeader()
Description copied from class: AbstractTask
Get the default log header to log (to level INFO) before the task is run if the task user has not set a custom header. Subclasses may override this to return better headers.

This is called after validating the task.

Return null to disable logging.

Overrides:
getDefaultLogHeader in class AbstractTask<ExtFindbugsTask>
Returns:
"Running " + toString()

validate

protected Collection<String> validate(Report r)
Description copied from class: AbstractTask
This method may be overridden by subclasses to validate their configuration (including their TaskFactory:s) before the task is run.

Validation errors are collected as strings. If this method is overridden, always call super.validate.

Overrides:
validate in class AbstractTask<ExtFindbugsTask>
Parameters:
r - A report to log warning and debug messages to. Validation errors should not be logged, though. They are logged later.
Returns:
A collection of error messages.

runInternal

protected void runInternal(Report r)
                    throws InterruptedException
Description copied from class: AbstractTask
Subclasses implement this. The task is AbstractTask.validate(Report):d before this method is called, see AbstractTask.run().

Specified by:
runInternal in class AbstractTask<ExtFindbugsTask>
Parameters:
r - The current thread's Report.
Throws:
InterruptedException

copyProperties

public void copyProperties(ExtFindbugsTask spec)
Description copied from class: AbstractTask
Copy the properties to the target object.

Subclasses must override this to copy their properties. The overriding method must call super.copyProperties.

Specified by:
copyProperties in interface TaskSpecification<ExtFindbugsTask>
Overrides:
copyProperties in class AbstractExtJvmTask<ExtFindbugsTask>
Parameters:
spec - The specification to copy properties to.

toString

public String toString()
Description copied from class: AbstractTask
Default implementation for tasks. Task implementations may override this. It is used in the default log header that is written (level INFO) before a task is run.

This implementation just returns the class name.

Overrides:
toString in class AbstractTask<ExtFindbugsTask>