View Javadoc

1   /*
2    * $Id: CustomJobConfig.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.transport.quartz.jobs;
11  
12  import org.mule.transport.quartz.config.AbstractJobConfig;
13  
14  import org.quartz.Job;
15  import org.quartz.StatefulJob;
16  
17  /**
18   * This configuration simply holds a reference to a user defined job to execute.
19   */
20  public class CustomJobConfig extends AbstractJobConfig
21  {
22      private Job job;
23  
24      public Job getJob()
25      {
26          return job;
27      }
28  
29      public void setJob(Job job)
30      {
31          this.job = job;
32          setStateful(job instanceof StatefulJob);
33      }
34  
35      @Override
36      protected Class<? extends StatefulJob> getStatefulJobClass()
37      {
38          return StatefulCustomJob.class;
39      }
40  
41      @Override
42      protected Class<? extends Job> getStatelessJobClass()
43      {
44          return CustomJob.class;
45      }
46  }