01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
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 implements
30: 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: }
|