1
2
3
4
5
6
7
8
9
10
11 package ch.qos.logback.core.joran;
12
13 import java.util.HashMap;
14 import java.util.List;
15 import java.util.Map;
16
17 import ch.qos.logback.core.joran.action.ActionConst;
18 import ch.qos.logback.core.joran.action.AppenderAction;
19 import ch.qos.logback.core.joran.action.AppenderRefAction;
20 import ch.qos.logback.core.joran.action.ContextPropertyAction;
21 import ch.qos.logback.core.joran.action.ConversionRuleAction;
22 import ch.qos.logback.core.joran.action.NestedBasicPropertyIA;
23 import ch.qos.logback.core.joran.action.NestedComplexPropertyIA;
24 import ch.qos.logback.core.joran.action.NewRuleAction;
25 import ch.qos.logback.core.joran.action.ParamAction;
26 import ch.qos.logback.core.joran.action.PropertyAction;
27 import ch.qos.logback.core.joran.action.StatusListenerAction;
28 import ch.qos.logback.core.joran.spi.InterpretationContext;
29 import ch.qos.logback.core.joran.spi.Interpreter;
30 import ch.qos.logback.core.joran.spi.Pattern;
31 import ch.qos.logback.core.joran.spi.RuleStore;
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 abstract public class JoranConfiguratorBase extends GenericConfigurator {
47
48
49 public List getErrorList() {
50 return null;
51 }
52
53 @Override
54 protected void addInstanceRules(RuleStore rs) {
55
56 rs.addRule(new Pattern("configuration/property"),
57 new PropertyAction());
58
59 rs.addRule(new Pattern("configuration/substitutionProperty"),
60 new PropertyAction());
61
62
63
64 rs.addRule(new Pattern("configuration/contextProperty"),
65 new ContextPropertyAction());
66
67 rs.addRule(new Pattern("configuration/conversionRule"),
68 new ConversionRuleAction());
69
70 rs.addRule(new Pattern("configuration/statusListener"),
71 new StatusListenerAction());
72
73 rs.addRule(new Pattern("configuration/appender"), new AppenderAction());
74 rs.addRule(new Pattern("configuration/appender/appender-ref"),
75 new AppenderRefAction());
76 rs.addRule(new Pattern("configuration/newRule"), new NewRuleAction());
77 rs.addRule(new Pattern("*/param"), new ParamAction());
78 }
79
80 @Override
81 protected void addImplicitRules(Interpreter interpreter) {
82
83 NestedComplexPropertyIA nestedIA = new NestedComplexPropertyIA();
84 nestedIA.setContext(context);
85 interpreter.addImplicitAction(nestedIA);
86
87 NestedBasicPropertyIA nestedSimpleIA = new NestedBasicPropertyIA();
88 nestedIA.setContext(context);
89 interpreter.addImplicitAction(nestedSimpleIA);
90 }
91
92 @Override
93 protected void buildInterpreter() {
94 super.buildInterpreter();
95 Map<String, Object> omap = interpreter.getInterpretationContext().getObjectMap();
96 omap.put(ActionConst.APPENDER_BAG, new HashMap());
97 omap.put(ActionConst.FILTER_CHAIN_BAG, new HashMap());
98 }
99
100 public InterpretationContext getExecutionContext() {
101 return interpreter.getInterpretationContext();
102 }
103 }