Package org.ametys.cms.schedule
Class AbstractDeleteFilesSchedulable
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
-
- org.ametys.cms.schedule.AbstractDeleteFilesSchedulable
-
- All Implemented Interfaces:
Schedulable,LogEnabled,PluginAware,Component,Configurable,Contextualizable,Serviceable
- Direct Known Subclasses:
DeleteEducationalBookletSchedulable,DeleteExtractionsSchedulable,DeleteReportsSchedulable
public abstract class AbstractDeleteFilesSchedulable extends AbstractStaticSchedulable
Abstract schedulable to delete files or folders.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractDeleteFilesSchedulable.DeleteFilesConfigurationInner class to store configuration for deletion.-
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser
-
-
Field Summary
Fields Modifier and Type Field Description protected FileHelper_fileHelperFile Helper-
Fields inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
_acceptConcurrentExecution, _context, _description, _iconGlyph, _iconLarge, _iconMedium, _iconSmall, _id, _label, _parameters, _pluginName, _private, _schedulableParameterTypeExtensionPoint, _smanager, _userManager
-
-
Constructor Summary
Constructors Constructor Description AbstractDeleteFilesSchedulable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected DirectoryStream.Filter<Path>_createFileFilter(AbstractDeleteFilesSchedulable.DeleteFilesConfiguration configuration)Create the file filter to delete files.protected void_delete(Path path, AbstractDeleteFilesSchedulable.DeleteFilesConfiguration configuration, DirectoryStream.Filter<Path> fileFilter)Delete all files corresponding to the file filter into the file tree.protected abstract AbstractDeleteFilesSchedulable.DeleteFilesConfiguration_getConfiguration(JobExecutionContext context)Get the needed values so the script can runvoidexecute(JobExecutionContext context)The action to perform when a trigger is fired.voidservice(ServiceManager manager)-
Methods inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
acceptConcurrentExecution, configure, contextualize, getDescription, getIconGlyph, getIconLarge, getIconMedium, getIconSmall, getId, getLabel, getParameters, isPrivate, setPluginInfo
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_fileHelper
protected FileHelper _fileHelper
File Helper
-
-
Constructor Detail
-
AbstractDeleteFilesSchedulable
public AbstractDeleteFilesSchedulable()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractStaticSchedulable- Throws:
ServiceException
-
_getConfiguration
protected abstract AbstractDeleteFilesSchedulable.DeleteFilesConfiguration _getConfiguration(JobExecutionContext context)
Get the needed values so the script can run- Parameters:
context- the context- Returns:
- the configuration with needed values for deletion
-
execute
public void execute(JobExecutionContext context) throws Exception
Description copied from interface:SchedulableThe action to perform when a trigger is fired. Do not manually call this method.- Specified by:
executein interfaceSchedulable- Specified by:
executein classAbstractStaticSchedulable- Parameters:
context- the context- Throws:
Exception- if an error occured
-
_delete
protected void _delete(Path path, AbstractDeleteFilesSchedulable.DeleteFilesConfiguration configuration, DirectoryStream.Filter<Path> fileFilter) throws IOException
Delete all files corresponding to the file filter into the file tree.- Parameters:
path- the path to delete (can be a file or a directory)configuration- the configuration for deletionfileFilter- the file filter to apply- Throws:
IOException- if an error occured while exploring or deleting files
-
_createFileFilter
protected DirectoryStream.Filter<Path> _createFileFilter(AbstractDeleteFilesSchedulable.DeleteFilesConfiguration configuration)
Create the file filter to delete files.- Parameters:
configuration- The delete files configuration- Returns:
- a file filter
-
-