Class AbstractStaticSchedulable
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
-
- All Implemented Interfaces:
Schedulable
,LogEnabled
,PluginAware
,Component
,Configurable
,Contextualizable
,Serviceable
- Direct Known Subclasses:
AbstractArchiveSchedulable
,AbstractCollectionSchedulable
,AbstractDeleteFilesSchedulable
,AbstractReportSchedulable
,AbstractSendingMailSchedulable
,ApogeeSchedulable
,CleanCacheSchedulable
,CleanJCaptchaSchedulable
,ComputeProgramSkillsSchedulable
,ContentExportSchedulable
,CoursePartPurgeSchedulable
,DeleteClassifiedAdsSchedulable
,ExportSchedulable
,GlobalValidationSchedulable
,InvalidateFOCacheSchedulable
,PublishOrUnpublishPageSchedulable
,ReindexMembersSchedulable
,ReloadSolrAclCacheSchedulable
,ReloadSolrAclCachesForCoresSchedulable
,ScriptSchedulable
,SendMailSchedulable
,SolrExportSchedulable
,SynchronizeAllCollectionsSchedulable
,UnlockSchedulable
public abstract class AbstractStaticSchedulable extends AbstractLogEnabled implements Schedulable, Component, Configurable, PluginAware, Serviceable, Contextualizable
Default static implementation ofSchedulable
For implementing theSchedulable
interface (while beingConfigurable
), extends this class and implements theexecute(org.quartz.JobExecutionContext)
method
For instance:public class SayHelloSchedulable extends AbstractStaticSchedulable { public static final String FIRSTNAME_KEY = "firstName"; private static final String __JOBDATAMAP_FIRSTNAME_KEY = Scheduler.PARAM_VALUES_PREFIX + FIRSTNAME_KEY; public void execute(JobExecutionContext context) throws Exception { JobKey jobKey = context.getJobDetail().getKey(); JobDataMap jobDataMap = context.getJobDetail().getJobDataMap(); String name = jobDataMap.getString(__JOBDATAMAP_FIRSTNAME_KEY); System.out.println("[" + jobKey + "] " + new Date() + " - Hello " + name + "!"); } }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AbstractStaticSchedulable.SchedulableParameterParser
Class for parsing parameters of aSchedulable
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_acceptConcurrentExecution
True if two runnables of this schedulable can be executed concurrentlyprotected Context
_context
The contextprotected I18nizableText
_description
The descriptionprotected String
_iconGlyph
The icon glyphprotected String
_iconLarge
The large iconprotected String
_iconMedium
The medium iconprotected String
_iconSmall
The small iconprotected String
_id
The id of this extensionprotected I18nizableText
_label
The labelprotected Map<String,ElementDefinition>
_parameters
The parametersprotected String
_pluginName
The name of the plugin that has declared this componentprotected boolean
_private
True if the schedulable is privateprotected SchedulableParameterTypeExtensionPoint
_schedulableParameterTypeExtensionPoint
The Schedulable Extension Pointprotected ServiceManager
_smanager
The service managerprotected UserManager
_userManager
The user manager
-
Constructor Summary
Constructors Constructor Description AbstractStaticSchedulable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private void
_configureParameters(Configuration paramConfigs)
boolean
acceptConcurrentExecution()
Returns true if two runnables of this schedulable can be executed concurrentlyvoid
configure(Configuration configuration)
void
contextualize(Context context)
abstract void
execute(JobExecutionContext context)
The action to perform when a trigger is fired.I18nizableText
getDescription()
Return the descriptionString
getIconGlyph()
Returns the glyph iconString
getIconLarge()
Returns the path to the large icon in 48x48 pixelsString
getIconMedium()
Returns the path to the medium icon in 32x32 pixelsString
getIconSmall()
Returns the path to the small icon in 16x16 pixelsString
getId()
Returns the idI18nizableText
getLabel()
Returns the labelMap<String,ElementDefinition>
getParameters()
Get the parameters for job executionboolean
isPrivate()
Returns true if the schedulable is privatevoid
service(ServiceManager manager)
void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_pluginName
protected String _pluginName
The name of the plugin that has declared this component
-
_smanager
protected ServiceManager _smanager
The service manager
-
_label
protected I18nizableText _label
The label
-
_description
protected I18nizableText _description
The description
-
_iconGlyph
protected String _iconGlyph
The icon glyph
-
_iconSmall
protected String _iconSmall
The small icon
-
_iconMedium
protected String _iconMedium
The medium icon
-
_iconLarge
protected String _iconLarge
The large icon
-
_private
protected boolean _private
True if the schedulable is private
-
_acceptConcurrentExecution
protected boolean _acceptConcurrentExecution
True if two runnables of this schedulable can be executed concurrently
-
_parameters
protected Map<String,ElementDefinition> _parameters
The parameters
-
_schedulableParameterTypeExtensionPoint
protected SchedulableParameterTypeExtensionPoint _schedulableParameterTypeExtensionPoint
The Schedulable Extension Point
-
_userManager
protected UserManager _userManager
The user manager
-
-
Constructor Detail
-
AbstractStaticSchedulable
public AbstractStaticSchedulable()
-
-
Method Detail
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
_configureParameters
private void _configureParameters(Configuration paramConfigs) throws ConfigurationException
- Throws:
ConfigurationException
-
execute
public abstract void execute(JobExecutionContext context) throws Exception
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
- Parameters:
context
- the context- Throws:
Exception
- if an error occured
-
getId
public String getId()
Description copied from interface:Schedulable
Returns the id- Specified by:
getId
in interfaceSchedulable
- Returns:
- the id
-
getLabel
public I18nizableText getLabel()
Description copied from interface:Schedulable
Returns the label- Specified by:
getLabel
in interfaceSchedulable
- Returns:
- the i18n label
-
getDescription
public I18nizableText getDescription()
Description copied from interface:Schedulable
Return the description- Specified by:
getDescription
in interfaceSchedulable
- Returns:
- the i18n description
-
getIconGlyph
public String getIconGlyph()
Description copied from interface:Schedulable
Returns the glyph icon- Specified by:
getIconGlyph
in interfaceSchedulable
- Returns:
- the glyph icon
-
getIconSmall
public String getIconSmall()
Description copied from interface:Schedulable
Returns the path to the small icon in 16x16 pixels- Specified by:
getIconSmall
in interfaceSchedulable
- Returns:
- the path to the 16x16 icon
-
getIconMedium
public String getIconMedium()
Description copied from interface:Schedulable
Returns the path to the medium icon in 32x32 pixels- Specified by:
getIconMedium
in interfaceSchedulable
- Returns:
- the path to the 32x32 icon
-
getIconLarge
public String getIconLarge()
Description copied from interface:Schedulable
Returns the path to the large icon in 48x48 pixels- Specified by:
getIconLarge
in interfaceSchedulable
- Returns:
- the path to the 48x48 icon
-
isPrivate
public boolean isPrivate()
Description copied from interface:Schedulable
Returns true if the schedulable is private- Specified by:
isPrivate
in interfaceSchedulable
- Returns:
- true if the schedulable is private
-
acceptConcurrentExecution
public boolean acceptConcurrentExecution()
Description copied from interface:Schedulable
Returns true if two runnables of this schedulable can be executed concurrently- Specified by:
acceptConcurrentExecution
in interfaceSchedulable
- Returns:
- true if two runnables of this schedulable can be executed concurrently
-
getParameters
public Map<String,ElementDefinition> getParameters()
Description copied from interface:Schedulable
Get the parameters for job execution- Specified by:
getParameters
in interfaceSchedulable
- Returns:
- the parameters
-
-