org.dawb.common.python
Class Python

java.lang.Object
  extended by org.dawb.common.python.Python

public class Python
extends java.lang.Object

Class deals with calling python jobs on any thread to the same interpreter. This class contains a single thread which is running and the class can be used inside or outside the eclipse framework.

Author:
gerring

Constructor Summary
Python()
           
 
Method Summary
static void asyncExec(PythonCommand command)
          Run a python command in the current interpreter.
static void execInThread(PythonCommand cmd)
          Starts a specific thread for the jepp instance to use
static boolean isActive()
           
static void runCommand(PythonCommand cmd)
          Run using a new Jepp in the current thead.
static void syncExec(PythonCommand command)
          Run a python command in the current interpreter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Python

public Python()
Method Detail

syncExec

public static void syncExec(PythonCommand command)
                     throws java.lang.IllegalStateException,
                            java.lang.InterruptedException
Run a python command in the current interpreter. This method is synchronized to ensure that more than one Jep cannot be created. NOTE: It returns after the command returns but if the command starts a new thread in Python, the method will obviously return. If you are starting a new thread from your python script see the class EDJob which manages doing this.

Parameters:
command -
Throws:
java.lang.IllegalStateException
java.lang.InterruptedException

asyncExec

public static void asyncExec(PythonCommand command)
                      throws java.lang.IllegalStateException,
                             java.lang.InterruptedException
Run a python command in the current interpreter. This method is synchronized to ensure that more than one Jep cannot be created.

Parameters:
command -
Throws:
java.lang.IllegalStateException
java.lang.InterruptedException

runCommand

public static void runCommand(PythonCommand cmd)
                       throws jep.JepException
Run using a new Jepp in the current thead.

Parameters:
cmd -
Throws:
jep.JepException

isActive

public static boolean isActive()

execInThread

public static void execInThread(PythonCommand cmd)
                         throws java.lang.InterruptedException
Starts a specific thread for the jepp instance to use

Parameters:
pythonCommand -
Throws:
java.lang.InterruptedException