Rev 451 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/****/package in.shop2020.util;import java.util.Properties;import org.python.util.PythonInterpreter;/*** Wrapper around work done by Jython scripts** @author naveen**/public class JythonWrapper {static{Properties preProps = System.getProperties();Properties postProps = new Properties();//props.setProperty("python.home","PYTHONPATH");postProps.setProperty("python.path",Utils.JYTHON_SRC_PATH+"/comparisonrules:"+Utils.JYTHON_SRC_PATH+"/irdatarules:"+Utils.JYTHON_SRC_PATH+"/irmetadatarules:"+Utils.JYTHON_SRC_PATH+"/common:"+Utils.JYTHON_SRC_PATH+"/normalizationrules"+":/home/rajveer/31July/PyProj/src"+":/usr/local/lib/python2.6/dist-packages"+":/usr/lib/python2.6"+":/usr/bin/python2.6"+":/usr/include/python2.6");PythonInterpreter.initialize(preProps,postProps,new String[0]);}/*** Private Python interpreter instance*/protected PythonInterpreter py = null;/*** Initialises PythonInterpreter instance*/public void initialize() {if(this.py == null) {this.py = new PythonInterpreter();}}/*** Resets current PythonInterpreter instance*/public void reset() {this.py = null;}/*** Executes Jython script given absolute path** @param filename*/public void exec(String filename) {this.initialize();this.py.execfile(filename);}}