001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.core.joran.spi; 015 016import java.util.function.Supplier; 017 018import ch.qos.logback.core.joran.action.Action; 019 020/** 021 * 022 * As its name indicates, a RuleStore contains 2-tuples consists of a 023 * ElementSelector and an Action. 024 * 025 * <p> 026 * As a joran configurator goes through the elements in a document, it asks the 027 * rule store whether there are rules matching the current pattern by invoking 028 * the {@link #matchActions(ElementPath)} method. 029 * 030 * @author Ceki Gülcü 031 * 032 */ 033public interface RuleStore { 034 035 /** 036 * Add a new rule, given by a pattern and an action class (String). 037 * 038 * @param elementSelector 039 * @param actionClassStr 040 * @throws ClassNotFoundException 041 */ 042 void addRule(ElementSelector elementSelector, String actionClassStr) throws ClassNotFoundException; 043 044 /** 045 * Add a new rule, given by a pattern and an action instance. 046 * 047 * @param elementSelector 048 * @param action 049 */ 050 void addRule(ElementSelector elementSelector, Supplier<Action> actionSupplier); 051 052 /** 053 * Return a list of actions matching a pattern. 054 * 055 * @param elementPath the path to match for 056 * @return list of matching actions 057 */ 058 Supplier<Action> matchActions(ElementPath elementPath); 059 060 void addTransparentPathPart(String pathPart); 061}