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