1 25 26 package org.snipsnap.render.filter; 27 28 import org.radeox.api.engine.context.InitialRenderContext; 29 import org.radeox.filter.MacroFilter; 30 import org.radeox.macro.Repository; 31 import org.snipsnap.render.macro.WeblogMacro; 32 33 import java.util.ArrayList ; 34 import java.util.HashMap ; 35 import java.util.List ; 36 import java.util.Map ; 37 38 47 48 public class LateMacroFilter extends MacroFilter { 49 protected Repository macroRepository = new Repository() { 50 private Map macros = new HashMap (); 51 52 public boolean containsKey(String key) { 53 return macros.containsKey(key); 54 } 55 56 public Object get(String key) { 57 return macros.get(key); 58 } 59 60 public List getPlugins() { 61 return new ArrayList (macros.values()); 62 } 63 64 public void put(String key, Object value) { 65 macros.put(key, value); 66 } 67 }; 68 69 public void setInitialContext(InitialRenderContext context) { 70 super.setInitialContext(context); 71 WeblogMacro weblogMacro = new WeblogMacro(); 72 macroRepository.put(weblogMacro.getName(), weblogMacro); 73 } 74 75 protected Repository getMacroRepository() { 76 return macroRepository; 77 } 78 } 79 | Popular Tags |