KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > presentation > TurnoverReferersTask


1 /*
2  * Created on Aug 16, 2003
3  */

4 package org.roller.presentation;
5
6 import java.util.TimerTask JavaDoc;
7
8 import org.apache.commons.logging.Log;
9 import org.apache.commons.logging.LogFactory;
10 import org.roller.RollerException;
11 import org.roller.model.RefererManager;
12 import org.roller.model.Roller;
13 import org.roller.model.RollerFactory;
14 import org.roller.model.ScheduledTask;
15
16 /**
17  * @author aim4min
18  */

19 public class TurnoverReferersTask extends TimerTask JavaDoc implements ScheduledTask
20 {
21     private static Log mLogger = LogFactory.getFactory().getInstance(
22             TurnoverReferersTask.class);
23     private RefererManager refManager = null;
24     
25     public void init(Roller roller, String JavaDoc realPath) throws RollerException
26     {
27         refManager = roller.getRefererManager();
28     }
29     public void run()
30     {
31         if (refManager != null)
32             try
33             {
34                 RollerFactory.getRoller().begin();
35                 refManager.checkForTurnover(false, null);
36                 RollerFactory.getRoller().commit();
37                 RollerFactory.getRoller().release();
38             }
39             catch (RollerException e)
40             {
41                 mLogger.error("Error while checking for referer turnover", e);
42             }
43     }
44 }
Popular Tags