/** Read text from fileName and eval it. Convenience method. Use the global namespace. */ public Object source( String filename ) throws FileNotFoundException, IOException, EvalError { return source( filename, globalNameSpace ); }
/** Read text from fileName and eval it. Convenience method. Use the global namespace. */ public Object source( String filename ) throws FileNotFoundException, IOException, EvalError { return source( filename, globalNameSpace ); }
public void actionPerformed (ActionEvent ev) { String bshSource = ev.getActionCommand(); try { Interpreter bsh = new Interpreter (); bsh.source (bshSource); } catch (Exception e) { e.printStackTrace(); } } }
void loadRCFiles() { try { // Default is c:\windows under win98, $HOME under Unix String rcfile = System.getProperty("user.home") + File.separator + ".bshrc"; source( rcfile, globalNameSpace ); } catch ( Exception e ) { // squeltch security exception, filenotfoundexception Interpreter.debug("Could not find rc file: ", e); } }
void loadRCFiles() { try { String rcfile = // Default is c:\windows under win98, $HOME under Unix System.getProperty("user.home") + File.separator + ".bshrc"; source( rcfile, globalNameSpace ); } catch ( Exception e ) { // squeltch security exception, filenotfoundexception if ( Interpreter.DEBUG ) debug("Could not find rc file: "+e); } }
Interpreter i = new Interpreter(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); System.setOut(ps); try { //i.eval("System.out.println(\"test\");"); i.source("c:\\htdocs\\test.bsh"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } String out = "hello : "+baos.toString(); System.err.println(out);
private boolean eval (Interpreter bsh, String script, String source) throws EvalError, IOException { boolean rc = false; if (script != null) { Object retValue = bsh.eval (script); if (source != null) retValue = bsh.source (source); if (retValue instanceof Boolean) { rc = (Boolean) retValue; } } return rc; } }
protected Interpreter initInterpreter(Map arguments) throws EvalError, IOException { Interpreter i = new Interpreter(); Map.Entry entry; for (Object o : arguments.entrySet()) { entry = (Map.Entry) o; i.set((String) entry.getKey(), entry.getValue()); } if (source) { i.source(bshData); } else { i.eval(bshData); } return i; }
Interpreter i = new Interpreter(); NameSpace ns = i.getNameSpace(); ns.setVariable("args", new String[]{"param1", "param2"}, false); i.source("Target.bsh");
try { Object result = interpreter.source( filename, interpreter.globalNameSpace ); if ( result instanceof Class ) try {
Object ret= bsh.source(script);
this.interpreter.source(scriptPath); this.interpreter.set( "instance",
interpreter.setu( "bsh.args", bshArgs ); Object result = interpreter.source( filename, interpreter.globalNameSpace ); if ( result instanceof Class ) try {
public void run () { Element config = getPersist(); try { bsh.set ("qbean", this); bsh.set ("log", getLog()); bsh.set ("cfg", getConfiguration()); bsh.eval (config.getText()); String source = config.getAttributeValue ("source"); if (source != null) bsh.source (source); } catch (Throwable e) { getLog().warn (e); } } }
bsh.set("evt", evt); bsh.set("cfg", cfg); Object r = bsh.source(aSource); if (r instanceof ISOMsg) m = (ISOMsg) r;