View Javadoc
1   /*
2    * Copyright 2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.sys.batch;
17  
18  import org.apache.commons.io.filefilter.AndFileFilter;
19  import org.apache.commons.io.filefilter.IOFileFilter;
20  
21  /**
22   * A customized age for a file prefix.
23   */
24  public class FilePurgeCustomAge {
25  
26      private String directory;
27      private String parameterPrefix;
28      
29      /**
30       * Gets the directory attribute. 
31       * @return Returns the directory.
32       */
33      public String getDirectory() {
34          return directory;
35      }
36      /**
37       * Sets the directory attribute value.
38       * @param directory The directory to set.
39       */
40      public void setDirectory(String directory) {
41          this.directory = directory;
42      }
43      /**
44       * Gets the parameterPrefix attribute. 
45       * @return Returns the parameterPrefix.
46       */
47      public String getParameterPrefix() {
48          return parameterPrefix;
49      }
50      /**
51       * Sets the parameterPrefix attribute value.
52       * @param parameterPrefix The parameterPrefix to set.
53       */
54      public void setParameterPrefix(String parameterPrefix) {
55          this.parameterPrefix = parameterPrefix;
56      }
57      
58      /**
59       * @return an IOFileFilter which represents the files that should be culled by this FilePurgeCustomAge
60       */
61      public IOFileFilter getFileFilter() {
62          AndFileFilter andFileFilter = new AndFileFilter();
63          MaxAgePurgeFileFilter maxAgeFilter = new MaxAgePurgeFileFilter(this);
64          DirectoryNameFileFilter directoryNameFilter = new DirectoryNameFileFilter(this);
65          andFileFilter.addFileFilter(maxAgeFilter);
66          andFileFilter.addFileFilter(directoryNameFilter);
67          return andFileFilter;
68      }
69      
70  }