net.sourceforge.groboutils.codecoverage.v2.ant
Class GroboReZipTask

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended bynet.sourceforge.groboutils.codecoverage.v2.ant.GroboReZipTask

public class GroboReZipTask
extends org.apache.tools.ant.Task

Similar to the Zip task, but its purpose is to modify not only one zip file, but possibly many containing zip files as well. Also, should have meta-inf support for modifying the classpath to add in the runtime jar file.

Since:
March 23, 2004
Version:
$Date: 2004/07/08 05:29:19 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

Nested Class Summary
static class GroboReZipTask.AlterEar
           
static class GroboReZipTask.AlterJar
           
static class GroboReZipTask.AlterWar
           
static class GroboReZipTask.AlterZip
          the base type for altering a zip file.
static class GroboReZipTask.AlterZipModifyEntry
          Recursively alter the inner zip file, by writing its contents to temporary files.
static class GroboReZipTask.ModifyEntry
          Tells the processing system that a particular file needs to be modified.
static class GroboReZipTask.ReZipFileSet
           
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
GroboReZipTask()
           
 
Method Summary
 void addAlterEar(GroboReZipTask.AlterEar z)
           
 void addAlterJar(GroboReZipTask.AlterJar z)
           
 void addAlterWar(GroboReZipTask.AlterWar z)
           
 void addAlterZip(GroboReZipTask.AlterZip z)
           
protected  void addParentDirs(java.io.File baseDir, java.lang.String entry, ZipOutputStream zOut, java.lang.String prefix, int dirMode, java.util.Vector addedFiles, boolean replaceOnly)
          Ripped from Ant's Zip task.
protected  void addResources(GroboReZipTask.AlterZip az, org.apache.tools.ant.types.FileSet fileset, java.lang.String[] resources, boolean areDirs, ZipOutputStream zOut, java.util.Vector addedFiles, java.util.Vector originalFiles)
          Add the given resources.
 void execute()
           
protected  void finalizeZipOutputStream(ZipOutputStream zOut)
          method for subclasses to override
protected  void initZipOutputStream(ZipOutputStream zOut)
          method for subclasses to override
 void processZip(GroboReZipTask.AlterZip az, java.io.File src, java.io.File dest)
           
protected  void zipDir(java.io.File dir, ZipOutputStream zOut, java.lang.String vPath, int mode, java.util.Vector addedFiles)
          Ripped from Ant's Zip task.
protected  void zipFile(GroboReZipTask.AlterZip az, java.io.File file, ZipOutputStream zOut, java.lang.String vPath, int mode, java.util.Vector addedFiles)
          Ripped from Ant's Zip task.
protected  void zipFile(GroboReZipTask.AlterZip az, GroboReZipTask.ModifyEntry me, java.io.InputStream in, ZipOutputStream zOut, java.lang.String vPath, long lastModified, java.io.File fromArchive, int mode, java.util.Vector addedFiles)
          Ripped from Ant's Zip task.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroboReZipTask

public GroboReZipTask()
Method Detail

addAlterZip

public void addAlterZip(GroboReZipTask.AlterZip z)

addAlterWar

public void addAlterWar(GroboReZipTask.AlterWar z)

addAlterEar

public void addAlterEar(GroboReZipTask.AlterEar z)

addAlterJar

public void addAlterJar(GroboReZipTask.AlterJar z)

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Throws:
org.apache.tools.ant.BuildException

processZip

public void processZip(GroboReZipTask.AlterZip az,
                       java.io.File src,
                       java.io.File dest)
                throws org.apache.tools.ant.BuildException,
                       java.io.IOException
Throws:
org.apache.tools.ant.BuildException
java.io.IOException

addResources

protected final void addResources(GroboReZipTask.AlterZip az,
                                  org.apache.tools.ant.types.FileSet fileset,
                                  java.lang.String[] resources,
                                  boolean areDirs,
                                  ZipOutputStream zOut,
                                  java.util.Vector addedFiles,
                                  java.util.Vector originalFiles)
                           throws java.io.IOException
Add the given resources. Ripped from Ant's Zip task.

Parameters:
fileset - may give additional information like fullpath or permissions.
resources - the resources to add
zOut - the stream to write to
Throws:
java.io.IOException
Since:
Ant 1.5.2

addParentDirs

protected final void addParentDirs(java.io.File baseDir,
                                   java.lang.String entry,
                                   ZipOutputStream zOut,
                                   java.lang.String prefix,
                                   int dirMode,
                                   java.util.Vector addedFiles,
                                   boolean replaceOnly)
                            throws java.io.IOException
Ripped from Ant's Zip task. Ensure all parent dirs of a given entry have been added.

Throws:
java.io.IOException
Since:
Ant 1.5.2

zipDir

protected void zipDir(java.io.File dir,
                      ZipOutputStream zOut,
                      java.lang.String vPath,
                      int mode,
                      java.util.Vector addedFiles)
               throws java.io.IOException
Ripped from Ant's Zip task.

Throws:
java.io.IOException
Since:
Ant 1.5.2

zipFile

protected void zipFile(GroboReZipTask.AlterZip az,
                       java.io.File file,
                       ZipOutputStream zOut,
                       java.lang.String vPath,
                       int mode,
                       java.util.Vector addedFiles)
                throws java.io.IOException
Ripped from Ant's Zip task. Method that gets called when adding from java.io.File instances.

This implementation delegates to the six-arg version.

Parameters:
file - the file to add to the archive
zOut - the stream to write to
vPath - the name this entry shall have in the archive
mode - the Unix permissions to set.
Throws:
java.io.IOException
Since:
Ant 1.5.2

zipFile

protected void zipFile(GroboReZipTask.AlterZip az,
                       GroboReZipTask.ModifyEntry me,
                       java.io.InputStream in,
                       ZipOutputStream zOut,
                       java.lang.String vPath,
                       long lastModified,
                       java.io.File fromArchive,
                       int mode,
                       java.util.Vector addedFiles)
                throws java.io.IOException
Ripped from Ant's Zip task. Adds a new entry to the archive, takes care of duplicates as well.

Parameters:
in - the stream to read data for the entry from.
zOut - the stream to write to.
vPath - the name this entry shall have in the archive.
lastModified - last modification time for the entry.
fromArchive - the original archive we are copying this entry from, will be null if we are not copying from an archive.
mode - the Unix permissions to set.
Throws:
java.io.IOException
Since:
Ant 1.5.2

initZipOutputStream

protected void initZipOutputStream(ZipOutputStream zOut)
                            throws java.io.IOException,
                                   org.apache.tools.ant.BuildException
method for subclasses to override

Throws:
java.io.IOException
org.apache.tools.ant.BuildException

finalizeZipOutputStream

protected void finalizeZipOutputStream(ZipOutputStream zOut)
                                throws java.io.IOException,
                                       org.apache.tools.ant.BuildException
method for subclasses to override

Throws:
java.io.IOException
org.apache.tools.ant.BuildException


Copyright © 2001-2003 by The GroboUtils Project