Improve docs for GraalVM Polyglot dependencies
* Deprecate `jython` language indicator since only GraalVM Polyglot is there from now on
This commit is contained in:
@@ -19,6 +19,9 @@ package org.springframework.integration.scripting.jsr223;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.integration.scripting.PolyglotScriptExecutor;
|
||||
import org.springframework.integration.scripting.ScriptExecutor;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -33,8 +36,17 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public final class ScriptExecutorFactory {
|
||||
|
||||
private static final Log LOGGER = LogFactory.getLog(ScriptExecutorFactory.class);
|
||||
|
||||
public static ScriptExecutor getScriptExecutor(String language) {
|
||||
if (language.equalsIgnoreCase("python") || language.equalsIgnoreCase("jython")) {
|
||||
if (language.equalsIgnoreCase("jython")) {
|
||||
LOGGER.warn("""
|
||||
The 'jython' language indicator is deprecated and will be removed in the next version.
|
||||
The Python support is fully based on GraalVM Polyglot and there is no 'jython' dependency requirement any more.
|
||||
""");
|
||||
return new PolyglotScriptExecutor("python");
|
||||
}
|
||||
else if (language.equalsIgnoreCase("python")) {
|
||||
return new PolyglotScriptExecutor("python");
|
||||
}
|
||||
else if (language.equalsIgnoreCase("ruby") || language.equalsIgnoreCase("jruby")) {
|
||||
|
||||
@@ -296,10 +296,13 @@ They are mutually exclusive.
|
||||
Starting with version 6.0, the framework provides a `PolyglotScriptExecutor` which is based the https://www.graalvm.org/latest/reference-manual/languages/[GraalVM Polyglot API].
|
||||
The JSR223 engine implementation for JavaScript, removed from Java by itself, has been replaced by using this new script executor.
|
||||
See more information about enabling JavaScript support in GraalVM and what https://www.graalvm.org/latest/reference-manual/js/[configuration options] can be propagated via script variables.
|
||||
In particular, an `org.graalvm.polyglot:js` dependency has to be added to the target project to support JavaScript.
|
||||
|
||||
|
||||
Starting with version 6.4, the Python scripts support has been migrated to GraalVM Polyglot as well.
|
||||
Now these scripts can be written in Python 3.x and can use third-party libraries.
|
||||
See https://www.graalvm.org/latest/reference-manual/python/[GraalPy] documentation for more information.
|
||||
In particular, an `rg.graalvm.polyglot:python` dependency has to be added to the target project to support JavaScript.
|
||||
|
||||
By default, the framework sets `allowAllAccess` to `true` on the shared Polyglot `Context` which enables this interaction with host JVM:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user