41 package com.sun.jmx.examples.scandir.config;
44 import java.io.FileFilter;
45 import java.util.Arrays;
46 import java.util.Date;
47 import java.util.logging.Logger;
48 import javax.xml.bind.annotation.XmlElement;
49 import javax.xml.bind.annotation.XmlRootElement;
70 @XmlRootElement(
name=
"FileFilter",
71 namespace=XmlConfigUtils.NAMESPACE)
130 public String getDirectoryPattern() {
131 return this.directoryPattern;
144 this.directoryPattern = directoryPattern;
161 public String getFilePattern() {
162 return this.filePattern;
174 this.filePattern = filePattern;
185 public
long getSizeExceedsMaxBytes() {
186 return this.sizeExceedsMaxBytes;
197 this.sizeExceedsMaxBytes = sizeLimitInBytes;
209 public Date getLastModifiedAfter() {
210 return (lastModifiedAfter==
null)?
null:(Date)lastModifiedAfter.clone();
221 this.lastModifiedAfter =
222 (lastModifiedAfter==
null)?
null:(Date)lastModifiedAfter.clone();
234 public Date getLastModifiedBefore() {
235 return (lastModifiedBefore==
null)?
null:(Date)lastModifiedBefore.clone();
246 this.lastModifiedBefore =
247 (lastModifiedBefore==
null)?
null:(Date)lastModifiedBefore.clone();
265 if (f.isDirectory()) {
266 if (directoryPattern !=
null
267 && !f.getName().matches(directoryPattern))
277 if (filePattern !=
null
278 && !f.getName().matches(filePattern))
282 if (sizeExceedsMaxBytes > 0 && f.length() <= sizeExceedsMaxBytes)
286 if (lastModifiedAfter !=
null &&
287 lastModifiedAfter.after(
new Date(f.lastModified())))
291 if (lastModifiedBefore !=
null &&
292 lastModifiedBefore.before(
new Date(f.lastModified())))
301 final Object[] thisconfig = {
302 directoryPattern, filePattern, lastModifiedAfter,
303 lastModifiedBefore, sizeExceedsMaxBytes
310 if (o ==
this)
return true;
311 if (!(o instanceof
FileMatch))
return false;
313 final Object[] thisconfig = toArray();
314 final Object[] otherconfig = other.
toArray();
315 return Arrays.deepEquals(thisconfig,otherconfig);
320 return Arrays.deepHashCode(toArray());