1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 1999-2006, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10  package ch.qos.logback.core.joran;
11  
12  import java.util.HashMap;
13  
14  import ch.qos.logback.core.joran.action.Action;
15  import ch.qos.logback.core.joran.spi.Interpreter;
16  import ch.qos.logback.core.joran.spi.Pattern;
17  import ch.qos.logback.core.joran.spi.RuleStore;
18  
19  public class TrivialConfigurator extends GenericConfigurator {
20  
21    HashMap<Pattern, Action> rulesMap;
22    
23    public TrivialConfigurator(HashMap<Pattern, Action> rules) {
24      this.rulesMap = rules;
25    }
26    
27    @Override
28    protected void addImplicitRules(Interpreter interpreter) {
29    }
30  
31    @Override
32    protected void addInstanceRules(RuleStore rs) {
33      for(Pattern pattern : rulesMap.keySet()) {
34        Action action = rulesMap.get(pattern);
35        rs.addRule(pattern, action);
36      }
37    }
38  
39  }