A simple filter for the URLDeploymentScanner. Three arrays are
maintained for checking: a prefix, suffix, and match array. If the
filename starts with any of the prefixes, ends with any of the
suffixes, or exactly matches any of the matches, then the accepts
method will return false.
NOTE: the arrays *must* be sorted for the string matching to work,
and suffixes use the 'reverseComparator'
| Method from org.jboss.deployment.scanner.DeploymentFilter Detail: |
public boolean accept(File file) {
return accept(file.getName());
}
If the filename matches any string in the prefix, suffix, or matches
array, return false. Perhaps a bit of overkill, but this method
operates in log(n) time, where n is the size of the arrays. |
public boolean accept(URL baseURL,
String memberName) {
return accept(memberName);
}
|
public void addPrefix(String prefix) {
this.prefixes.add(prefix);
Collections.sort(this.prefixes);
}
|
public void addPrefixes(String[] prefixes) {
this.prefixes.add(Arrays.asList(prefixes));
Collections.sort(this.prefixes);
}
|
public void addSuffix(String suffix) {
this.suffixes.add(suffix);
Collections.sort(this.suffixes, reverseComparator);
}
|
public void addSuffixes(String[] suffixes) {
this.suffixes.add(Arrays.asList(suffixes));
Collections.sort(this.suffixes, reverseComparator);
}
|
public void delPrefix(String prefix) {
this.prefixes.remove(prefix);
}
|
public void delPrefixes(String[] prefixes) {
this.prefixes.removeAll(Arrays.asList(prefixes));
Collections.sort(this.prefixes);
}
|
public void delSuffix(String suffix) {
this.suffixes.remove(suffix);
}
|
public void delSuffixes(String[] suffixes) {
this.suffixes.removeAll(Arrays.asList(suffixes));
Collections.sort(this.suffixes, reverseComparator);
}
|
public String[] getMatches() {
String[] tmp = new String[matches.size()];
matches.toArray(tmp);
return tmp;
}
|
public String[] getPrefixes() {
String[] tmp = new String[prefixes.size()];
prefixes.toArray(tmp);
return tmp;
}
|
public String[] getSuffixes() {
String[] tmp = new String[suffixes.size()];
suffixes.toArray(tmp);
return tmp;
}
|
public void setMatches(String[] matches) {
Arrays.sort(matches);
this.matches.clear();
this.matches.addAll(Arrays.asList(matches));
}
|
public void setPrefixes(String[] prefixes) {
Arrays.sort(prefixes);
this.prefixes.clear();
this.prefixes.addAll(Arrays.asList(prefixes));
}
|
public void setSuffixes(String[] suffixes) {
Arrays.sort(suffixes, reverseComparator);
this.suffixes.clear();
this.suffixes.addAll(Arrays.asList(suffixes));
}
|