org.schmant.task.io.zip
Class AbstractJavaZipTask<T extends AbstractJavaZipTask<T>>

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<T>
                      extended by org.schmant.task.io.zip.AbstractJavaZipTask<T>
All Implemented Interfaces:
TaskDependency, ActionTaskConfigurable<T>, ActionTaskSpec<T>, LoggingConfigurable<T>, OverwriteConfigurable<T>, SourceConfigurable<T>, SourceConfigured, TargetConfigurable<T>, TargetConfigured, GeneratorTaskConfigurable<T>, GeneratorTaskSpec<T>, ProcessTaskConfigurable<T>, ProcessTaskSpec<T>, Task, TaskRunnable, TaskSpecification<T>
Direct Known Subclasses:
AbstractJarTask, ZipTask

public abstract class AbstractJavaZipTask<T extends AbstractJavaZipTask<T>>
extends AbstractZipTask<T>

This is an abstract base class for Zip tasks that use Java's built in Zip classes.

Since:
0.5
Author:
Karl Gustafsson
Task_package:
org.schmant.task.base

Field Summary
 
Fields inherited from interface org.schmant.task.confable.OverwriteConfigurable
DEFAULT_OVERWRITE_STRATEGY
 
Constructor Summary
AbstractJavaZipTask()
           
 
Method Summary
 void copyProperties(T spec)
          Override the implementation from AbstractTask to copy the source properties.
protected  Iterator<? extends ZipEntryInfo> createIterator()
          Create the iterator for the ZipCreator.
protected abstract  Iterator<? extends ZipEntryInfo> createIterator(SortedMap<AbsoluteLocation,EntityOrReadableFile> m)
          Subclasses implement this to create an iterator that will return ZipEntryInfo objects for each entry in the supplied map.
protected  ZipEntryInfoProvider getEntryInfoProvider()
           
protected  Integer getLevel()
           
protected  Integer getMethod()
           
 void setEntryInfoProvider(ZipEntryInfoProvider zeip)
           
 void setLevel(int l)
           
 void setMethod(int method)
           
 void setMethod(ZipCompressionMethod m)
           
 
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, runInternal, 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
 

Constructor Detail

AbstractJavaZipTask

public AbstractJavaZipTask()
Method Detail

setLevel

public final void setLevel(int l)

getLevel

protected final Integer getLevel()

setMethod

public final void setMethod(int method)

setMethod

public final void setMethod(ZipCompressionMethod m)

getMethod

protected final Integer getMethod()

setEntryInfoProvider

public final void setEntryInfoProvider(ZipEntryInfoProvider zeip)

getEntryInfoProvider

protected final ZipEntryInfoProvider getEntryInfoProvider()

createIterator

protected abstract Iterator<? extends ZipEntryInfo> createIterator(SortedMap<AbsoluteLocation,EntityOrReadableFile> m)
Subclasses implement this to create an iterator that will return ZipEntryInfo objects for each entry in the supplied map.

Parameters:
m - A map with the contents of the Zip file.
Returns:
A Zip entry info iterator.

createIterator

protected Iterator<? extends ZipEntryInfo> createIterator()
Create the iterator for the ZipCreator. This method first pre-interprets the sources property using the ArgumentInterpreter.preInterpret(Object) method (flattening the object list and evaluating all Producer:s}, and then interprets each resulting source object like this:
  1. If the source object is a EntityAndAbsoluteLocation, the first object is interpreted as the source file or directory (see below). The location object must be an AbsoluteLocation or a CharSequence that can be used to create an AbsoluteLocation.
  2. If the source object is any other object, it is interpreted as the source file or directory (see below).
The source file or directory is interpreted according using the following strategy:
  1. Try to interpret it as a named, readable file using InterpretAsNamedReadableFileStrategy.
  2. Interpret it with InterpretAsReadOnlyDirectoryStrategy

Returns:
A ZipEntryInfo iterator.

copyProperties

public void copyProperties(T 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<T extends AbstractJavaZipTask<T>>
Overrides:
copyProperties in class AbstractProcessTask<T extends AbstractJavaZipTask<T>>
Parameters:
spec - The specification to copy properties to.