From 26d5ac6cd5264b5bbc6f464aab5aed388a4746ed Mon Sep 17 00:00:00 2001 From: Peter Donald Date: Sun, 27 Jan 2002 09:42:56 +0000 Subject: [PATCH] Update classes for recent changes in fileset/scanner separation git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270938 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/ant/taskdefs/MatchingTask.java | 17 ++-- .../org/apache/tools/ant/taskdefs/Zip.java | 47 ++++++++--- .../tools/ant/taskdefs/javadoc/Javadoc.java | 2 +- .../apache/tools/ant/taskdefs/unix/Chmod.java | 7 +- .../apache/tools/ant/types/ZipFileSet.java | 80 +++---------------- .../tools/ant/taskdefs/MatchingTask.java | 17 ++-- .../org/apache/tools/ant/taskdefs/Zip.java | 47 ++++++++--- .../tools/ant/taskdefs/javadoc/Javadoc.java | 2 +- .../apache/tools/ant/taskdefs/unix/Chmod.java | 7 +- .../apache/tools/ant/types/ZipFileSet.java | 80 +++---------------- 10 files changed, 112 insertions(+), 194 deletions(-) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java index b2acef766..bdca4ce22 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java @@ -10,27 +10,25 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Pattern; +import org.apache.myrmidon.framework.PatternSet; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.DirectoryScanner; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.ScannerUtil; -import org.apache.myrmidon.framework.PatternSet; /** * This is an abstract task that should be used by all those tasks that require * to include or exclude files based on pattern matching. * - * @author Arnout J. Kuiper ajkuiper@wxs.nl - * @author Stefano Mazzocchi - * stefano@apache.org - * @author Sam Ruby rubys@us.ibm.com - * @author Jon S. Stevens jon@clearink.com + * @author Arnout J. Kuiper + * @author Stefano Mazzocchi + * @author Sam Ruby + * @author Jon S. Stevens * @author Stefan Bodewig */ public abstract class MatchingTask extends Task { - private boolean m_useDefaultExcludes = true; private FileSet m_fileset = new FileSet(); /** @@ -38,7 +36,7 @@ public abstract class MatchingTask */ public void setDefaultexcludes( final boolean useDefaultExcludes ) { - m_useDefaultExcludes = useDefaultExcludes; + m_fileset.setDefaultExcludes( useDefaultExcludes ); } /** @@ -48,7 +46,6 @@ public abstract class MatchingTask * @param excludes the string containing the exclude patterns */ public void setExcludes( final String excludes ) - throws TaskException { m_fileset.setExcludes( excludes ); } @@ -60,7 +57,6 @@ public abstract class MatchingTask * @param includes the string containing the include patterns */ public void setIncludes( final String includes ) - throws TaskException { m_fileset.setIncludes( includes ); } @@ -100,7 +96,6 @@ public abstract class MatchingTask throws TaskException { m_fileset.setDir( baseDir ); - m_fileset.setDefaultexcludes( m_useDefaultExcludes ); return ScannerUtil.getDirectoryScanner( m_fileset ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java index 187f8a74b..fc8799d33 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -20,17 +20,17 @@ import java.util.Hashtable; import java.util.Stack; import java.util.zip.CRC32; import java.util.zip.ZipInputStream; +import org.apache.aut.zip.ZipEntry; +import org.apache.aut.zip.ZipOutputStream; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.DirectoryScanner; import org.apache.tools.ant.types.FileScanner; import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.types.ScannerUtil; import org.apache.tools.ant.types.SourceFileScanner; import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.ant.types.ZipScanner; -import org.apache.tools.ant.types.ScannerUtil; import org.apache.tools.ant.util.mappers.MergingMapper; -import org.apache.aut.zip.ZipEntry; -import org.apache.aut.zip.ZipOutputStream; /** * Create a ZIP archive. @@ -266,8 +266,9 @@ public class Zip } for( int i = 0; i < m_filesets.size(); i++ ) { - FileSet fs = (FileSet)m_filesets.get( i ); - dss.add( ScannerUtil.getDirectoryScanner( fs ) ); + final FileSet fileSet = (FileSet)m_filesets.get( i ); + final DirectoryScanner scanner = getScanner( fileSet ); + dss.add( scanner ); } int dssSize = dss.size(); FileScanner[] scanners = new FileScanner[ dssSize ]; @@ -350,7 +351,8 @@ public class Zip // before we added any files, then we must swallow this exception. Otherwise, // the error that's reported will be the close() error, which is not the real // cause of the problem. - if( success ) { + if( success ) + { throw ex; } } @@ -390,6 +392,20 @@ public class Zip } } + private DirectoryScanner getScanner( final FileSet fileSet ) + throws TaskException + { + if( fileSet instanceof ZipFileSet ) + { + final ZipFileSet zipFileSet = (ZipFileSet)fileSet; + return ScannerUtil.getZipScanner( zipFileSet ); + } + else + { + return ScannerUtil.getDirectoryScanner( fileSet ); + } + } + protected void addFileAs( final File file, final String name ) throws TaskException { @@ -457,7 +473,8 @@ public class Zip } } - if( !zipFile.exists() ) { + if( !zipFile.exists() ) + { return false; } @@ -468,7 +485,7 @@ public class Zip for( int i = 0; i < scanners.length; i++ ) { if( scanner.restrict( fileNames[ i ], scanners[ i ].getBasedir(), null, - mm ).length > 0 ) + mm ).length > 0 ) { return false; } @@ -493,7 +510,8 @@ public class Zip String prefix, String fullpath ) throws IOException, TaskException { - if( prefix.length() > 0 && fullpath.length() > 0 ) { + if( prefix.length() > 0 && fullpath.length() > 0 ) + { throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); } @@ -501,7 +519,8 @@ public class Zip // directories that matched include patterns String[] dirs = scanner.getIncludedDirectories(); - if( dirs.length > 0 && fullpath.length() > 0 ) { + if( dirs.length > 0 && fullpath.length() > 0 ) + { throw new TaskException( "fullpath attribute may only be specified for filesets that specify a single file." ); } for( int i = 0; i < dirs.length; i++ ) @@ -520,7 +539,8 @@ public class Zip // files that matched include patterns String[] files = scanner.getIncludedFiles(); - if( files.length > 1 && fullpath.length() > 0 ) { + if( files.length > 1 && fullpath.length() > 0 ) + { throw new TaskException( "fullpath attribute may only be specified for filesets that specify a single file." ); } for( int i = 0; i < files.length; i++ ) @@ -557,7 +577,7 @@ public class Zip for( int i = 0; i < filesets.size(); i++ ) { FileSet fs = (FileSet)filesets.get( i ); - DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs ); + DirectoryScanner ds = getScanner( fs ); String prefix = ""; String fullpath = ""; @@ -649,7 +669,8 @@ public class Zip ZipOutputStream zOut, String prefix, String fullpath ) throws IOException, TaskException { - if( prefix.length() > 0 && fullpath.length() > 0 ) { + if( prefix.length() > 0 && fullpath.length() > 0 ) + { throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java index 52bd90716..6e68f169e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java @@ -941,7 +941,7 @@ public class Javadoc } FileSet fs = new FileSet(); - fs.setDefaultexcludes( m_useDefaultExcludes ); + fs.setDefaultExcludes( m_useDefaultExcludes ); Iterator e = packages.iterator(); while( e.hasNext() ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java index e621b5041..7b4677f3b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java @@ -48,15 +48,13 @@ public class Chmod * @param useDefaultExcludes "true"|"on"|"yes" when default exclusions * should be used, "false"|"off"|"no" when they shouldn't be used. */ - public void setDefaultexcludes( boolean useDefaultExcludes ) - throws TaskException + public void setDefaultExcludes( boolean useDefaultExcludes ) { m_defaultSetDefined = true; - m_defaultSet.setDefaultexcludes( useDefaultExcludes ); + m_defaultSet.setDefaultExcludes( useDefaultExcludes ); } public void setDir( File src ) - throws TaskException { m_defaultSet.setDir( src ); } @@ -78,7 +76,6 @@ public class Chmod } public void setFile( File src ) - throws TaskException { final FileSet fileSet = new FileSet(); fileSet.setDir( new File( src.getParent() ) ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipFileSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipFileSet.java index bb78420ca..39b5e07ef 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipFileSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipFileSet.java @@ -8,9 +8,6 @@ package org.apache.tools.ant.types; import java.io.File; -import org.apache.myrmidon.api.TaskException; -import org.apache.myrmidon.api.TaskContext; -import org.apache.tools.ant.Project; /** * A ZipFileSet is a FileSet with extra attributes useful in the context of @@ -25,43 +22,23 @@ import org.apache.tools.ant.Project; * task, and attributes in the refering ZipFileSet can augment FileSet * definition. * - * @author Don Ferguson don@bea.com + * @author Don Ferguson */ public class ZipFileSet extends FileSet { - private File srcFile = null; - private String prefix = ""; - private String fullpath = ""; - private boolean hasDir = false; - - /** - * Set the directory for the fileset. Prevents both "dir" and "src" from - * being specified. - */ - public void setDir( final File dir ) - throws TaskException - { - if( srcFile != null ) - { - final String message = "Cannot set both dir and src attributes"; - throw new TaskException( message ); - } - else - { - super.setDir( dir ); - hasDir = true; - } - } + private File m_src; + private String m_prefix = ""; + private String m_fullpath = ""; /** * Set the full pathname of the single entry in this fileset. * * @param fullpath The new Fullpath value */ - public void setFullpath( String fullpath ) + public void setFullpath( final String fullpath ) { - this.fullpath = fullpath; + m_fullpath = fullpath; } /** @@ -70,9 +47,9 @@ public class ZipFileSet * * @param prefix The prefix to prepend to entries in the zip file. */ - public void setPrefix( String prefix ) + public void setPrefix( final String prefix ) { - this.prefix = prefix; + m_prefix = prefix; } /** @@ -81,40 +58,9 @@ public class ZipFileSet * * @param srcFile The zip file from which to extract entries. */ - public void setSrc( File srcFile ) - throws TaskException - { - if( hasDir ) - { - throw new TaskException( "Cannot set both dir and src attributes" ); - } - this.srcFile = srcFile; - } - - /** - * Return the DirectoryScanner associated with this FileSet. If the - * ZipFileSet defines a source Zip file, then a ZipScanner is returned - * instead. - * - * @param p Description of Parameter - * @return The DirectoryScanner value - */ - public DirectoryScanner getDirectoryScanner( Project p ) - throws TaskException + public void setSrc( final File src ) { - if( srcFile != null ) - { - final ZipScanner zs = new ZipScanner(); - zs.setSrc( srcFile ); - super.setDir( p.getBaseDir() ); - ScannerUtil.setupDirectoryScanner( this, zs, null ); - zs.init(); - return zs; - } - else - { - return ScannerUtil.getDirectoryScanner( this ); - } + m_src = src; } /** @@ -124,7 +70,7 @@ public class ZipFileSet */ public String getFullpath() { - return fullpath; + return m_fullpath; } /** @@ -134,7 +80,7 @@ public class ZipFileSet */ public String getPrefix() { - return prefix; + return m_prefix; } /** @@ -146,6 +92,6 @@ public class ZipFileSet */ public File getSrc() { - return srcFile; + return m_src; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/MatchingTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/MatchingTask.java index b2acef766..bdca4ce22 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/MatchingTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/MatchingTask.java @@ -10,27 +10,25 @@ package org.apache.tools.ant.taskdefs; import java.io.File; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Pattern; +import org.apache.myrmidon.framework.PatternSet; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.DirectoryScanner; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.ScannerUtil; -import org.apache.myrmidon.framework.PatternSet; /** * This is an abstract task that should be used by all those tasks that require * to include or exclude files based on pattern matching. * - * @author Arnout J. Kuiper ajkuiper@wxs.nl - * @author Stefano Mazzocchi - * stefano@apache.org - * @author Sam Ruby rubys@us.ibm.com - * @author Jon S. Stevens jon@clearink.com + * @author Arnout J. Kuiper + * @author Stefano Mazzocchi + * @author Sam Ruby + * @author Jon S. Stevens * @author Stefan Bodewig */ public abstract class MatchingTask extends Task { - private boolean m_useDefaultExcludes = true; private FileSet m_fileset = new FileSet(); /** @@ -38,7 +36,7 @@ public abstract class MatchingTask */ public void setDefaultexcludes( final boolean useDefaultExcludes ) { - m_useDefaultExcludes = useDefaultExcludes; + m_fileset.setDefaultExcludes( useDefaultExcludes ); } /** @@ -48,7 +46,6 @@ public abstract class MatchingTask * @param excludes the string containing the exclude patterns */ public void setExcludes( final String excludes ) - throws TaskException { m_fileset.setExcludes( excludes ); } @@ -60,7 +57,6 @@ public abstract class MatchingTask * @param includes the string containing the include patterns */ public void setIncludes( final String includes ) - throws TaskException { m_fileset.setIncludes( includes ); } @@ -100,7 +96,6 @@ public abstract class MatchingTask throws TaskException { m_fileset.setDir( baseDir ); - m_fileset.setDefaultexcludes( m_useDefaultExcludes ); return ScannerUtil.getDirectoryScanner( m_fileset ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java index 187f8a74b..fc8799d33 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java @@ -20,17 +20,17 @@ import java.util.Hashtable; import java.util.Stack; import java.util.zip.CRC32; import java.util.zip.ZipInputStream; +import org.apache.aut.zip.ZipEntry; +import org.apache.aut.zip.ZipOutputStream; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.DirectoryScanner; import org.apache.tools.ant.types.FileScanner; import org.apache.tools.ant.types.FileSet; +import org.apache.tools.ant.types.ScannerUtil; import org.apache.tools.ant.types.SourceFileScanner; import org.apache.tools.ant.types.ZipFileSet; import org.apache.tools.ant.types.ZipScanner; -import org.apache.tools.ant.types.ScannerUtil; import org.apache.tools.ant.util.mappers.MergingMapper; -import org.apache.aut.zip.ZipEntry; -import org.apache.aut.zip.ZipOutputStream; /** * Create a ZIP archive. @@ -266,8 +266,9 @@ public class Zip } for( int i = 0; i < m_filesets.size(); i++ ) { - FileSet fs = (FileSet)m_filesets.get( i ); - dss.add( ScannerUtil.getDirectoryScanner( fs ) ); + final FileSet fileSet = (FileSet)m_filesets.get( i ); + final DirectoryScanner scanner = getScanner( fileSet ); + dss.add( scanner ); } int dssSize = dss.size(); FileScanner[] scanners = new FileScanner[ dssSize ]; @@ -350,7 +351,8 @@ public class Zip // before we added any files, then we must swallow this exception. Otherwise, // the error that's reported will be the close() error, which is not the real // cause of the problem. - if( success ) { + if( success ) + { throw ex; } } @@ -390,6 +392,20 @@ public class Zip } } + private DirectoryScanner getScanner( final FileSet fileSet ) + throws TaskException + { + if( fileSet instanceof ZipFileSet ) + { + final ZipFileSet zipFileSet = (ZipFileSet)fileSet; + return ScannerUtil.getZipScanner( zipFileSet ); + } + else + { + return ScannerUtil.getDirectoryScanner( fileSet ); + } + } + protected void addFileAs( final File file, final String name ) throws TaskException { @@ -457,7 +473,8 @@ public class Zip } } - if( !zipFile.exists() ) { + if( !zipFile.exists() ) + { return false; } @@ -468,7 +485,7 @@ public class Zip for( int i = 0; i < scanners.length; i++ ) { if( scanner.restrict( fileNames[ i ], scanners[ i ].getBasedir(), null, - mm ).length > 0 ) + mm ).length > 0 ) { return false; } @@ -493,7 +510,8 @@ public class Zip String prefix, String fullpath ) throws IOException, TaskException { - if( prefix.length() > 0 && fullpath.length() > 0 ) { + if( prefix.length() > 0 && fullpath.length() > 0 ) + { throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); } @@ -501,7 +519,8 @@ public class Zip // directories that matched include patterns String[] dirs = scanner.getIncludedDirectories(); - if( dirs.length > 0 && fullpath.length() > 0 ) { + if( dirs.length > 0 && fullpath.length() > 0 ) + { throw new TaskException( "fullpath attribute may only be specified for filesets that specify a single file." ); } for( int i = 0; i < dirs.length; i++ ) @@ -520,7 +539,8 @@ public class Zip // files that matched include patterns String[] files = scanner.getIncludedFiles(); - if( files.length > 1 && fullpath.length() > 0 ) { + if( files.length > 1 && fullpath.length() > 0 ) + { throw new TaskException( "fullpath attribute may only be specified for filesets that specify a single file." ); } for( int i = 0; i < files.length; i++ ) @@ -557,7 +577,7 @@ public class Zip for( int i = 0; i < filesets.size(); i++ ) { FileSet fs = (FileSet)filesets.get( i ); - DirectoryScanner ds = ScannerUtil.getDirectoryScanner( fs ); + DirectoryScanner ds = getScanner( fs ); String prefix = ""; String fullpath = ""; @@ -649,7 +669,8 @@ public class Zip ZipOutputStream zOut, String prefix, String fullpath ) throws IOException, TaskException { - if( prefix.length() > 0 && fullpath.length() > 0 ) { + if( prefix.length() > 0 && fullpath.length() > 0 ) + { throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java index 52bd90716..6e68f169e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java @@ -941,7 +941,7 @@ public class Javadoc } FileSet fs = new FileSet(); - fs.setDefaultexcludes( m_useDefaultExcludes ); + fs.setDefaultExcludes( m_useDefaultExcludes ); Iterator e = packages.iterator(); while( e.hasNext() ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Chmod.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Chmod.java index e621b5041..7b4677f3b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Chmod.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Chmod.java @@ -48,15 +48,13 @@ public class Chmod * @param useDefaultExcludes "true"|"on"|"yes" when default exclusions * should be used, "false"|"off"|"no" when they shouldn't be used. */ - public void setDefaultexcludes( boolean useDefaultExcludes ) - throws TaskException + public void setDefaultExcludes( boolean useDefaultExcludes ) { m_defaultSetDefined = true; - m_defaultSet.setDefaultexcludes( useDefaultExcludes ); + m_defaultSet.setDefaultExcludes( useDefaultExcludes ); } public void setDir( File src ) - throws TaskException { m_defaultSet.setDir( src ); } @@ -78,7 +76,6 @@ public class Chmod } public void setFile( File src ) - throws TaskException { final FileSet fileSet = new FileSet(); fileSet.setDir( new File( src.getParent() ) ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipFileSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipFileSet.java index bb78420ca..39b5e07ef 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipFileSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipFileSet.java @@ -8,9 +8,6 @@ package org.apache.tools.ant.types; import java.io.File; -import org.apache.myrmidon.api.TaskException; -import org.apache.myrmidon.api.TaskContext; -import org.apache.tools.ant.Project; /** * A ZipFileSet is a FileSet with extra attributes useful in the context of @@ -25,43 +22,23 @@ import org.apache.tools.ant.Project; * task, and attributes in the refering ZipFileSet can augment FileSet * definition. * - * @author Don Ferguson don@bea.com + * @author Don Ferguson */ public class ZipFileSet extends FileSet { - private File srcFile = null; - private String prefix = ""; - private String fullpath = ""; - private boolean hasDir = false; - - /** - * Set the directory for the fileset. Prevents both "dir" and "src" from - * being specified. - */ - public void setDir( final File dir ) - throws TaskException - { - if( srcFile != null ) - { - final String message = "Cannot set both dir and src attributes"; - throw new TaskException( message ); - } - else - { - super.setDir( dir ); - hasDir = true; - } - } + private File m_src; + private String m_prefix = ""; + private String m_fullpath = ""; /** * Set the full pathname of the single entry in this fileset. * * @param fullpath The new Fullpath value */ - public void setFullpath( String fullpath ) + public void setFullpath( final String fullpath ) { - this.fullpath = fullpath; + m_fullpath = fullpath; } /** @@ -70,9 +47,9 @@ public class ZipFileSet * * @param prefix The prefix to prepend to entries in the zip file. */ - public void setPrefix( String prefix ) + public void setPrefix( final String prefix ) { - this.prefix = prefix; + m_prefix = prefix; } /** @@ -81,40 +58,9 @@ public class ZipFileSet * * @param srcFile The zip file from which to extract entries. */ - public void setSrc( File srcFile ) - throws TaskException - { - if( hasDir ) - { - throw new TaskException( "Cannot set both dir and src attributes" ); - } - this.srcFile = srcFile; - } - - /** - * Return the DirectoryScanner associated with this FileSet. If the - * ZipFileSet defines a source Zip file, then a ZipScanner is returned - * instead. - * - * @param p Description of Parameter - * @return The DirectoryScanner value - */ - public DirectoryScanner getDirectoryScanner( Project p ) - throws TaskException + public void setSrc( final File src ) { - if( srcFile != null ) - { - final ZipScanner zs = new ZipScanner(); - zs.setSrc( srcFile ); - super.setDir( p.getBaseDir() ); - ScannerUtil.setupDirectoryScanner( this, zs, null ); - zs.init(); - return zs; - } - else - { - return ScannerUtil.getDirectoryScanner( this ); - } + m_src = src; } /** @@ -124,7 +70,7 @@ public class ZipFileSet */ public String getFullpath() { - return fullpath; + return m_fullpath; } /** @@ -134,7 +80,7 @@ public class ZipFileSet */ public String getPrefix() { - return prefix; + return m_prefix; } /** @@ -146,6 +92,6 @@ public class ZipFileSet */ public File getSrc() { - return srcFile; + return m_src; } }