From cd64830dd5a51fc77dd5fccfec4d33ec41576b9c Mon Sep 17 00:00:00 2001 From: j2blake Date: Fri, 2 Mar 2012 21:22:28 +0000 Subject: [PATCH] NIHVIVO-3597 Use a with a selector instead of the home-brewed DirDifferenceFileSet --- .../anttasks/AbstractWrappedFileSet.java | 84 ------------------- .../anttasks/DirDifferenceFileSet.java | 59 ------------- webapp/build.xml | 2 - 3 files changed, 145 deletions(-) delete mode 100644 utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/anttasks/AbstractWrappedFileSet.java delete mode 100644 utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/anttasks/DirDifferenceFileSet.java diff --git a/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/anttasks/AbstractWrappedFileSet.java b/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/anttasks/AbstractWrappedFileSet.java deleted file mode 100644 index c9913fd7a..000000000 --- a/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/anttasks/AbstractWrappedFileSet.java +++ /dev/null @@ -1,84 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.utilities.anttasks; - -import java.io.File; -import java.util.Iterator; -import java.util.List; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.PatternSet; -import org.apache.tools.ant.types.Resource; -import org.apache.tools.ant.types.ResourceCollection; -import org.apache.tools.ant.types.resources.FileResource; - -/** - * A base class for our custom-made FileSet extensions. - */ -public abstract class AbstractWrappedFileSet implements ResourceCollection { - private Project p; - - /** The list of FileResources that we will yield to the task. */ - protected List files; - - /** The internal FileSet */ - private FileSet fileSet = new FileSet(); - - public void setProject(Project p) { - this.p = p; - fileSet.setProject(p); - } - - public void setDir(File dir) { - fileSet.setDir(dir); - } - - public PatternSet.NameEntry createInclude() { - return fileSet.createInclude(); - } - - public PatternSet.NameEntry createExclude() { - return fileSet.createExclude(); - } - - public PatternSet createPatternSet() { - return fileSet.createPatternSet(); - } - - - @Override - public Object clone() { - throw new BuildException(this.getClass().getSimpleName() - + " does not support cloning."); - } - - @Override - public boolean isFilesystemOnly() { - return true; - } - - @Override - public Iterator iterator() { - fillFileList(); - return files.iterator(); - } - - @Override - public int size() { - fillFileList(); - return files.size(); - } - - protected abstract void fillFileList(); - - protected Project getProject() { - return p; - } - - protected FileSet getInternalFileSet() { - return fileSet; - } - -} diff --git a/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/anttasks/DirDifferenceFileSet.java b/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/anttasks/DirDifferenceFileSet.java deleted file mode 100644 index 72af590cd..000000000 --- a/utilities/buildutils/src/edu/cornell/mannlib/vitro/utilities/anttasks/DirDifferenceFileSet.java +++ /dev/null @@ -1,59 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.utilities.anttasks; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; - -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.resources.FileResource; - -/** - * TODO - */ -public class DirDifferenceFileSet extends AbstractWrappedFileSet { - private Path blockingPath; - - public Path createBlockingPath() { - if (blockingPath == null) { - blockingPath = new Path(getProject()); - } - return blockingPath.createPath(); - } - - @Override - protected void fillFileList() { - if (files != null) { - return; - } - - FileSet fs = getInternalFileSet(); - - @SuppressWarnings("unchecked") - Iterator iter = fs.iterator(); - - files = new ArrayList(); - while (iter.hasNext()) { - FileResource fr = iter.next(); - if (!isBlocked(fr)) { - files.add(fr); - } - } - } - - /** - * Check to see whether this same file exists in any of the blocking - * directories. - */ - private boolean isBlocked(FileResource fr) { - for (String blockingDir : blockingPath.list()) { - File f = new File(blockingDir + File.separator + fr.getName()); - if (f.exists()) { - return true; - } - } - return false; - } -} diff --git a/webapp/build.xml b/webapp/build.xml index b26e8d264..3ed917b8a 100644 --- a/webapp/build.xml +++ b/webapp/build.xml @@ -135,8 +135,6 @@ deploy - Deploy the application directly into the Tomcat webapps directory. - -