1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.jsieve;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.jsieve.comparators.Comparator;
24 import org.apache.jsieve.exception.LookupException;
25 import org.apache.jsieve.tests.ExecutableTest;
26
27
28
29
30
31 public class BaseSieveContext extends SieveContext {
32
33 private ScriptCoordinate coordinate;
34
35 private ConditionManager conditionManager;
36
37 private final CommandStateManager commandStateManager;
38
39 private final CommandManager commandManager;
40
41 private final ComparatorManager comparatorManager;
42
43 private final TestManager testManager;
44
45 private final Log log;
46
47 public BaseSieveContext(final CommandManager commandManager,
48 final ComparatorManager comparatorManager,
49 final TestManager testManager, final Log log) {
50 this.commandStateManager = new CommandStateManager();
51 this.conditionManager = new ConditionManager();
52 this.testManager = testManager;
53 this.commandManager = commandManager;
54 this.comparatorManager = comparatorManager;
55 this.log = log;
56 }
57
58
59
60
61
62
63 public ScriptCoordinate getCoordinate() {
64 return coordinate;
65 }
66
67
68
69
70
71
72
73 public void setCoordinate(ScriptCoordinate coordinate) {
74 this.coordinate = coordinate;
75 if (coordinate != null) {
76 coordinate.setLog(getLog());
77 }
78 }
79
80 public CommandStateManager getCommandStateManager() {
81 return commandStateManager;
82 }
83
84 public ConditionManager getConditionManager() {
85 return conditionManager;
86 }
87
88 public void setConditionManager(ConditionManager conditionManager) {
89 this.conditionManager = conditionManager;
90 }
91
92 public ExecutableCommand getCommand(String name) throws LookupException {
93 return commandManager.getCommand(name);
94 }
95
96 public Comparator getComparator(String name) throws LookupException {
97 return comparatorManager.getComparator(name);
98 }
99
100 public ExecutableTest getTest(String name) throws LookupException {
101 return testManager.getTest(name);
102 }
103
104 public Log getLog() {
105 return log;
106 }
107 }