View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.core.joran.spi;
15  
16  import java.util.function.Supplier;
17  
18  import ch.qos.logback.core.joran.action.Action;
19  
20  /**
21   * 
22   * As its name indicates, a RuleStore contains 2-tuples consists of a
23   * ElementSelector and an Action.
24   * 
25   * <p>
26   * As a joran configurator goes through the elements in a document, it asks the
27   * rule store whether there are rules matching the current pattern by invoking
28   * the {@link #matchActions(ElementPath)} method.
29   * 
30   * @author Ceki G&uuml;lc&uuml;
31   * 
32   */
33  public interface RuleStore {
34  
35      /**
36       * Add a new rule, given by a pattern and an action class (String).
37       *
38       * @param elementSelector
39       * @param actionClassStr
40       * @throws ClassNotFoundException
41       */
42      void addRule(ElementSelector elementSelector, String actionClassStr) throws ClassNotFoundException;
43  
44      /**
45       * Add a new rule, given by a pattern and an action instance.
46       *
47       * @param elementSelector
48       * @param actionSupplier
49       */
50      void addRule(ElementSelector elementSelector, Supplier<Action> actionSupplier);
51  
52      /**
53       * Return a list of actions matching a pattern.
54       *
55       * @param elementPath the path to match for
56       * @return list of matching actions
57       */
58      Supplier<Action> matchActions(ElementPath elementPath);
59      
60      void addTransparentPathPart(String pathPart);
61  
62      public void addPathPathMapping(String originalName, String modifiedName);
63  
64      }