Esempio n. 1
0
 /**
  * _more_
  *
  * @param object _more_
  * @return _more_
  */
 public boolean equals(Object object) {
   if (object == this) {
     return true;
   }
   if (!(object instanceof PollingInfo)) {
     return false;
   }
   PollingInfo that = (PollingInfo) object;
   return (this.interval == that.interval)
       && (this.fileCount == that.fileCount)
       && (this.forFiles == that.forFiles)
       && (this.isActive == that.isActive)
       && (this.isHiddenOk == that.isHiddenOk)
       && Misc.equals(this.filePattern, that.filePattern)
       && Misc.equals(this.filePaths, that.filePaths);
 }
Esempio n. 2
0
 /**
  * _more_
  *
  * @return _more_
  */
 public List getFiles() {
   List files = new ArrayList();
   String filePath = getFile();
   File file = new File(filePath);
   if (!file.isDirectory() || !doILookForNewFiles()) {
     if (file.exists()) {
       files.add(file.toString());
     }
     return files;
   }
   String pattern = filePattern;
   if (pattern == null) {
     pattern = ".*";
   }
   File[] list =
       file.listFiles((java.io.FileFilter) new PatternFileFilter(pattern, false, isHiddenOk));
   if (list == null) {
     return files;
   }
   list = IOUtil.getNormalFiles(list);
   if (list.length == 0) {
     return files;
   }
   if (list.length == 1) {
     files.add(list[0].toString());
     return files;
   }
   list = IOUtil.sortFilesOnAge(list, true);
   if (mode == MODE_COUNT) {
     for (int i = 0; (i < list.length) && (files.size() < fileCount); i++) {
       files.add(0, list[i].toString());
     }
   } else {
     long endDate;
     if (mode == MODE_ABSDATERANGE) {
       endDate = Misc.getCurrentTime();
     } else {
       endDate = list[0].lastModified();
     }
     long startDate = endDate - dateRange;
     for (int i = 0; i < list.length; i++) {
       if (list[i].lastModified() < startDate) {
         break;
       }
       files.add(0, list[i].toString());
     }
   }
   return files;
 }
Esempio n. 3
0
 /**
  * Set the filePath property.
  *
  * @param newValue The new vaue for the filePath property.
  * @deprecated Use setFilePaths
  */
 public void setFilePath(String newValue) {
   filePaths = Misc.newList(newValue);
 }