Package org.alfresco.util
Class TempFileProvider.TempFileCleanerJob
- java.lang.Object
-
- org.alfresco.util.TempFileProvider.TempFileCleanerJob
-
- All Implemented Interfaces:
org.quartz.Job
- Enclosing class:
- TempFileProvider
@AlfrescoPublicApi public static class TempFileProvider.TempFileCleanerJob extends Object implements org.quartz.Job
Cleans up all Alfresco temporary files that are older than the given number of hours. Subdirectories are emptied as well and all directories below the primary temporary subdirectory are removed.The job data must include a property protectHours, which is the number of hours to protect a temporary file from deletion since its last modification.
- Author:
- Derek Hulley
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_DIRECTORY_NAMEstatic StringKEY_MAX_FILES_TO_DELETEstatic StringKEY_MAX_TIME_TO_RUNstatic StringKEY_PROTECT_HOURS
-
Constructor Summary
Constructors Constructor Description TempFileCleanerJob()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(org.quartz.JobExecutionContext context)Gets a list of all files in thetemp directoryand deletes all those that are older than the given number of hours.static intremoveFiles(long removeBefore)Removes all temporary files created before the given time.
-
-
-
Field Detail
-
KEY_PROTECT_HOURS
public static final String KEY_PROTECT_HOURS
- See Also:
- Constant Field Values
-
KEY_DIRECTORY_NAME
public static final String KEY_DIRECTORY_NAME
- See Also:
- Constant Field Values
-
KEY_MAX_FILES_TO_DELETE
public static final String KEY_MAX_FILES_TO_DELETE
- See Also:
- Constant Field Values
-
KEY_MAX_TIME_TO_RUN
public static final String KEY_MAX_TIME_TO_RUN
- See Also:
- Constant Field Values
-
-
Method Detail
-
execute
public void execute(org.quartz.JobExecutionContext context) throws org.quartz.JobExecutionExceptionGets a list of all files in thetemp directoryand deletes all those that are older than the given number of hours.- Specified by:
executein interfaceorg.quartz.Job- Throws:
org.quartz.JobExecutionException
-
removeFiles
public static int removeFiles(long removeBefore)
Removes all temporary files created before the given time.The delete will cascade down through directories as well.
- Parameters:
removeBefore- only remove files created before this time- Returns:
- Returns the number of files removed
-
-