001/* 002 * Copyright 2009 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.ole.sys.batch; 017 018import org.apache.commons.io.filefilter.AndFileFilter; 019import org.apache.commons.io.filefilter.IOFileFilter; 020 021/** 022 * A customized age for a file prefix. 023 */ 024public class FilePurgeCustomAge { 025 026 private String directory; 027 private String parameterPrefix; 028 029 /** 030 * Gets the directory attribute. 031 * @return Returns the directory. 032 */ 033 public String getDirectory() { 034 return directory; 035 } 036 /** 037 * Sets the directory attribute value. 038 * @param directory The directory to set. 039 */ 040 public void setDirectory(String directory) { 041 this.directory = directory; 042 } 043 /** 044 * Gets the parameterPrefix attribute. 045 * @return Returns the parameterPrefix. 046 */ 047 public String getParameterPrefix() { 048 return parameterPrefix; 049 } 050 /** 051 * Sets the parameterPrefix attribute value. 052 * @param parameterPrefix The parameterPrefix to set. 053 */ 054 public void setParameterPrefix(String parameterPrefix) { 055 this.parameterPrefix = parameterPrefix; 056 } 057 058 /** 059 * @return an IOFileFilter which represents the files that should be culled by this FilePurgeCustomAge 060 */ 061 public IOFileFilter getFileFilter() { 062 AndFileFilter andFileFilter = new AndFileFilter(); 063 MaxAgePurgeFileFilter maxAgeFilter = new MaxAgePurgeFileFilter(this); 064 DirectoryNameFileFilter directoryNameFilter = new DirectoryNameFileFilter(this); 065 andFileFilter.addFileFilter(maxAgeFilter); 066 andFileFilter.addFileFilter(directoryNameFilter); 067 return andFileFilter; 068 } 069 070}