1
2
3
4
5
6
7 package genie.core;
8
9
10 import org.apache.commons.chain.impl.ContextBase;
11 import org.apache.commons.digester.CallMethodRule;
12 import org.apache.commons.digester.CallParamRule;
13 import org.apache.commons.digester.Digester;
14 import org.apache.commons.digester.ObjectCreateRule;
15 import org.apache.commons.digester.Rules;
16
17 /***
18 *
19 *
20 * @author T. Kia Ntoni
21 *
22 * 3 janv. 2005
23 * ConfigRuleSet @version
24 */
25 public class ContextRuleSet extends AbstractRuleSet {
26
27 /***
28 *
29 */
30 public ContextRuleSet() {
31 super();
32
33 }
34
35
36
37
38 public void addRuleInstances(Digester digester) {
39
40 super.addRuleInstances(digester);
41 Rules rules = digester.getRules();
42
43
44
45
46
47
48
49
50
51
52 rules.add("!*/context", new ObjectCreateRule("className", ContextBase.class));
53
54 rules.add("!*/context/context", new CallMethodRule(1 , "put", 2, contextItemParams));
55 rules.add("!*/context/context", new CallParamRule(0, "id"));
56 rules.add("!*/context/context", new CallParamRule(1, true));
57
58 rules.add("!*/context/entry", new CallMethodRule("put", 2, contextItemParams));
59 rules.add("!*/context/entry", new CallParamRule( 0, "key"));
60 rules.add("!*/context/entry", new CallParamRule(1));
61
62
63 }
64
65 }