⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customjob.java

📁 提供ESB 应用mule源代码 提供ESB 应用mule源代码
💻 JAVA
字号:
/* * $Id: CustomJob.java 11967 2008-06-05 20:32:19Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.transport.quartz.jobs;import org.mule.RegistryContext;import org.mule.transport.quartz.QuartzConnector;import org.mule.transport.quartz.i18n.QuartzMessages;import org.quartz.Job;import org.quartz.JobDataMap;import org.quartz.JobExecutionContext;import org.quartz.JobExecutionException;/** * Extracts the Job object to invoke from the context. The Job itself can be * scheduled by dispatching an event over a quartz endpoint. The job can either be * set as a property on the event (this property can be a container reference or the * actual job object) or the payload of the event can be the Job (in which case when * the job is fired it will have a NullPayload) *  * @see org.mule.transport.NullPayload */public class CustomJob implements Job{    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException    {        JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();        Object tempJob = jobDataMap.get(QuartzConnector.PROPERTY_JOB_OBJECT);        if (tempJob == null)        {            tempJob = jobDataMap.get(QuartzConnector.PROPERTY_JOB_REF);            if (tempJob == null)            {                throw new JobExecutionException(QuartzMessages.invalidPayloadType().getMessage());            }            else            {                tempJob = RegistryContext.getRegistry().lookupObject((String) tempJob);                if(tempJob==null)                {                    throw new JobExecutionException("Job not found: " + tempJob);                }                if (!(tempJob instanceof Job))                {                    throw new JobExecutionException(QuartzMessages.invalidJobObject().getMessage());                }            }        }        else if (!(tempJob instanceof Job))        {            throw new JobExecutionException(QuartzMessages.invalidJobObject().toString());        }        ((Job)tempJob).execute(jobExecutionContext);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -