1
2
3
4
5
6
7
8
9
10 package ch.qos.logback.core.joran.replay;
11
12 import java.util.List;
13
14 import ch.qos.logback.core.joran.GenericConfigurator;
15 import ch.qos.logback.core.joran.action.NOPAction;
16 import ch.qos.logback.core.joran.action.NestedComplexPropertyIA;
17 import ch.qos.logback.core.joran.action.NestedBasicPropertyIA;
18 import ch.qos.logback.core.joran.event.SaxEvent;
19 import ch.qos.logback.core.joran.spi.EventPlayer;
20 import ch.qos.logback.core.joran.spi.Interpreter;
21 import ch.qos.logback.core.joran.spi.JoranException;
22 import ch.qos.logback.core.joran.spi.Pattern;
23 import ch.qos.logback.core.joran.spi.RuleStore;
24
25 public class FruitConfigurator extends GenericConfigurator {
26
27 FruitFactory ff;
28 public FruitConfigurator(FruitFactory ff) {
29 this.ff = ff;
30 }
31
32 @Override
33 final public void doConfigure(final List<SaxEvent> eventList)
34 throws JoranException {
35 buildInterpreter();
36 interpreter.getInterpretationContext().pushObject(ff);
37 EventPlayer player = new EventPlayer(interpreter);
38 player.play(eventList);
39 }
40
41 @Override
42 protected void addImplicitRules(Interpreter interpreter) {
43 NestedComplexPropertyIA nestedIA = new NestedComplexPropertyIA();
44 nestedIA.setContext(context);
45 interpreter.addImplicitAction(nestedIA);
46
47 NestedBasicPropertyIA nestedSimpleIA = new NestedBasicPropertyIA();
48 nestedIA.setContext(context);
49 interpreter.addImplicitAction(nestedSimpleIA);
50 }
51
52
53 @Override
54 protected void addInstanceRules(RuleStore rs) {
55 rs.addRule(new Pattern("fruitShell"), new NOPAction());
56 }
57
58 }