1 31 package org.blojsom.plugin.chrono; 32 33 import org.blojsom.blog.Blog; 34 import org.blojsom.blog.Entry; 35 import org.blojsom.plugin.Plugin; 36 import org.blojsom.plugin.PluginException; 37 38 import javax.servlet.http.HttpServletRequest ; 39 import javax.servlet.http.HttpServletResponse ; 40 import java.util.ArrayList ; 41 import java.util.Collections ; 42 import java.util.Map ; 43 44 54 public class ChronoPlugin implements Plugin { 55 56 61 public void init() throws PluginException { 62 } 63 64 75 public Entry[] process(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Blog blog, Map context, Entry[] entries) throws PluginException { 76 if (entries.length == 0) { 77 return entries; 78 } else { 79 ArrayList entriesList = new ArrayList (); 80 for (int i = 0; i < entries.length; i++) { 81 Entry entry = entries[i]; 82 entriesList.add(entry); 83 } 84 85 Collections.reverse(entriesList); 86 87 return (Entry[]) entriesList.toArray(new Entry[entriesList.size()]); 88 } 89 } 90 91 96 public void cleanup() throws PluginException { 97 } 98 99 104 public void destroy() throws PluginException { 105 } 106 } 107 | Popular Tags |