1 18 package org.columba.core.scripting.interpreter; 19 20 import java.util.Iterator ; 21 import java.util.Map ; 22 23 import org.columba.core.scripting.model.ColumbaScript; 24 import org.python.util.PythonInterpreter; 25 26 29 public class JythonInterpreter 30 extends ScriptInterpreter 31 { 32 33 private final static String [] EXTENSIONS = new String []{"py", "jython"}; 34 35 public String getName() 36 { 37 return "Jython Interpreter"; 38 } 39 40 public String [] getSupportedExtensions() 41 { 42 return EXTENSIONS; 43 } 44 45 public void execute(ColumbaScript script, Map vars) 46 { 47 51 logger.append("Executing jython: " + script.getPath()); 52 53 PythonInterpreter jython = new PythonInterpreter(); 54 55 for (Iterator it = vars.entrySet().iterator(); it.hasNext();) 56 { 57 Map.Entry entry = (Map.Entry ) it.next(); 58 jython.set(entry.getKey().toString(), entry.getValue()); 59 } 60 61 jython.execfile(script.getPath()); 62 jython.cleanup(); 63 64 } 65 66 } 67 | Popular Tags |