public Map<String, Filter> setFilterMap() { Map<String, JrdsDocument> nodemap = load.getRepository(ConfigType.FILTER); FilterBuilder ob = new FilterBuilder(); ob.setPm(pm); Map<String, Filter> filtersMap = getObjectMap(ob, nodemap); logger.debug(jrds.Util.delayedFormatString("Filters configured: %s", filtersMap.keySet())); return filtersMap; }
@Override Filter build(JrdsDocument n) throws InvocationTargetException { try { return makeFilter(n); } catch (SecurityException | IllegalArgumentException | NoSuchMethodException | IllegalAccessException | InstantiationException e) { throw new InvocationTargetException(e, FilterBuilder.class.getName()); } }
private Filter doFilter(JrdsDocument d) throws SecurityException, IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, IOException { FilterBuilder sm = new FilterBuilder(); sm.setPm(Tools.makePm(testFolder, "security=true")); return sm.makeFilter(d); }
public Filter makeFilter(JrdsDocument n) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { JrdsElement root = n.getRootElement(); JrdsElement name = root.getElementbyName("name"); if(name == null) return null; FilterXml f = new FilterXml(name.getTextContent()); setMethod(root.getChildElementsByName("path"), f, "addPath", String.class); setMethod(root.getChildElementsByName("tag"), f, "addTag", String.class); setMethod(root.getChildElementsByName("qualifiedname"), f, "addGraph", String.class); doACL(f, n, root); logger.trace(Util.delayedFormatString("Filter loaded: %s", f.getName())); return f; }
@Test public void testFilter() throws Exception { JrdsDocument d = Tools.parseRessource("view1.xml"); PropertiesManager pm = Tools.makePm(testFolder); FilterBuilder fb = new FilterBuilder(); fb.setPm(pm); Filter f = fb.makeFilter(d); Assert.assertEquals("Test view 1", f.getName()); }