1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.tags.bsf;
17
18 import org.apache.bsf.util.ObjectRegistry;
19
20 import org.apache.commons.jelly.JellyContext;
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23
24 /*** A BSF ObjectRegistry which uses the Context to find and
25 * register objects
26 *
27 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
28 * @version $Revision: 155420 $
29 */
30 public class JellyContextRegistry extends ObjectRegistry {
31
32 /*** The Log to which logging calls will be made. */
33 private static final Log log = LogFactory.getLog(JellyContextRegistry.class);
34
35 /*** The context */
36 private JellyContext context;
37
38 public JellyContextRegistry() {
39 }
40
41 public JellyContext getJellyContext() {
42 return context;
43 }
44
45 public void setJellyContext(JellyContext context) {
46 this.context = context;
47 }
48
49
50
51 public Object lookup(String name) {
52 return context.getVariable(name);
53 }
54
55 public void register(String name, Object value) {
56 context.setVariable(name, value);
57 }
58
59 public void unregister(String name) {
60 context.removeVariable(name);
61 }
62 }