Package org.quartz

Examples of org.quartz.JobDataMap


     * @throws org.quartz.JobExecutionException
     */
    public void execute( JobExecutionContext context )
        throws JobExecutionException
    {
        JobDataMap dataMap = context.getJobDetail().getJobDataMap();
        setJobDataMap( dataMap );

        TaskQueue taskQueue = (TaskQueue) dataMap.get( RepositoryArchivaTaskScheduler.TASK_QUEUE );

        String repositoryId = (String) dataMap.get( RepositoryArchivaTaskScheduler.TASK_REPOSITORY );
        RepositoryTask task = new RepositoryTask();
        task.setRepositoryId( repositoryId );

        try
        {
View Full Code Here


        jobSession.saveJob(timer) ;
        final String name = getTimerName(timer) ;
        final Trigger trigger = new SimpleTrigger(name, JBPM_GROUP, timer.getDueDate()) ;
        final JobDetail jobDetail = new JobDetail(name, JBPM_GROUP, QuartzSchedulerServiceJob.class) ;

        final JobDataMap jobDataMap = new JobDataMap() ;
        jobDataMap.put(TIMER_ID, new Long(timer.getId())) ;
        jobDataMap.put(MAX_REFIRE_COUNT, Integer.valueOf(maxRefireCount)) ;
        jobDetail.setJobDataMap(jobDataMap) ;
       
        try
        {
            scheduler.scheduleJob(jobDetail, trigger) ;
View Full Code Here

            throws JobExecutionException
        {
            final JobDetail jobDetail = context.getJobDetail() ;
            if (jobDetail != null)
            {
                final JobDataMap jobDataMap = jobDetail.getJobDataMap() ;
                if (jobDataMap != null)
                {
                    final Long jobId = (Long) jobDataMap.get(TIMER_ID) ;
                    if (jobId != null)
                    {
                        final JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext() ;
                        Job job = null ;
                        try
                        {
                            job = jbpmContext.getJobSession().loadJob(jobId) ;
                            if (job != null)
                            {
                                jbpmContext.getServices().getMessageService().send(job) ;
                                if (LOGGER.isDebugEnabled())
                                {
                                    LOGGER.debug("Firing job " + jobId) ;
                                }
                                return ;
                            }
                        }
                        catch (final RuntimeException re)
                        {
                            final Integer maxRefireCount = (Integer) jobDataMap.get(MAX_REFIRE_COUNT) ;
                            if ((maxRefireCount != null) && (maxRefireCount > context.getRefireCount()))
                            {
                                final JobExecutionException jobEx = new JobExecutionException(re, true);
                                jobEx.setErrorCode(JobExecutionException.ERR_JOB_EXECUTION_THREW_EXCEPTION);
                                throw jobEx ;
View Full Code Here

        final Trigger trigger, final Properties properties)
    {
        this.name = name ;
        this.jobDetail = new JobDetail(trigger.getName(), JOB_GROUP, ESBScheduledJob.class) ;

        final JobDataMap jobDataMap = new JobDataMap() ;
        jobDataMap.put(SchedulerJobListener.class.getName(), listener) ;
        jobDataMap.put(ClassLoader.class.getName(), Thread.currentThread().getContextClassLoader()) ;
        jobDetail.setJobDataMap(jobDataMap) ;
       
        this.trigger = trigger ;
        this.properties = properties ;
    }
View Full Code Here

public class SamplingJob implements Job {
    private static Log log = LogFactory.getLog(SamplingJob.class);

    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobDataMap jdm = jobExecutionContext.getMergedJobDataMap();

        final MessageStore messageStore = (MessageStore) jdm.get(
                MessageProcessorConsents.MESSAGE_STORE);

        Map<String, Object> parameters = (Map<String, Object>) jdm.get(
                MessageProcessorConsents.PARAMETERS);
        SamplingProcessor processor = (SamplingProcessor)
                jdm.get(ScheduledMessageProcessor.PROCESSOR_INSTANCE);

        final Object concurrency = jdm.get(SamplingProcessor.CONCURRENCY);
        final String sequence = (String) parameters.get(SamplingProcessor.SEQUENCE);

        // if processor is not active we do not proceed with the processing
        if(!processor.isActive()) {
            return;
View Full Code Here

        return jobDetail;
    }

    @Override
    protected JobDataMap getJobDataMap() {
        JobDataMap jdm = new JobDataMap();
        jdm.put(PROCESSOR_INSTANCE,this);
        return jdm;

    }
View Full Code Here

        return jobDetail;
    }

    @Override
    protected JobDataMap getJobDataMap() {
        JobDataMap jdm = new JobDataMap();
        sender = initMessageSender(parameters);
        jdm.put(BLOCKING_SENDER,sender);
        jdm.put(PROCESSOR_INSTANCE,this);
        return jdm;
    }
View Full Code Here

         * Execute the current job.
         */
        public void execute(final JobExecutionContext jobExecutionContext)
            throws JobExecutionException
        {
            final JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap() ;
            final SchedulerJobListener listener = (SchedulerJobListener) jobDataMap.get(SchedulerJobListener.class.getName()) ;
            final ClassLoader tcc = (ClassLoader)jobDataMap.get(ClassLoader.class.getName()) ;
           
            final Thread thread = Thread.currentThread() ;
            final ClassLoader currentClassLoader = thread.getContextClassLoader() ;
            thread.setContextClassLoader(tcc) ;
            try
View Full Code Here

        String jobName = ctx.getJobDetail().getFullName();
        if (log.isDebugEnabled()) {
            log.debug("Executing task : " + jobName);
        }
        JobDataMap jdm = ctx.getMergedJobDataMap();
        String jobClassName = (String) jdm.get(CLASSNAME);
        if (jobClassName == null) {
            handleException("No " + CLASSNAME + " in JobDetails");
        }

        boolean initRequired = false;

        Task task = (Task) jdm.get(TaskDescription.INSTANCE);
        if (task == null) {
            initRequired = true;
        }

        SynapseEnvironment se = (SynapseEnvironment) jdm.get("SynapseEnvironment");

        if (initRequired) {
            try {
                task = (Task) getClass().getClassLoader().loadClass(jobClassName).newInstance();
            } catch (Exception e) {
                handleException("Cannot instantiate task : " + jobClassName, e);
            }

            Set properties = (Set) jdm.get(PROPERTIES);
            for (Object property : properties) {
                OMElement prop = (OMElement) property;
                log.debug("Found Property : " + prop.toString());
                PropertyHelper.setStaticProperty(prop, task);
            }
View Full Code Here

    public static final String TIMER_DATA = "TIMER_DATA";

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
        EjbTimerServiceImpl ejbTimerService = (EjbTimerServiceImpl) jobDataMap.get(EJB_TIMERS_SERVICE);
        TimerData timerData = (TimerData) jobDataMap.get(TIMER_DATA);
        ejbTimerService.ejbTimeout(timerData);
    }
View Full Code Here

TOP

Related Classes of org.quartz.JobDataMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.