1 package org.roller.presentation.planet; 2 3 import java.util.TimerTask ; 4 5 import org.apache.commons.logging.Log; 6 import org.apache.commons.logging.LogFactory; 7 import org.roller.RollerException; 8 import org.roller.model.Roller; 9 import org.roller.model.RollerFactory; 10 import org.roller.model.ScheduledTask; 11 12 16 public class RefreshEntriesTask extends TimerTask implements ScheduledTask 17 { 18 private static Log logger = 19 LogFactory.getFactory().getInstance(RefreshEntriesTask.class); 20 private Roller roller = null; 21 22 23 public static void main(String [] args) throws Exception 24 { 25 RollerFactory.setRoller( 26 "org.roller.business.hibernate.HibernateRollerImpl"); 27 RefreshEntriesTask task = new RefreshEntriesTask(); 28 task.init(RollerFactory.getRoller(), "dummy"); 29 task.run(); 30 } 31 public void init(Roller roller, String realPath) throws RollerException 32 { 33 this.roller = (Roller)roller; 34 } 35 public void run() 36 { 37 try 38 { 39 roller.begin(); 40 roller.getPlanetManager().refreshEntries(); 41 roller.commit(); 42 roller.release(); 43 } 44 catch (RollerException e) 45 { 46 logger.error("ERROR refreshing entries", e); 47 } 48 } 49 } 50 51 | Popular Tags |