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
Abstract schedulable to delete files or folders.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Inner class to store configuration for deletion.Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected DirectoryStream.Filter<Path>
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 runvoid
execute
(JobExecutionContext context) The action to perform when a trigger is fired.void
service
(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 Details
-
_fileHelper
File Helper
-
-
Constructor Details
-
AbstractDeleteFilesSchedulable
public AbstractDeleteFilesSchedulable()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in 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
Description copied from interface:Schedulable
The action to perform when a trigger is fired. Do not manually call this method.- Specified by:
execute
in interfaceSchedulable
- Specified by:
execute
in 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
-