Script UPoC Java Embedded Python

Java Embedded Python (JEP) support is in Cloverleaf UPoC. To use JEP, you must have the latest Python3.x installed on your machine.

The JEP package is located in $HCIROOT/python/jep.

Note: Python2.x UPoC is implemented with Jython.

On AIX machines, Cloverleaf is 32-bit. For this platform, you must install 32-bit Python3.x for JEP.

Note: On Windows, you must run the Python installer as "administrator".

JEP embeds CPython in Java through the Java Native Interface (JNI).

The benefits of embedding CPython in a JVM include:

  • Using the built-in (native) Python interpreter may be much faster than alternatives.
  • Python is mature, well supported, and well documented.
  • Access to high quality Python modules, both built-in CPython extensions and Python-based.
  • Compilers and assorted Python tools are as mature as the language.
  • Python is an interpreted language, enabling scripting of established Java code without requiring recompilation.
  • Both Java and Python are cross platform, enabling deployment to different operating systems.

The configuration for JEP UPoC is the same as JavaScript and Jython UPoC.

Java UPoC configurations use these formats.

Note: {{key> <value}...}" are optional arguments provided by the user.
  • TPS:
    { PROCS cljTPS }
    { ARGS {{{CLASS class_name} {key value} …}} }
  • TrxID:
    { PROC {cljTrxid {{CLASS ScriptTrxid}}} }
    { ARGS {{{key value} …}} }
  • Xlate:
    cljXLTStrings {XLT_STYLE SINGLE} {CLASS class_name} {key 
    value} …

LANG, FILE and FUNC, and SCRIPT keys

For JEP UPoC, the LANG, FILE, and FUNC keys, or SCRIPT are the same as other script languages. For example, javascript and jython.

Key Description
LANG

Case-insensitive scripting language name.

For Python JEP, the language is “jep”.

FILE

A bare file name without a directory. For example, basename.

The file is searched for in the scripts subdirectories, under the current site, master site, and root directories.

For JavaScript, the file names must have a .js extension.

For Python, the extension is .py.

FUNC

Function name.

SCRIPT

Code snippet which is input directly as an argument.