use of org.quartz.JobDataMap in project searchcode-server by boyter.
the class IndexGitHistoryJob method execute.
public void execute(JobExecutionContext context) throws JobExecutionException {
if (!Singleton.getSharedService().getBackgroundJobsEnabled()) {
return;
}
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
JobDataMap data = context.getJobDetail().getJobDataMap();
String repoLocations = data.get("REPOLOCATIONS").toString();
// Get all the current change sets for the project
// loop through each and get the changes and index
}
use of org.quartz.JobDataMap in project engine by craftercms.
the class ScriptJob method execute.
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
String scriptUrl = dataMap.getString(SCRIPT_URL_DATA_KEY);
SiteContext siteContext = (SiteContext) dataMap.get(SITE_CONTEXT_DATA_KEY);
ServletContext servletContext = (ServletContext) dataMap.get(SERVLET_CONTEXT_DATA_KEY);
ScriptFactory scriptFactory = siteContext.getScriptFactory();
if (scriptFactory == null) {
throw new JobExecutionException("No script factory associate to site context '" + siteContext.getSiteName() + "'");
}
SiteContext.setCurrent(siteContext);
try {
Map<String, Object> variables = new HashMap<>();
GroovyScriptUtils.addJobScriptVariables(variables, servletContext);
scriptFactory.getScript(scriptUrl).execute(variables);
} catch (Exception e) {
throw new JobExecutionException("Error executing script job at " + scriptUrl, e);
} finally {
SiteContext.clear();
}
}
use of org.quartz.JobDataMap in project engine by craftercms.
the class SchedulingUtils method createScriptJob.
public static JobDetail createScriptJob(SiteContext siteContext, String jobName, String scriptUrl, ServletContext servletContext) {
JobDataMap dataMap = new JobDataMap();
dataMap.put(SITE_CONTEXT_DATA_KEY, siteContext);
dataMap.put(SCRIPT_URL_DATA_KEY, scriptUrl);
dataMap.put(SERVLET_CONTEXT_DATA_KEY, servletContext);
JobDetail job = newJob(ScriptJob.class).withIdentity(jobName).setJobData(dataMap).build();
return job;
}
use of org.quartz.JobDataMap in project ddf by codice.
the class CommandJob method checkInput.
private String checkInput(JobExecutionContext context) throws CommandException {
String command = null;
if (context == null) {
LOGGER.debug("No JobExecutionContext found. Could not fire {}", CommandJob.class.getSimpleName());
throw new CommandException();
}
JobDataMap mergedJobDataMap = context.getMergedJobDataMap();
if (mergedJobDataMap == null) {
LOGGER.debug("No input found. Could not fire {}", CommandJob.class.getSimpleName());
throw new CommandException();
}
if (mergedJobDataMap.getString(COMMAND_KEY) != null) {
command = mergedJobDataMap.getString(COMMAND_KEY);
}
return command;
}
use of org.quartz.JobDataMap in project jmxtrans by jmxtrans.
the class ServerJob method execute.
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap map = context.getMergedJobDataMap();
Server server = (Server) map.get(Server.class.getName());
log.debug("+++++ Started server job: {}", server);
try {
jmxUtils.processServer(server);
} catch (Exception e) {
throw new JobExecutionException(e);
}
log.debug("+++++ Finished server job: {}", server);
}
Aggregations