This patch provides the following feature (a notcontains
element has been added since the previous submission.
So please ignore the earlier one):
* The include and exclude elements allows inclusion of
zero or more 'contains' and 'notcontains' elements.
* The contains and notcontains elements take in 2 attributes:
o text
o ignorecase
* the text attribute defines the text to be searched
for in the file(s).
* the ignorecase attribute specifies if the search is to
be performed in a case-sensitive manner.
* If a Regular Expression Matcher is defined, the text
attribute is treated as a regular expression, otherwise,
it is treated as plain text. When using a regular
expression, it is possible to also include files that
do not contain a specific pattern.
Example:
<property name="ant.regexp.matcherimpl"
value="org.apache.tools.ant.util.regexp.JakartaOroMatcher"/>
...
<copy todir="/tmp">
<fileset dir=".">
<patternset id="foo">
<!--
Include xml files that contain the text foo and ABC and
does not contain the text bar (case doesn't matter)
-->
<include name="**/*.xml">
<contains text="foo"/>
<notcontains text="bar" ignorecase="yes"/>
<contains text="ABC"/>
</include>
<exclude name="**/Test*.xml>
<contains text="[0-9]foobar*" ignorecase="no"/>
</include>
</patternset>
</fileset>
</copy>
This patch does not break backwards compatibility.
Please consider adding this feature for Ant 1.5.
Thanks,
Magesh
Index: FileScanner.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/FileScanner.java,v
retrieving revision 1.6
diff -u -w -r1.6 FileScanner.java
--- FileScanner.java 2001/09/30 13:21:53 1.6
+++ FileScanner.java 2001/10/16 03:04:57
@@ -54,7 +54,9 @@
package org.apache.tools.ant;
import java.io.*;
+import org.apache.tools.ant.types.*;
+
/**
* An interface used to describe the actions required by any type of
* directory scanner.
@@ -152,7 +154,18 @@
* @param includes list of include patterns
*/
void setIncludes(String[] includes);
-
+ /**
+ * Sets the set of extended exclude patterns to use.
+ *
+ * @param excludes list of extended exclude patterns
+ */
+ void setExcludes(ExtendedPattern[] excludes);
+ /**
+ * Sets the set of extended include patterns to use.
+ *
+ * @param includes list of extended include patterns
+ */
+ void setIncludes(ExtendedPattern[] includes);
/**
* Sets the case sensitivity of the file system
*
**************************************************************************
Index: DirectoryScanner.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/DirectoryScanner.java,v
retrieving revision 1.16
diff -u -w -r1.16 DirectoryScanner.java
--- DirectoryScanner.java 2001/09/30 13:21:53 1.16
+++ DirectoryScanner.java 2001/10/16 03:05:40
@@ -56,6 +56,8 @@
import java.io.*;
import java.util.*;
+import org.apache.tools.ant.types.*;
+import org.apache.tools.ant.util.regexp.*;
/**
* Class for scanning a directory for files/directories that match a certain
@@ -166,12 +168,12 @@
/**
* The patterns for the files that should be included.
*/
- protected String[] includes;
+ protected ExtendedPattern[] includes;
/**
* The patterns for the files that should be excluded.
*/
- protected String[] excludes;
+ protected ExtendedPattern[] excludes;
/**
* The files that where found and matched at least one includes, and
matched
@@ -236,7 +238,7 @@
* @param str the (non-null) string (path) to match
*/
protected static boolean matchPatternStart(String pattern, String str) {
- return matchPatternStart(pattern, str, true);
+ return matchPatternStart(pattern, null, null, str, true);
}
/**
@@ -253,6 +255,26 @@
*/
protected static boolean matchPatternStart(String pattern, String str,
boolean isCaseSensitive) {
+ return matchPatternStart(pattern, null, null, str, isCaseSensitive);
+ }
+
+ /**
+ * Does the path match the start of this pattern up to the first "**".
+ *
+ * <p>This is not a general purpose test and should only be used if you
+ * can live with false positives.</p>
+ *
+ * <p><code>pattern=**\\a</code> and <code>str=b</code> will yield true.
+ *
+ * @param pattern the (non-null) pattern to match against
+ * @param contains the list of 'ContainsEntry's
+ * @param notcontains the list of not 'ContainsEntry's
+ * @param str the (non-null) string (path) to match
+ * @param isCaseSensitive must matches be case sensitive?
+ */
+ protected static boolean matchPatternStart(String pattern, Vector contains,
+ Vector notContains, String str,
+ boolean isCaseSensitive) {
// When str starts with a File.separator, pattern has to start with a
// File.separator.
// When pattern starts with a File.separator, str has to start with a
@@ -305,6 +327,121 @@
}
}
+ protected static boolean checkContents(String str, Vector contains,
+ Vector notContains) {
+ boolean isInclusive = true;
+ if (contains != null || notContains != null) {
+ PatternSet.ContainsEntry[] containsEntries = null;
+ PatternSet.ContainsEntry[] notContainsEntries = null;
+ boolean[] containsIndices = null;
+ boolean[] notContainsIndices = null;
+ RegexpMatcherFactory rmFactory = new RegexpMatcherFactory();
+ RegexpMatcher rm = null;
+
+ try {
+ rm = rmFactory.newRegexpMatcher();
+ } catch (BuildException e) {
+ //No regexp matcher being used. Treat patterns as flat strings
+ System.out.println(e.getMessage());
+ }
+
+ if (contains != null) {
+ containsEntries = new PatternSet
+ .ContainsEntry[contains.size()];
+ contains.copyInto(containsEntries);
+ containsIndices = new boolean[containsEntries.length];
+ }
+ if (notContains != null) {
+ notContainsEntries = new PatternSet
+ .ContainsEntry[notContains.size()];
+ notContains.copyInto(notContainsEntries);
+ notContainsIndices = new boolean[notContainsEntries.length];
+ }
+
+ BufferedReader fileReader = null;
+ try {
+ File fileToScan= new File(str);
+ if (fileToScan.isFile()) {
+ fileReader = new BufferedReader(
+ new FileReader(str));
+
+ String line = fileReader.readLine();
+ while (line != null) {
+ int i = 0;
+ for (i = 0; i < containsEntries.length; i++) {
+ if (!containsIndices[i]) {
+ String text = containsEntries[i].getText();
+ boolean ignorecase =
+ containsEntries[i].getIgnoreCase();
+ if (text != null) {
+ if (ignorecase) {
+ line = line.toUpperCase();
+ text = text.toUpperCase();
+ }
+ if (rm == null) {
+ if (line.indexOf(text) != -1) {
+ containsIndices[i] = true;
+ }
+ } else {
+ rm.setPattern(text);
+ containsIndices[i] = rm.matches(line);
+ }
+ }
+ }
+ }
+ for (i = 0; i < notContainsEntries.length; i++) {
+ if (!notContainsIndices[i]) {
+ String text = notContainsEntries[i].getText();
+ boolean ignorecase =
+ notContainsEntries[i].getIgnoreCase();
+ if (text != null) {
+ if (ignorecase) {
+ line = line.toUpperCase();
+ text = text.toUpperCase();
+ }
+ if (rm == null) {
+ if (line.indexOf(text) != -1) {
+ notContainsIndices[i] = true;
+ }
+ } else {
+ rm.setPattern(text);
+ notContainsIndices[i] =
rm.matches(line);
+ }
+ }
+ }
+ }
+ line = fileReader.readLine();
+ }
+
+ for (int j = 0; j < containsIndices.length; j++) {
+ if (containsIndices[j] != true) {
+ isInclusive = false;
+ break;
+ }
+ }
+ for (int j = 0; j < notContainsIndices.length; j++) {
+ if (notContainsIndices[j] != false) {
+ isInclusive = false;
+ break;
+ }
+ }
+ }
+ } catch (IOException ioe) {
+ throw new BuildException("IO error scanning file: "
+ + str);
+ } finally {
+ if( null != fileReader ) {
+ try {
+ fileReader.close();
+ } catch(IOException ioe) {
+ //Ignore exception
+ }
+ }
+ }
+ }
+ return isInclusive;
+ }
+
/**
* Matches a path against a pattern.
*
@@ -315,7 +452,7 @@
* <code>false</code> otherwise.
*/
protected static boolean matchPath(String pattern, String str) {
- return matchPath(pattern, str, true);
+ return matchPath(pattern, null, null, str, true);
}
/**
@@ -328,7 +465,27 @@
* @return <code>true</code> when the pattern matches against the string.
* <code>false</code> otherwise.
*/
- protected static boolean matchPath(String pattern, String str, boolean
isCaseSensitive) {
+ protected static boolean matchPath(String pattern, String str,
+ boolean isCaseSensitive) {
+ return matchPath(pattern, null, null, str, isCaseSensitive);
+ }
+
+ /**
+ * Matches a path against a pattern.
+ *
+ * @param pattern the (non-null) pattern to match against
+ * @param contains the containsEntry list
+ * @param notContains the notContainsEntry list
+ * @param str the (non-null) string (path) to match
+ * @param isCaseSensitive must a case sensitive match be done?
+ *
+ * @return <code>true</code> when the pattern matches against the string.
+ * <code>false</code> otherwise.
+ */
+ protected static boolean matchPath(String pattern, Vector contains,
+ Vector notContains, String str,
+ boolean isCaseSensitive) {
+
// When str starts with a File.separator, pattern has to start with a
// File.separator.
// When pattern starts with a File.separator, str has to start with a
@@ -361,7 +518,8 @@
if (patDir.equals("**")) {
break;
}
- if (!match(patDir,(String)strDirs.elementAt(strIdxStart),
isCaseSensitive)) {
+ if (!match(patDir, (String)strDirs.elementAt(strIdxStart),
+ isCaseSensitive)) {
return false;
}
patIdxStart++;
@@ -374,7 +532,7 @@
return false;
}
}
- return true;
+ return checkContents(str, contains, notContains);
} else {
if (patIdxStart > patIdxEnd) {
// String not exhausted, but pattern is. Failure.
@@ -388,7 +546,8 @@
if (patDir.equals("**")) {
break;
}
- if (!match(patDir,(String)strDirs.elementAt(strIdxEnd),
isCaseSensitive)) {
+ if (!match(patDir, (String)strDirs.elementAt(strIdxEnd),
+ isCaseSensitive)) {
return false;
}
patIdxEnd--;
@@ -401,7 +560,7 @@
return false;
}
}
- return true;
+ return checkContents(str, contains, notContains);
}
while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {
@@ -450,7 +609,7 @@
}
}
- return true;
+ return checkContents(str, contains, notContains);
}
@@ -485,7 +644,9 @@
* @return <code>true</code> when the string matches against the pattern,
* <code>false</code> otherwise.
*/
- protected static boolean match(String pattern, String str, boolean
isCaseSensitive) {
+ protected static boolean match(String pattern,
+ String str,
+ boolean isCaseSensitive) {
char[] patArr = pattern.toCharArray();
char[] strArr = str.toCharArray();
int patIdxStart = 0;
@@ -644,7 +805,9 @@
* @param basedir the (non-null) basedir for scanning
*/
public void setBasedir(String basedir) {
- setBasedir(new
File(basedir.replace('/',File.separatorChar).replace('\\',File.separatorChar)));
+ setBasedir(new File(basedir
+ .replace('/',File.separatorChar)
+ .replace('\\',File.separatorChar)));
}
@@ -682,6 +845,19 @@
this.isCaseSensitive = isCaseSensitive;
}
+ public void setIncludes(String[] includes) {
+ if (includes == null) {
+ this.includes = null;
+ } else {
+ ExtendedPattern[] ep = new ExtendedPattern[includes.length];
+ for (int i = 0; i < includes.length; i++) {
+ ep[i] = new ExtendedPattern();
+ ep[i].setPattern(includes[i]);
+ }
+ setIncludes(ep);
+ }
+ }
+
/**
* Sets the set of include patterns to use. All '/' and '\' characters are
* replaced by <code>File.separatorChar</code>. So the separator used need
@@ -691,23 +867,42 @@
*
* @param includes list of include patterns
*/
- public void setIncludes(String[] includes) {
+ public void setIncludes(ExtendedPattern[] includes) {
if (includes == null) {
this.includes = null;
} else {
- this.includes = new String[includes.length];
+ this.includes = new ExtendedPattern[includes.length];
for (int i = 0; i < includes.length; i++) {
String pattern;
- pattern =
includes[i].replace('/',File.separatorChar).replace('\\',File.separatorChar);
+ pattern = includes[i]
+ .getPattern()
+ .replace('/',File.separatorChar)
+ .replace('\\',File.separatorChar);
if (pattern.endsWith(File.separator)) {
pattern += "**";
}
- this.includes[i] = pattern;
+ this.includes[i] = new ExtendedPattern();
+ this.includes[i].setPattern(pattern);
+ this.includes[i].setContainsList(includes[i]
+ .getContainsList());
+ this.includes[i].setNotContainsList(includes[i]
+ .getNotContainsList());
}
}
}
-
+ public void setExcludes(String[] excludes) {
+ if (excludes == null) {
+ this.excludes = null;
+ } else {
+ ExtendedPattern[] ep = new ExtendedPattern[excludes.length];
+ for (int i = 0; i < excludes.length; i++) {
+ ep[i] = new ExtendedPattern();
+ ep[i].setPattern(excludes[i]);
+ }
+ setExcludes(ep);
+ }
+ }
/**
* Sets the set of exclude patterns to use. All '/' and '\' characters are
@@ -718,18 +913,26 @@
*
* @param excludes list of exclude patterns
*/
- public void setExcludes(String[] excludes) {
+ public void setExcludes(ExtendedPattern[] excludes) {
if (excludes == null) {
this.excludes = null;
} else {
- this.excludes = new String[excludes.length];
+ this.excludes = new ExtendedPattern[excludes.length];
for (int i = 0; i < excludes.length; i++) {
String pattern;
- pattern =
excludes[i].replace('/',File.separatorChar).replace('\\',File.separatorChar);
+ pattern = excludes[i]
+ .getPattern()
+ .replace('/',File.separatorChar)
+ .replace('\\',File.separatorChar);
if (pattern.endsWith(File.separator)) {
pattern += "**";
}
- this.excludes[i] = pattern;
+ this.excludes[i] = new ExtendedPattern();
+ this.excludes[i].setPattern(pattern);
+ this.excludes[i].setContainsList(excludes[i]
+ .getContainsList());
+ this.excludes[i].setNotContainsList(excludes[i]
+ .getNotContainsList());
}
}
}
@@ -757,11 +960,12 @@
if (includes == null) {
// No includes supplied, so set it to 'matches all'
- includes = new String[1];
- includes[0] = "**";
+ includes = new ExtendedPattern[1];
+ includes[0] = new ExtendedPattern();
+ includes[0].setPattern("**");
}
if (excludes == null) {
- excludes = new String[0];
+ excludes = new ExtendedPattern[0];
}
filesIncluded = new Vector();
@@ -899,7 +1103,10 @@
*/
protected boolean isIncluded(String name) {
for (int i = 0; i < includes.length; i++) {
- if (matchPath(includes[i],name, isCaseSensitive)) {
+ if (matchPath(includes[i].getPattern(),
+ includes[i].getContainsList(),
+ includes[i].getNotContainsList(),
+ name, isCaseSensitive)) {
return true;
}
}
@@ -915,7 +1122,10 @@
*/
protected boolean couldHoldIncluded(String name) {
for (int i = 0; i < includes.length; i++) {
- if (matchPatternStart(includes[i],name, isCaseSensitive)) {
+ if (matchPatternStart(includes[i].getPattern(),
+ includes[i].getContainsList(),
+ includes[i].getNotContainsList(),
+ name, isCaseSensitive)) {
return true;
}
}
@@ -931,7 +1141,10 @@
*/
protected boolean isExcluded(String name) {
for (int i = 0; i < excludes.length; i++) {
- if (matchPath(excludes[i],name, isCaseSensitive)) {
+ if (matchPath(excludes[i].getPattern(),
+ excludes[i].getContainsList(),
+ excludes[i].getNotContainsList(),
+ name, isCaseSensitive)) {
return true;
}
}
@@ -1062,9 +1275,17 @@
System.arraycopy(excludes,0,newExcludes,0,excludesLength);
}
for (int i = 0; i < DEFAULTEXCLUDES.length; i++) {
- newExcludes[i+excludesLength] =
DEFAULTEXCLUDES[i].replace('/',File.separatorChar).replace('\\',File.separatorChar);
+ newExcludes[i+excludesLength] = DEFAULTEXCLUDES[i]
+ .replace('/',File.separatorChar)
+ .replace('\\',File.separatorChar);
+ }
+
+ ExtendedPattern[] ep = new ExtendedPattern[newExcludes.length];
+ for (int i = 0; i < ep.length; i++) {
+ ep[i] = new ExtendedPattern();
+ ep[i].setPattern(newExcludes[i]);
}
- excludes = newExcludes;
+ excludes = ep;
}
}
**************************************************************************
Index: PatternSet.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/types/PatternSet.java,v
retrieving revision 1.12
diff -u -w -r1.12 PatternSet.java
--- PatternSet.java 2001/10/06 01:07:20 1.12
+++ PatternSet.java 2001/10/16 03:06:43
@@ -75,6 +75,7 @@
* @author Sam Ruby <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @author Jon S. Stevens <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Magesh Umasankar</a>
*/
public class PatternSet extends DataType {
private Vector includeList = new Vector();
@@ -83,11 +84,38 @@
private Vector excludesFileList = new Vector();
/**
+ * inner class to hold a contains entry on list. A ContainsEntry
+ * is made up of the pattern and case sensitivity detail.
+ */
+ public class ContainsEntry {
+ private String text;
+ private boolean ignorecase;
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public void setIgnoreCase(boolean ignorecase) {
+ this.ignorecase = ignorecase;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public boolean getIgnoreCase() {
+ return ignorecase;
+ }
+ }
+
+ /**
* inner class to hold a name on list. "If" and "Unless" attributes
* may be used to invalidate the entry based on the existence of a
* property (typically set thru the use of the Available task).
*/
- public class NameEntry {
+ public class NameEntry extends DataType {
+ private Vector containsList = new Vector();
+ private Vector notContainsList = new Vector();
private String name;
private String ifCond;
private String unlessCond;
@@ -141,8 +169,53 @@
return buf.toString();
}
+
+ public ContainsEntry createContains() {
+ if (isReference()) {
+ throw noChildrenAllowed();
}
+ return addTextToList(containsList);
+ }
+ public ContainsEntry createNotContains() {
+ if (isReference()) {
+ throw noChildrenAllowed();
+ }
+ return addTextToList(notContainsList);
+ }
+ /**
+ * add a contains entry to the given list
+ */
+ private ContainsEntry addTextToList(Vector list) {
+ ContainsEntry result = new ContainsEntry ();
+ list.addElement(result);
+ return result;
+ }
+
+ public Vector getContainsList() {
+ return containsList;
+ }
+
+ public Vector getNotContainsList() {
+ return notContainsList;
+ }
+
+ public void setRefid(Reference r) throws BuildException {
+ if (!containsList.isEmpty() || !notContainsList.isEmpty()) {
+ throw tooManyAttributes();
+ }
+ super.setRefid(r);
+ }
+
+ public void setContainsList(Vector list) {
+ this.containsList = list;
+ }
+
+ public void setNotContainsList(Vector list) {
+ this.notContainsList = list;
+ }
+ }
+
public PatternSet() {
super();
}
@@ -312,11 +385,38 @@
/**
* Adds the patterns of the other instance to this set.
*/
- public void append(PatternSet other, Project p) {
+ public void appendExtended(PatternSet other, Project p) {
if (isReference()) {
throw new BuildException("Cannot append to a reference");
}
+ ExtendedPattern[] incl = other.getExtendedIncludePatterns(p);
+ if (incl != null) {
+ for (int i=0; i<incl.length; i++) {
+ NameEntry ne = createInclude();
+ ne.setName(incl[i].getPattern());
+ ne.setContainsList(incl[i].getContainsList());
+ ne.setNotContainsList(incl[i].getNotContainsList());
+ }
+ }
+ ExtendedPattern[] excl = other.getExtendedExcludePatterns(p);
+ if (excl != null) {
+ for (int i=0; i<excl.length; i++) {
+ NameEntry ne = createExclude();
+ ne.setName(excl[i].getPattern());
+ ne.setContainsList(incl[i].getContainsList());
+ ne.setNotContainsList(incl[i].getNotContainsList());
+ }
+ }
+ }
+
+ /**
+ * Adds the patterns of the other instance to this set.
+ */
+ public void append(PatternSet other, Project p) {
+ if (isReference()) {
+ throw new BuildException("Cannot append to a reference");
+ }
String[] incl = other.getIncludePatterns(p);
if (incl != null) {
for (int i=0; i<incl.length; i++) {
@@ -332,8 +432,32 @@
}
}
+ /**
+ * Returns the filtered include patterns as an array of 'ExtendedPattern's
+ */
+ public ExtendedPattern[] getExtendedIncludePatterns(Project p) {
+ if (isReference()) {
+ return getRef(p).getExtendedIncludePatterns(p);
+ } else {
+ readFiles(p);
+ return makeExtendedPatternArray(includeList, p);
+ }
+ }
+
+ /**
+ * Returns the filtered exclude patterns as an array of 'ExtendedPattern's
+ */
+ public ExtendedPattern[] getExtendedExcludePatterns(Project p) {
+ if (isReference()) {
+ return getRef(p).getExtendedExcludePatterns(p);
+ } else {
+ readFiles(p);
+ return makeExtendedPatternArray(excludeList, p);
+ }
+ }
+
/**
- * Returns the filtered include patterns.
+ * Returns the filtered include patterns as an array of strings
*/
public String[] getIncludePatterns(Project p) {
if (isReference()) {
@@ -345,7 +469,7 @@
}
/**
- * Returns the filtered include patterns.
+ * Returns the filtered exclude patterns.
*/
public String[] getExcludePatterns(Project p) {
if (isReference()) {
@@ -385,6 +509,31 @@
}
/**
+ * Convert a vector of NameEntry elements into an array of ExtendedPatterns
+ */
+ private ExtendedPattern[] makeExtendedPatternArray(Vector list,
+ Project p) {
+ if (list.size() == 0) return null;
+
+ Vector tmpEPs = new Vector();
+ for (Enumeration e = list.elements() ; e.hasMoreElements() ;) {
+ NameEntry ne = (NameEntry)e.nextElement();
+ String pattern = ne.evalName(p);
+ if (pattern != null && pattern.length() > 0) {
+ ExtendedPattern ep = new ExtendedPattern();
+ ep.setPattern(pattern);
+ ep.setContainsList(ne.getContainsList());
+ ep.setNotContainsList(ne.getNotContainsList());
+ tmpEPs.addElement(ep);
+ }
+ }
+
+ ExtendedPattern result[] = new ExtendedPattern[tmpEPs.size()];
+ tmpEPs.copyInto(result);
+ return result;
+ }
+
+ /**
* Convert a vector of NameEntry elements into an array of Strings.
*/
private String[] makeArray(Vector list, Project p) {
**************************************************************************
Index: FileSet.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/types/FileSet.java,v
retrieving revision 1.18
diff -u -w -r1.18 FileSet.java
--- FileSet.java 2001/09/30 13:21:54 1.18
+++ FileSet.java 2001/10/16 03:07:20
@@ -291,14 +291,14 @@
for (int i=0; i<additionalPatterns.size(); i++) {
Object o = additionalPatterns.elementAt(i);
- defaultPatterns.append((PatternSet) o, p);
+ defaultPatterns.appendExtended((PatternSet) o, p);
}
p.log( "FileSet: Setup file scanner in dir " + dir +
" with " + defaultPatterns, p.MSG_DEBUG );
- ds.setIncludes(defaultPatterns.getIncludePatterns(p));
- ds.setExcludes(defaultPatterns.getExcludePatterns(p));
+ ds.setIncludes(defaultPatterns.getExtendedIncludePatterns(p));
+ ds.setExcludes(defaultPatterns.getExtendedExcludePatterns(p));
if (useDefaultExcludes) ds.addDefaultExcludes();
ds.setCaseSensitive(isCaseSensitive);
}
**************************************************************************
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.tools.ant.types;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.BuildException;
import java.io.*;
import java.util.Enumeration;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.Vector;
/**
* Named collection of include/exclude tags.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Magesh Umasankar</a>
*/
public class ExtendedPattern {
private String pattern = null;
private Vector containsList = null;
private Vector notContainsList = null;
/**
* Set the pattern
* @param pattern the pattern to match
*/
public void setPattern(String pattern) {
this.pattern = pattern;
}
/**
* Set the list of Contains entries
* @param containsList the vector list of 'ContainsEntry's
*/
public void setContainsList(Vector containsList) {
this.containsList = containsList;
}
/**
* Set the list of NotContains entries
* @param containsList the vector list of 'ContainsEntry's
*/
public void setNotContainsList(Vector notContainsList) {
this.notContainsList = notContainsList;
}
/**
* Get the pattern
*/
public String getPattern() {
return pattern;
}
/**
* Get the list of Contains entries
*/
public Vector getContainsList() {
return containsList;
}
/**
* Get the list of NotContains entries
*/
public Vector getNotContainsList() {
return notContainsList;
}
}