01: package abbot.script;
02:
03: import java.io.*;
04: import abbot.Log;
05: import abbot.finder.BasicFinder;
06:
07: /** Provides a BeanShell interpreter customized for the Costello scripting
08: * environment.
09: */
10: public class Interpreter extends bsh.Interpreter {
11: public Interpreter(Resolver r) {
12: setClassLoader(r.getContextClassLoader());
13: try {
14: set("finder", new BasicFinder(r.getHierarchy()));
15: set("resolver", r);
16: set("script", r);
17: InputStream is = getClass().getResourceAsStream("init.bsh");
18: eval(new BufferedReader(new InputStreamReader(is)));
19: } catch (bsh.EvalError e) {
20: Log.warn("Error initializing interpreter: " + e);
21: }
22: }
23: }
|