1 31 package org.blojsom.plugin.pingback; 32 33 import org.blojsom.plugin.Plugin; 34 import org.blojsom.plugin.PluginException; 35 import org.blojsom.blog.Blog; 36 import org.blojsom.blog.Entry; 37 import org.blojsom.fetcher.Fetcher; 38 import org.blojsom.fetcher.FetcherException; 39 import org.apache.commons.logging.Log; 40 import org.apache.commons.logging.LogFactory; 41 42 import javax.servlet.http.HttpServletRequest ; 43 import javax.servlet.http.HttpServletResponse ; 44 import java.util.Map ; 45 46 53 public class RecentPingbacksPlugin implements Plugin { 54 55 private Log _logger = LogFactory.getLog(RecentPingbacksPlugin.class); 56 57 private static final String BLOJSOM_PLUGIN_RECENT_PINGBACKS = "BLOJSOM_PLUGIN_RECENT_PINGBACKS"; 58 59 private Fetcher _fetcher; 60 61 64 public RecentPingbacksPlugin() { 65 } 66 67 72 public void setFetcher(Fetcher fetcher) { 73 _fetcher = fetcher; 74 } 75 76 81 public void init() throws PluginException { 82 } 83 84 95 public Entry[] process(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Blog blog, Map context, Entry[] entries) throws PluginException { 96 try { 97 context.put(BLOJSOM_PLUGIN_RECENT_PINGBACKS, _fetcher.loadRecentPingbacks(blog)); 98 } catch (FetcherException e) { 99 if (_logger.isErrorEnabled()) { 100 _logger.error(e); 101 } 102 } 103 104 return entries; 105 } 106 107 112 public void cleanup() throws PluginException { 113 } 114 115 120 public void destroy() throws PluginException { 121 } 122 } 123 | Popular Tags |