1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.scxml.env.jexl;
18
19 import java.util.Map;
20
21 import org.apache.commons.scxml.Builtin;
22 import org.apache.commons.scxml.Context;
23 import org.apache.commons.scxml.env.SimpleContext;
24
25 /***
26 * JEXL Context implementation for Commons SCXML.
27 *
28 */
29 public class JexlContext extends SimpleContext
30 implements org.apache.commons.jexl.JexlContext {
31
32 /*** Serial version UID. */
33 private static final long serialVersionUID = 1L;
34
35 /***
36 * Constructor.
37 */
38 public JexlContext() {
39 super();
40 getVars().put("_builtin", new Builtin());
41 }
42
43 /***
44 * Constructor with initial vars.
45 *
46 * @param initialVars The initial set of variables.
47 */
48 public JexlContext(final Map initialVars) {
49 super(initialVars);
50 getVars().put("_builtin", new Builtin());
51 }
52
53 /***
54 * Constructor with parent context.
55 *
56 * @param parent The parent context.
57 */
58 public JexlContext(final Context parent) {
59 super(parent);
60 getVars().put("_builtin", new Builtin());
61 }
62
63 /***
64 * Set the variables map.
65 *
66 * @param vars The new variables map.
67 *
68 * @see org.apache.commons.jexl.JexlContext#setVars(Map)
69 * @see org.apache.commons.scxml.env.SimpleContext#setVars(Map)
70 */
71 public void setVars(final Map vars) {
72 super.setVars(vars);
73 getVars().put("_builtin", new Builtin());
74 }
75
76 /***
77 * Get the variables map.
78 *
79 * @return Map The variables map.
80 *
81 * @see org.apache.commons.jexl.JexlContext#getVars()
82 * @see org.apache.commons.scxml.env.SimpleContext#getVars()
83 */
84 public Map getVars() {
85 return super.getVars();
86 }
87
88 /***
89 * Clear this Context.
90 *
91 * @see org.apache.commons.scxml.Context#reset()
92 */
93 public void reset() {
94 super.reset();
95 getVars().put("_builtin", new Builtin());
96 }
97
98 }
99