org.kuali.kfs.sys.batch.service.impl
Class FilePurgeServiceImpl

java.lang.Object
  extended by org.kuali.kfs.sys.batch.service.impl.FilePurgeServiceImpl
All Implemented Interfaces:
FilePurgeService

public class FilePurgeServiceImpl
extends Object
implements FilePurgeService

Default implementation of the FilePurgeService


Field Summary
protected static String DAYS_BEFORE_PURGE_PARAMETER_PREFIX
           
protected static String DAYS_BEFORE_PURGE_PARAMETER_SUFFIX
           
protected  org.apache.log4j.Logger LOG
           
 
Constructor Summary
FilePurgeServiceImpl()
           
 
Method Summary
protected  org.apache.commons.io.filefilter.IOFileFilter buildAnyDirectoryButCustomAgeDirectoryFileFilter(List<FilePurgeCustomAge> customAges)
          Builds a file filter which will skip the directories taken by the CustomAges
protected  org.apache.commons.io.filefilter.IOFileFilter buildDefaultAgeFileFilter()
          Builds an age file filter for the default removal run
protected  FilePurgeDirectoryWalker getCustomAgesDirectoryWalker(List<FilePurgeCustomAge> customAges)
          Gets a directory walker which will
 int getDaysBeforePurgeForCustomAge(FilePurgeCustomAge customAge)
          Returns the age in days that files matching this custom age should leave matching files before purging
protected  String getDaysBeforePurgeSuffix()
           
protected  FilePurgeDirectoryWalker getDefaultDirectoryWalker(List<FilePurgeCustomAge> customAges)
          Gets the directory walker for the default directories
 org.kuali.rice.kns.service.ParameterService getParameterService()
          Gets the parameterService attribute.
 int getStandardDaysBeforePurge()
          Looks up the parameter for the standard number of days before a file should be purged
protected  String getStandardDaysBeforePurgeParameterName()
           
protected  void purgeCustomAgeFiles(String directory, List<FilePurgeCustomAge> customAges)
          Purges any files in the given directory associated with custom ages
protected  void purgeDefaultFiles(String directory, List<FilePurgeCustomAge> customAges)
          Purges any files in the given directory not associated with custom ages
 void purgeFiles(String directory, List<FilePurgeCustomAge> customAges)
          Uses a FilePurgeDirectoryWalker to get a List of Files to purge, then purges each
protected  int retrieveDaysBeforePurgeParameterValue(String parameterName)
          Retrieves the parameter value of the KFS-SYS / FilePurgeStep / parameterName parameter and converts it to an integer number of days
 void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
          Sets the parameterService attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected org.apache.log4j.Logger LOG

DAYS_BEFORE_PURGE_PARAMETER_SUFFIX

protected static final String DAYS_BEFORE_PURGE_PARAMETER_SUFFIX
See Also:
Constant Field Values

DAYS_BEFORE_PURGE_PARAMETER_PREFIX

protected static final String DAYS_BEFORE_PURGE_PARAMETER_PREFIX
See Also:
Constant Field Values
Constructor Detail

FilePurgeServiceImpl

public FilePurgeServiceImpl()
Method Detail

purgeFiles

public void purgeFiles(String directory,
                       List<FilePurgeCustomAge> customAges)
Uses a FilePurgeDirectoryWalker to get a List of Files to purge, then purges each

Specified by:
purgeFiles in interface FilePurgeService
Parameters:
directory - the directory to purge
customAges - the List of customized ages for files which do not follow the standard
See Also:
org.kuali.kfs.gl.batch.service.FilePurgeService#purgeFiles(java.lang.String, java.util.List)

purgeCustomAgeFiles

protected void purgeCustomAgeFiles(String directory,
                                   List<FilePurgeCustomAge> customAges)
Purges any files in the given directory associated with custom ages

Parameters:
directory - the directory to purge files from
customAges - custom ages to purge files for

purgeDefaultFiles

protected void purgeDefaultFiles(String directory,
                                 List<FilePurgeCustomAge> customAges)
Purges any files in the given directory not associated with custom ages

Parameters:
directory - the directory to purge files from
customAges - the custom ages with directories to avoid

getCustomAgesDirectoryWalker

protected FilePurgeDirectoryWalker getCustomAgesDirectoryWalker(List<FilePurgeCustomAge> customAges)
Gets a directory walker which will

Parameters:
customAges - the custom ages to purge files for
Returns:
a new FilePurgeDirectoryWalker which will walk directories for us

getDefaultDirectoryWalker

protected FilePurgeDirectoryWalker getDefaultDirectoryWalker(List<FilePurgeCustomAge> customAges)
Gets the directory walker for the default directories

Parameters:
customAges - the custom ages, because custom age directories will not be purged
Returns:
a new FilePurgeDirectoryWalker

buildAnyDirectoryButCustomAgeDirectoryFileFilter

protected org.apache.commons.io.filefilter.IOFileFilter buildAnyDirectoryButCustomAgeDirectoryFileFilter(List<FilePurgeCustomAge> customAges)
Builds a file filter which will skip the directories taken by the CustomAges

Parameters:
customAges - the customAges to avoid
Returns:
a file filter

getDaysBeforePurgeForCustomAge

public int getDaysBeforePurgeForCustomAge(FilePurgeCustomAge customAge)
Description copied from interface: FilePurgeService
Returns the age in days that files matching this custom age should leave matching files before purging

Specified by:
getDaysBeforePurgeForCustomAge in interface FilePurgeService
Parameters:
customAge - a custom age to check
Returns:
the number of days needed to elapse before purging
See Also:
org.kuali.kfs.gl.batch.service.FilePurgeService#getAgeInDaysForCustomAge(org.kuali.kfs.sys.batch.FilePurgeCustomAge)

getDaysBeforePurgeSuffix

protected String getDaysBeforePurgeSuffix()
Returns:
the standard suffix of parameter names from a custom age

getStandardDaysBeforePurge

public int getStandardDaysBeforePurge()
Description copied from interface: FilePurgeService
Looks up the parameter for the standard number of days before a file should be purged

Specified by:
getStandardDaysBeforePurge in interface FilePurgeService
Returns:
the standard number of days before a file should be purged
See Also:
org.kuali.kfs.gl.batch.service.FilePurgeService#getStandardDaysBeforePurge()

getStandardDaysBeforePurgeParameterName

protected String getStandardDaysBeforePurgeParameterName()
Returns:
the parameter name to find the default days before purging files

retrieveDaysBeforePurgeParameterValue

protected int retrieveDaysBeforePurgeParameterValue(String parameterName)
Retrieves the parameter value of the KFS-SYS / FilePurgeStep / parameterName parameter and converts it to an integer number of days

Parameters:
parameterName - the name of the parameter to retrieve the value of
Returns:
the integer number of days

buildDefaultAgeFileFilter

protected org.apache.commons.io.filefilter.IOFileFilter buildDefaultAgeFileFilter()
Builds an age file filter for the default removal run

Returns:
a properly constructed IOFileFilter

getParameterService

public org.kuali.rice.kns.service.ParameterService getParameterService()
Gets the parameterService attribute.

Returns:
Returns the parameterService.

setParameterService

public void setParameterService(org.kuali.rice.kns.service.ParameterService parameterService)
Sets the parameterService attribute value.

Parameters:
parameterService - The parameterService to set.


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.