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