org.schmant.task.at4j.zip
Class At4JZipTask

java.lang.Object
  extended by org.schmant.support.AbstractArgumentChecker
      extended by org.schmant.task.stub.AbstractTask<T>
          extended by org.schmant.task.stub.AbstractActionTask<T>
              extended by org.schmant.task.stub.AbstractProcessTask<T>
                  extended by org.schmant.task.template.io.zip.AbstractZipTask<At4JZipTask>
                      extended by org.schmant.task.at4j.zip.At4JZipTask
All Implemented Interfaces:
Producer<EFile>, TaskDependency, ActionTaskConfigurable<At4JZipTask>, ActionTaskSpec<At4JZipTask>, LoggingConfigurable<At4JZipTask>, OverwriteConfigurable<At4JZipTask>, SourceConfigurable<At4JZipTask>, SourceConfigured, TargetConfigurable<At4JZipTask>, TargetConfigured, GeneratorTaskConfigurable<At4JZipTask>, GeneratorTaskSpec<At4JZipTask>, ProcessTaskConfigurable<At4JZipTask>, ProcessTaskSpec<At4JZipTask>, Task, TaskRunnable, TaskSpecification<At4JZipTask>

public final class At4JZipTask
extends AbstractZipTask<At4JZipTask>
implements Producer<EFile>

See At4JZipTF

Since:
0.8
Author:
Karl Gustafsson
Task_package:
org.at4j

Field Summary
 
Fields inherited from interface org.schmant.task.confable.OverwriteConfigurable
DEFAULT_OVERWRITE_STRATEGY
 
Method Summary
protected  void addToZipBuilder(ZipBuilder zb, Object src)
          This method interprets the argument and adds it to the Zip builder.
 void copyProperties(At4JZipTask spec)
          Override the implementation from AbstractTask to copy the source properties.
 EFile get()
          Returns the produced object, or null if nothing is produced yet.
protected  void runInternal(Report r)
          Subclasses implement this.
 
Methods inherited from class org.schmant.task.template.io.zip.AbstractZipTask
getComment, isMoreThanOneSourceAllowed
 
Methods inherited from class org.schmant.task.stub.AbstractProcessTask
getOverwriteStrategy, getTarget, isTargetMandatory, setOverwrite, setOverwriteStrategy, setTarget, toString, validate
 
Methods inherited from class org.schmant.task.stub.AbstractActionTask
addSource, addSources, clearSources, getRelativeToBase, getSource, getSources, isSourcesMandatory, setRelativeToBase, setSource, setSources
 
Methods inherited from class org.schmant.task.stub.AbstractTask
cancel, createTask, getDefaultLogFooter, getDefaultLogHeader, 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.confable.SourceConfigurable
addSource, addSources, clearSources, setRelativeToBase, setSource, setSources
 
Methods inherited from interface org.schmant.task.confable.SourceConfigured
getSource, getSources
 
Methods inherited from interface org.schmant.task.TaskSpecification
createTask
 
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable
setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 

Method Detail

get

public EFile 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<EFile>
Returns:
The produced object.

addToZipBuilder

protected void addToZipBuilder(ZipBuilder zb,
                               Object src)
                        throws ArgumentInterpretationException
This method interprets the argument and adds it to the Zip builder.

The argument is interpreted using the following rules:

  1. If it is an EntityAndAbsoluteLocation object, use the absolute location for the entry and start over trying to interpret the entity from the first rule.
  2. If it is a ZipEntryAndSettings object, remember the entry settings and start over trying to interpret the entity from the first rule.
  3. If it is a ZipDirectoryWithRules object, remember the rules and start over trying to interpret the entity from the first rule.
  4. If the source can be interpreted using the ArgumentInterpreter.getReadOnlyDirectoryOrNull(java.lang.Object) method, add the contents of the directory recursively. If an absolute location is available, use that as the directory hierarchy's root directory in the Zip file. If rules are available, use them. If no rules are available, but a settings object is, use the settings for all added entries.
  5. If the source can be interpreted using the ArgumentInterpreter.getNamedReadableFileOrNull(java.lang.Object) method, add the file. If an absolute location is available, use that as the location of the file's parent directory. If a settings object is available, use that.
  6. If the source can be interpreted using the ArgumentInterpreter.getReadableFileOrNull(java.lang.Object) method, add the file at the location given by the absolute location object, which must be available. If a settings object is available, use that.
  7. If the source is an InputStream, add the contents read from the stream at the location given by the absolute location object, which must be available. If a settings object is available, use that.
  8. If none of the previous rules matched, throw an ArgumentInterpretationException.

Parameters:
zb - The zip builder.
src - The object to interpret and add to the builder.
Throws:
ArgumentInterpretationException - If the source object could not be interpreted.

runInternal

protected void runInternal(Report r)
                    throws Exception
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<At4JZipTask>
Parameters:
r - The current thread's Report.
Throws:
Exception - On errors.

copyProperties

public void copyProperties(At4JZipTask spec)
Description copied from class: AbstractActionTask
Override the implementation from AbstractTask to copy the source properties. Subclasses must override this to copy their own properties.

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