Interface IScript


public interface IScript
Interface for client scripts run by a JEB client, such as the GUI client. Scripts should be designed to achieve compact operations, within a client context. Scripts have access to parts of the client context, exposed via IClientContext and sub-interfaces.

Unlike plugins, scripts should be started on the client's main thread. In the case of the GUI desktop client, they are executed on the main UI thread. Care should be taken to not block the main thread for extended periods of time. Long operations should take place on separately spawned worker threads. Jython script runner: Most client scripts are written using the Python 2.7 syntax, and run using Jython. Those scripts have full access to the JEB API.

 # SampleScript.py (extends IScript, will be run by Jython)
 from com.pnfsoftware.jeb.client.api import IScript

 class SampleScript(IScript):
   def run(self, ctx):
     print('Hello, JEB')
 
JEP script runner: Scripts may also be written using modern Python 3. In this case, Java Embedded Python (JEP, do not confuse it with JEB!) is used to interface with CPython installed on your system. (Make sure to pip install jep, and have $PYTHONHOME defined.)
 # SampleScript.py (does not explicitly extend IScript, will be run by JEP/CPython)

 class SampleScript:
   def run(self, ctx):
     print('Hello, JEB')
 
Note: JEP offers the major advantages of writing modern Python code, with the libraries of your choosing. The drawback is that JEP cannot extend JEB types. For this reason, those scripts should be reasonably simple (and, for instance, cannot be used to write JEB plugins.) As a general rule, complex extensions should be written in Java or compiled to Java bytecode to run natively within JEB.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Execute the script entry-point method.