Class ScriptSchedulable
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
-
- org.ametys.plugins.core.impl.schedule.ScriptSchedulable
-
- All Implemented Interfaces:
Schedulable
,LogEnabled
,PluginAware
,Component
,Configurable
,Contextualizable
,Serviceable
public class ScriptSchedulable extends AbstractStaticSchedulable
ASchedulable
job for executing scripts.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.plugins.core.impl.schedule.AbstractStaticSchedulable
AbstractStaticSchedulable.SchedulableParameterParser
-
-
Field Summary
Fields Modifier and Type Field Description private static String
__JOBDATAMAP_RECIPIENT_KEY
private static String
__JOBDATAMAP_SCRIPT_KEY
private static String
__JOBDATAMAP_WORKSPACE_KEY
protected AsyncScriptHandler
_asyncScriptHandler
The async script handlerprotected ScriptHandler
_scriptHandler
The script handlerstatic String
RECIPIENT_KEY
The key for the recipient of the report mailstatic String
SCRIPT_KEY
The key for the script (as string) to executestatic String
WORKSPACE_KEY
The key for the workspace-
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 ScriptSchedulable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Map<String,Object>
_executeScript(String script, String workspace)
private void
_sendMail(Map<String,Object> scriptResults, String recipient, UserIdentity userIdentity)
void
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 Detail
-
SCRIPT_KEY
public static final String SCRIPT_KEY
The key for the script (as string) to execute- See Also:
- Constant Field Values
-
RECIPIENT_KEY
public static final String RECIPIENT_KEY
The key for the recipient of the report mail- See Also:
- Constant Field Values
-
WORKSPACE_KEY
public static final String WORKSPACE_KEY
The key for the workspace- See Also:
- Constant Field Values
-
__JOBDATAMAP_SCRIPT_KEY
private static final String __JOBDATAMAP_SCRIPT_KEY
- See Also:
- Constant Field Values
-
__JOBDATAMAP_RECIPIENT_KEY
private static final String __JOBDATAMAP_RECIPIENT_KEY
- See Also:
- Constant Field Values
-
__JOBDATAMAP_WORKSPACE_KEY
private static final String __JOBDATAMAP_WORKSPACE_KEY
- See Also:
- Constant Field Values
-
_scriptHandler
protected ScriptHandler _scriptHandler
The script handler
-
_asyncScriptHandler
protected AsyncScriptHandler _asyncScriptHandler
The async script handler
-
-
Constructor Detail
-
ScriptSchedulable
public ScriptSchedulable()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractStaticSchedulable
- Throws:
ServiceException
-
execute
public 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
- Specified by:
execute
in classAbstractStaticSchedulable
- Parameters:
context
- the context- Throws:
Exception
- if an error occured
-
_executeScript
private Map<String,Object> _executeScript(String script, String workspace) throws ScriptException
- Throws:
ScriptException
-
_sendMail
private void _sendMail(Map<String,Object> scriptResults, String recipient, UserIdentity userIdentity) throws javax.mail.MessagingException, IOException
- Throws:
javax.mail.MessagingException
IOException
-
-