Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
58 naveen 1
/**
2
 * 
3
 */
4
package in.shop2020.util;
5
 
6
import java.util.List;
7
 
8
import org.python.core.PyList;
9
import org.python.core.PyObject;
10
import org.python.util.PythonInterpreter;
11
 
12
/**
13
 * @author naveen
14
 *
15
 */
16
public class JythonWrapper {
17
 
18
	/**
19
	 * Jython source path
20
	 */
21
	public static String JYTHON_SRC_PATH = "src/jython/";
22
 
23
	/**
24
	 * Private Python interpreter instance
25
	 */
26
	private PythonInterpreter py = null;
27
 
28
	/**
29
	 * Executes Jython script given absolute path
30
	 * 
31
	 * @param filename
32
	 */
33
	public void exec(String filename) {
34
		if(this.py == null) {
35
			this.py = new PythonInterpreter();
36
		}
37
 
38
		this.py.execfile(filename);
39
	}
40
 
41
	/**
42
	 * 
43
	 * @return
44
	 */
45
	@SuppressWarnings("unchecked")
46
	public List getValues() {
47
		PyObject values = this.py.get("values");
48
 
49
		return (PyList)values;
50
	}
51
}