Java Code Examples for org.quartz.JobDetail#getDescription()
The following examples show how to use
org.quartz.JobDetail#getDescription() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobDetailSupport.java From lams with GNU General Public License v2.0 | 6 votes |
/** * @param jobDetail * @return CompositeData */ public static CompositeData toCompositeData(JobDetail jobDetail) { try { return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES, new Object[] { jobDetail.getKey().getName(), jobDetail.getKey().getGroup(), jobDetail.getDescription(), jobDetail.getJobClass().getName(), JobDataMapSupport.toTabularData(jobDetail .getJobDataMap()), jobDetail.isDurable(), jobDetail.requestsRecovery(), }); } catch (OpenDataException e) { throw new RuntimeException(e); } }
Example 2
Source File: QuarzSchedulerDAOImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
@Override public void insertJob(Job spagobiJob) { logger.debug("IN"); try { Assert.assertNotNull(spagobiJob, "Input parameter [spagobiJob] cannot be null"); JobDetail quartzJob = QuartzNativeObjectsConverter.convertJobToNativeObject(spagobiJob); if (quartzJob.getDescription() == null) quartzJob.setDescription(""); String jobGroupName = quartzJob.getGroup() != null ? quartzJob.getGroup() : Scheduler.DEFAULT_GROUP; quartzJob.setGroup(jobGroupName); adjustTenant(quartzJob); scheduler.addJob(quartzJob, true); } catch (Throwable t) { throw new SpagoBIDAOException("An unexpected error occured while inserting job [" + spagobiJob + "]", t); } finally { logger.debug("OUT"); } }
Example 3
Source File: SchedulerServiceSupplier.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * Builds the job list xml string. * * @param toReturn the to return * * @return the string * * @throws SourceBeanException the source bean exception */ public String buildJobListXmlString(List toReturn) throws SourceBeanException { StringBuffer buffer = new StringBuffer("<ROWS>"); Iterator it = toReturn.iterator(); while (it.hasNext()) { JobDetail job = (JobDetail) it.next(); String jobName = job.getName(); String jobGroupName = job.getGroup(); String jobDescription = job.getDescription(); String jobClassName = job.getJobClass().getName(); String jobDurability = job.isDurable() ? "true" : "false"; String jobRequestRecovery = job.requestsRecovery() ? "true" : "false"; String jobVolatility = job.isVolatile() ? "true" : "false"; buffer.append("<ROW "); buffer.append(" jobName=\"" + (jobName != null ? jobName : "") + "\""); buffer.append(" jobGroupName=\"" + (jobGroupName != null ? jobGroupName : "") + "\""); buffer.append(" jobDescription=\"" + (jobDescription != null ? jobDescription : "") + "\""); buffer.append(" jobClass=\"" + (jobClassName != null ? jobClassName : "") + "\""); buffer.append(" jobDurability=\"" + jobDurability + "\""); buffer.append(" jobRequestRecovery=\"" + jobRequestRecovery + "\""); buffer.append(" jobVolatility=\"" + jobVolatility + "\""); buffer.append(" />"); } buffer.append("</ROWS>"); return buffer.toString(); }
Example 4
Source File: JobDetailSupport.java From AsuraFramework with Apache License 2.0 | 6 votes |
/** * @param jobDetail * @return CompositeData */ public static CompositeData toCompositeData(JobDetail jobDetail) { try { return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES, new Object[] { jobDetail.getName(), jobDetail.getGroup(), jobDetail.getDescription(), jobDetail.getJobClass().getName(), JobDataMapSupport.toTabularData(jobDetail .getJobDataMap()), jobDetail.isVolatile(), jobDetail.isDurable(), jobDetail.requestsRecovery(), }); } catch (OpenDataException e) { throw new RuntimeException(e); } }
Example 5
Source File: SchedulerAdapter.java From iaf with Apache License 2.0 | 6 votes |
public XmlBuilder jobDetailToXmlBuilder(JobDetail jobDetail) { XmlBuilder xbRoot = new XmlBuilder("jobDetail"); String name = jobDetail.getKey().getName(); xbRoot.addAttribute("name", name); xbRoot.addAttribute("fullName", jobDetail.getKey().getGroup() + "." + name); String description="-"; if (StringUtils.isNotEmpty(jobDetail.getDescription())) description=jobDetail.getDescription(); xbRoot.addAttribute("description", description); xbRoot.addAttribute("isStateful", (jobDetail.isConcurrentExectionDisallowed() && jobDetail.isPersistJobDataAfterExecution())); xbRoot.addAttribute("isDurable", jobDetail.isDurable()); xbRoot.addAttribute("jobClass", jobDetail.getJobClass().getName()); return xbRoot; }
Example 6
Source File: ScheduleLogRequest.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public ScheduleLogRequest(JobExecutionContext jobExecutionContext, JobExecutionException jobExecutionException) { JobDetail jobDetail = jobExecutionContext.getJobDetail(); this.className = jobDetail.getKey().getName(); this.application = jobDetail.getKey().getGroup(); this.node = jobDetail.getDescription(); this.type = jobExecutionContext.getTrigger().getDescription(); this.elapsed = jobExecutionContext.getJobRunTime(); this.fireTime = jobExecutionContext.getFireTime(); if (null != jobExecutionException) { this.stackTrace = ExceptionUtils.getStackTrace(jobExecutionException); this.success = false; } else { this.success = true; } }
Example 7
Source File: HelloJob.java From open-platform-demo with GNU Affero General Public License v3.0 | 5 votes |
@Override public void execute(JobExecutionContext context) throws JobExecutionException { JobDetail detail = context.getJobDetail(); JobDataMap data = context.getJobDetail().getJobDataMap(); String name = detail.getKey().getName(); String desc = detail.getDescription(); System.err.println("Job fired: " + name + " (" + desc + ")"); if (data != null && data.size() > 0) { for (String key : data.keySet()) { System.err.println(" " + key + " = " + data.getString(key)); } } }
Example 8
Source File: SchedulerServiceSupplier.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
/** * Serialize job detail. * * @param job the job * * @return the string * * @throws SourceBeanException the source bean exception */ public String serializeJobDetail(JobDetail job) throws SourceBeanException { StringBuffer buffer = new StringBuffer("<JOB_DETAIL "); String jobName = job.getName(); String jobGroupName = job.getGroup(); String jobDescription = job.getDescription(); String jobClassName = job.getJobClass().getName(); String jobDurability = job.isDurable() ? "true" : "false"; String jobRequestRecovery = job.requestsRecovery() ? "true" : "false"; String jobVolatility = job.isVolatile() ? "true" : "false"; JobDataMap jobDataMap = job.getJobDataMap(); buffer.append(" jobName=\"" + (jobName != null ? jobName : "") + "\""); buffer.append(" jobGroupName=\"" + (jobGroupName != null ? jobGroupName : "") + "\""); buffer.append(" jobDescription=\"" + (jobDescription != null ? jobDescription : "") + "\""); buffer.append(" jobClass=\"" + (jobClassName != null ? jobClassName : "") + "\""); buffer.append(" jobDurability=\"" + jobDurability + "\""); buffer.append(" jobRequestRecovery=\"" + jobRequestRecovery + "\""); buffer.append(" jobVolatility=\"" + jobVolatility + "\""); buffer.append(" >"); buffer.append("<JOB_PARAMETERS>"); if (jobDataMap != null && !jobDataMap.isEmpty()) { String[] keys = jobDataMap.getKeys(); if (keys != null && keys.length > 0) { for (int i = 0; i < keys.length; i++) { buffer.append("<JOB_PARAMETER "); String key = keys[i]; String value = jobDataMap.getString(key); if (value == null) { SpagoBITracer.warning("SCHEDULER", this.getClass().getName(), "loadJobDetailIntoResponse", "Job parameter '" + key + "' has no String value!!"); } buffer.append(" name=\"" + key + "\""); buffer.append(" value=\"" + value + "\""); buffer.append(" />"); } } } buffer.append("</JOB_PARAMETERS>"); buffer.append("</JOB_DETAIL>"); return buffer.toString(); }
Example 9
Source File: QuartzAdapter.java From javamelody with Apache License 2.0 | 4 votes |
String getJobDescription(JobDetail jobDetail) { return jobDetail.getDescription(); }
Example 10
Source File: Quartz2Adapter.java From javamelody with Apache License 2.0 | 4 votes |
@Override String getJobDescription(JobDetail jobDetail) { return jobDetail.getDescription(); }
Example 11
Source File: NavigableEventLogListener.java From sakai with Educational Community License v2.0 | 4 votes |
private void info (EVENTTYPE eventType, Trigger trig, JobExecutionContext context, JobExecutionException exception, CompletedExecutionInstruction instructionCode) { JobDetail detail = (context != null)?context.getJobDetail():null; final JobDataMap dataMap = (context != null)?context.getMergedJobDataMap():null; final String jobName = (detail != null)?detail.getKey().getName():null, jobDesc = (detail != null)?detail.getDescription():null; final Class jobClass = (detail != null)?detail.getJobClass():null; final Trigger trigger = (trig != null)?trig:((context != null)?context.getTrigger():null); final String trigName = (trigger != null)?trigger.getKey().getName():null, trigDesc = (trigger != null)?trigger.getDescription():null; final Date trigStart = (trigger != null)?trigger.getStartTime():null, trigEnd = (trigger != null)?trigger.getEndTime():null; StringBuilder sb = new StringBuilder(); switch (eventType) { case JOB_EXECUTING: { sb.append("Job Executing: ["); sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()); sb.append("]"); break; } case JOB_VETOED: { sb.append("Job Vetoed: ["); sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()); break; } case JOB_EXECUTED: { sb.append("Job Executed: ["); sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()); if (exception != null) { sb.append (", exception: ").append(exception.getMessage()); if (exception.getCause() != null) { sb.append(", exception cause: ").append(exception.getCause().getClass().getName()); } } sb.append("]"); break; } case TRIGGER_FIRED: { sb.append("Trigger Fired: ["); sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"") .append(", start: ").append((trigStart != null)?trigStart.toString():null) .append(", end: ").append((trigEnd != null)?trigEnd.toString():null); sb.append(", job: ").append(jobName).append(", job description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()); sb.append("]"); break; } case TRIGGER_MISFIRED: { sb.append("Trigger Misfired: ["); sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"") .append(", start: ").append((trigStart!=null)?trigStart.toString():null) .append(", end: ").append((trigEnd!=null)?trigEnd.toString():null); sb.append("]"); break; } case TRIGGER_COMPLETED: { sb.append("Trigger Completed: ["); sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"") .append(", start: ").append((trigStart!=null)?trigStart.toString():null) .append(", end: ").append((trigEnd!=null)?trigEnd.toString():null); sb.append(", job: ").append(jobName).append(", job description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()) .append(", execution result: ").append(instructionCode); sb.append("]"); break; } } if (log.isDebugEnabled()) { log.debug(sb.toString()); } }
Example 12
Source File: NavigableEventLogListener.java From sakai with Educational Community License v2.0 | 4 votes |
private void info (EVENTTYPE eventType, Trigger trig, JobExecutionContext context, JobExecutionException exception, CompletedExecutionInstruction instructionCode) { JobDetail detail = (context != null)?context.getJobDetail():null; final JobDataMap dataMap = (context != null)?context.getMergedJobDataMap():null; final String jobName = (detail != null)?detail.getKey().getName():null, jobDesc = (detail != null)?detail.getDescription():null; final Class jobClass = (detail != null)?detail.getJobClass():null; final Trigger trigger = (trig != null)?trig:((context != null)?context.getTrigger():null); final String trigName = (trigger != null)?trigger.getKey().getName():null, trigDesc = (trigger != null)?trigger.getDescription():null; final Date trigStart = (trigger != null)?trigger.getStartTime():null, trigEnd = (trigger != null)?trigger.getEndTime():null; StringBuilder sb = new StringBuilder(); switch (eventType) { case JOB_EXECUTING: { sb.append("Job Executing: ["); sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()); sb.append("]"); break; } case JOB_VETOED: { sb.append("Job Vetoed: ["); sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()); break; } case JOB_EXECUTED: { sb.append("Job Executed: ["); sb.append("name: ").append(jobName).append(", description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()); if (exception != null) { sb.append (", exception: ").append(exception.getMessage()); if (exception.getCause() != null) { sb.append(", exception cause: ").append(exception.getCause().getClass().getName()); } } sb.append("]"); break; } case TRIGGER_FIRED: { sb.append("Trigger Fired: ["); sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"") .append(", start: ").append((trigStart != null)?trigStart.toString():null) .append(", end: ").append((trigEnd != null)?trigEnd.toString():null); sb.append(", job: ").append(jobName).append(", job description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()); sb.append("]"); break; } case TRIGGER_MISFIRED: { sb.append("Trigger Misfired: ["); sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"") .append(", start: ").append((trigStart!=null)?trigStart.toString():null) .append(", end: ").append((trigEnd!=null)?trigEnd.toString():null); sb.append("]"); break; } case TRIGGER_COMPLETED: { sb.append("Trigger Completed: ["); sb.append("trigger: ").append(trigName).append(", trigger description: ").append((trigDesc != null)?trigDesc:"") .append(", start: ").append((trigStart!=null)?trigStart.toString():null) .append(", end: ").append((trigEnd!=null)?trigEnd.toString():null); sb.append(", job: ").append(jobName).append(", job description: ").append((jobDesc != null)?jobDesc:"") .append(", class: ").append(jobClass.getName()) .append(", execution result: ").append(instructionCode); sb.append("]"); break; } } if (log.isDebugEnabled()) { log.debug(sb.toString()); } }
Example 13
Source File: ShowScheduler.java From iaf with Apache License 2.0 | 4 votes |
private Map<String, Object> getJobData(JobKey jobKey, boolean expanded) throws SchedulerException { Map<String, Object> jobData = new HashMap<String, Object>(); Scheduler scheduler = getScheduler(); String jobName = jobKey.getName(); JobDetail job = scheduler.getJobDetail(jobKey); jobData.put("fullName", job.getKey().getGroup() + "." + job.getKey().getName()); jobData.put("name", job.getKey().getName()); jobData.put("group", job.getKey().getGroup()); String description = "-"; if (StringUtils.isNotEmpty(job.getDescription())) description = job.getDescription(); jobData.put("description", description); jobData.put("stateful", job.isPersistJobDataAfterExecution() && job.isConcurrentExectionDisallowed()); jobData.put("durable",job.isDurable()); jobData.put("jobClass", job.getJobClass().getSimpleName()); if(job instanceof IbisJobDetail) { jobData.put("type", ((IbisJobDetail) job).getJobType()); } TriggerState state = scheduler.getTriggerState(TriggerKey.triggerKey(jobName, jobKey.getGroup())); jobData.put("state", state.name()); jobData.put("triggers", getJobTriggers(scheduler.getTriggersOfJob(jobKey))); jobData.put("messages", getJobMessages(job)); JobDataMap jobMap = job.getJobDataMap(); jobData.put("properties", getJobData(jobMap)); if(expanded) { JobDef jobDef = (JobDef) jobMap.get(ConfiguredJob.JOBDEF_KEY); jobData.put("adapter", jobDef.getAdapterName()); jobData.put("receiver", jobDef.getReceiverName()); jobData.put("message", jobDef.getMessage()); Locker locker = jobDef.getLocker(); if(locker != null) { jobData.put("locker", true); jobData.put("lockkey", locker.getObjectId()); } else { jobData.put("locker", false); } } return jobData; }