1 package org.enhydra.shark.scripting; 2 3 4 import org.enhydra.shark.api.RootException; 5 import org.enhydra.shark.api.SharkTransaction; 6 import org.enhydra.shark.api.internal.scripting.Evaluator; 7 import org.enhydra.shark.api.internal.scripting.ScriptingManager; 8 import org.enhydra.shark.api.internal.working.CallbackUtilities; 9 10 11 13 public class StandardScriptingManager implements ScriptingManager { 14 public static final String PYTHON_SCRIPT="text/pythonscript"; 15 public static final String JAVA_LANGUAGE_SCRIPT="text/java"; 16 public static final String JAVA_SCRIPT="text/javascript"; 17 18 19 private BshEvaluator bshEvaluator; 20 private PythonEvaluator pythonEvaluator; 21 private JavaScriptEvaluator jsEvaluator; 22 23 private static CallbackUtilities cus; 24 public void configure (CallbackUtilities cus) throws RootException { 25 StandardScriptingManager.cus=cus; 26 bshEvaluator=new BshEvaluator(); 27 bshEvaluator.configure(cus); 28 pythonEvaluator=new PythonEvaluator(); 29 pythonEvaluator.configure(cus); 30 jsEvaluator=new JavaScriptEvaluator(); 31 jsEvaluator.configure(cus); 32 } 33 34 35 public Evaluator getEvaluator (SharkTransaction t,String name) throws RootException { 36 if (name==null) { 37 return null; 38 } 39 Evaluator eval=null; 40 if (name.equals(PYTHON_SCRIPT)) { 41 eval=pythonEvaluator; 42 } else if (name.equals(JAVA_LANGUAGE_SCRIPT)) { 43 eval=bshEvaluator; 44 } else if (name.equals(JAVA_SCRIPT)) { 45 eval=jsEvaluator; 46 } 47 return eval; 48 } 49 50 } 51 | Popular Tags |