KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > applications > crontab > AbstractCronJob


1 /*
2  This software is OSI Certified Open Source Software.
3 OSI Certified is a certification mark of the Open Source Initiative.
4
5 The license (Mozilla version 1.0) can be read at the MMBase site.
6 See http://www.MMBase.org/license
7  */

8 package org.mmbase.applications.crontab;
9
10 /**
11  * A straight-forward abstract implementation of CronJob. If you exend it, you only need to
12  * implement run(), and the 'cronEntry' protected member var is available.
13  *
14  * @author Michiel Meeuwissen
15  */

16
17 public abstract class AbstractCronJob implements CronJob {
18
19     protected CronEntry cronEntry;
20     /**
21      * {@inheritDoc}
22      *
23      * Stores the CronEntry in protected member cronEntry. So extensions should override
24      * {@link #init()} instead (in which they can use the cronEntry member).
25      */

26     public final void init(CronEntry cronEntry) {
27         this.cronEntry = cronEntry;
28         init();
29     }
30
31     /**
32      * You can init by overriding this (no need to call super.init)
33      * This is called by {@link #init(CronEntry)}
34      */

35     protected void init() {}
36
37     /**
38      * Empty implementation (probably that's what you want)
39      */

40     public void stop() {}
41
42
43     /**
44      * Implement this.
45      */

46     public abstract void run();
47 }
48
Popular Tags