View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.quartz.config;
8   
9   import org.mule.api.MuleContext;
10  import org.mule.api.context.MuleContextAware;
11  import org.mule.transport.quartz.QuartzConnector;
12  
13  import org.quartz.Job;
14  import org.quartz.StatefulJob;
15  
16  /**
17   * Base implementation of {@link JobConfig}.
18   */
19  public abstract class AbstractJobConfig implements JobConfig, MuleContextAware
20  {
21      private boolean stateful = false;
22  
23      private String groupName = QuartzConnector.DEFAULT_GROUP_NAME;
24  
25      private String jobGroupName = QuartzConnector.DEFAULT_GROUP_NAME;
26  
27      private transient MuleContext muleContext;
28  
29      public void setMuleContext(MuleContext context)
30      {
31          this.muleContext = context;
32      }
33  
34      public MuleContext getMuleContext()
35      {
36          return muleContext;
37      }
38  
39      public String getGroupName()
40      {
41          return groupName;
42      }
43  
44      public void setGroupName(String groupName)
45      {
46          this.groupName = groupName;
47      }
48  
49      public String getJobGroupName()
50      {
51          return jobGroupName;
52      }
53  
54      public void setJobGroupName(String jobGroupName)
55      {
56          this.jobGroupName = jobGroupName;
57      }
58  
59      public boolean isStateful()
60      {
61          return stateful;
62      }
63  
64      public void setStateful(boolean stateful)
65      {
66          this.stateful = stateful;
67      }
68  
69      public final Class<? extends Job> getJobClass()
70      {
71          return (isStateful() ? getStatefulJobClass() : getStatelessJobClass());
72      }
73  
74      protected abstract Class<? extends StatefulJob> getStatefulJobClass();
75      
76      protected abstract Class<? extends Job> getStatelessJobClass();
77  }