KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > monitor > action > UnScheduleAction


1 package org.oddjob.monitor.action;
2
3 import org.apache.log4j.Logger;
4 import org.oddjob.designer.model.DesignDefinition;
5 import org.oddjob.monitor.model.ExplorerContext;
6 import org.oddjob.monitor.model.JobAction;
7 import org.oddjob.scheduling.OddjobScheduler;
8
9 /**
10  * An action that un schedules a Job from a scheduler.
11  *
12  * @author Rob Gordon
13  */

14
15 public class UnScheduleAction extends JobAction {
16     private static final Logger logger = Logger.getLogger(UnScheduleAction.class);
17     
18     private String JavaDoc id;
19         
20     private boolean enabled;
21         
22     private OddjobScheduler oddjobScheduler;
23         
24     public UnScheduleAction(OddjobScheduler oddjobScheduler, String JavaDoc id) {
25         this.oddjobScheduler = oddjobScheduler;
26         this.id = id;
27     }
28     
29     /**
30      * Get the name of the action.
31      */

32     public String JavaDoc getName() {
33         return id + " on " + oddjobScheduler;
34     }
35
36     /*
37      * (non-Javadoc)
38      * @see org.oddjob.monitor.model.JobOption#select(java.lang.Object, org.oddjob.monitor.model.EContext)
39      */

40     public void select(Object JavaDoc component, ExplorerContext eContext) {
41         enabled = true;
42     }
43     
44     /*
45      * (non-Javadoc)
46      * @see org.oddjob.monitor.model.JobOption#deSelect()
47      */

48     public void deSelect() {
49         enabled = false;
50     }
51
52     /*
53      * (non-Javadoc)
54      * @see org.oddjob.monitor.model.JobOption#enabled()
55      */

56     public boolean enabled() {
57         return enabled;
58     }
59     
60     /*
61      * (non-Javadoc)
62      * @see org.oddjob.monitor.model.JobAction#form()
63      */

64     public DesignDefinition form() {
65         return null;
66     }
67     
68     /*
69      * (non-Javadoc)
70      * @see org.oddjob.monitor.model.JobAction#action()
71      */

72     public void action() throws Exception JavaDoc {
73         logger.debug("Attempting to " + getName());
74         oddjobScheduler.unSchedule(id);
75     }
76
77 }
78
Popular Tags