Integrate functionality of scripting languages with these modules for the invesdwin-context module system. There are multiple runtime modules provided for each scripting language with a unified bidirectional communication capability. That way you can switch the runtime provider without having to change your script implementation. See test cases for examples on how to implement your script integrations.
Releases and snapshots are deployed to this maven repository:
https://invesdwin.de/repo/invesdwin-oss-remote/
Dependency declaration:
<dependency>
<groupId>de.invesdwin</groupId>
<artifactId>invesdwin-scripting-runtime-javascript</artifactId>
<version>1.0.3</version><!---project.version.invesdwin-scripting-parent-->
</dependency>
This repository contains the following scripting modules for JVM languages:
- invesdwin-scripting-runtime-clojure: this is an integration for Clojure. It contains an improved JSR-223 provider that supports isolated namespaces per thread, the ability to remove/clear bindings and reusing compiled scripts.
- invesdwin-scripting-runtime-groovy: this is an integration for Groovy. This is the most popular and fastest binding for java like scripts. JSR-223 is also supported. The threadlocal
GroovyProperties.setStrictOverride(true)
or globalGroovyProperties.setDefaultStrict(true)
can be used to switch to a faster but more strict groovy variant that uses@CompileStatic
and@TypeChecked
from the outside. Though it is also possible to define such optimized functions inside of scripts. - invesdwin-scripting-runtime-beanshell: this is an integration for Beanshell. It provides some simplifications for java based scripts. Support for JSR-223 is also available.
- invesdwin-scripting-runtime-jshell: this is an integration for JShell via JSR-223. It provides the purest java syntax, but is rather slow. For pure Java the Janino compiler might be preferable.
- invesdwin-scripting-runtime-kotlin: this is an integration for Kotlin. It will use kotlin-main-kts if that is present on the classpath. Otherwise it will use the default JSR-223 engine.
- invesdwin-scripting-runtime-scala: this is an integration for Scala via JSR-223.
- invesdwin-scripting-runtime-(jruby|truffleruby): this is an integration for JRuby and TruffleRuby via JSR-223.
- invesdwin-scripting-runtime-javascript: this is an integration for Javascript via JSR-223. It uses GraalJS if present on the classpath with a fallback to Nashorn (only available until Java 14).
- invesdwin-scripting-runtime-mvel: this is an integration for MVEL via JSR-223.
All scripting modules provide unified bidirectional communication between Java and the respective scripting language. See test cases for examples on how to implement your script integrations. Examples are available in the respective testcases of the modules or the separate project repos.
There are also more elaborate integrations available for other languages:
- R Modules: Scripting with R
- Python Modules: Scripting with Python
- Matlab/Octave/Scilab Modules: Scripting with Matlab, Octave and Scilab
- Julia Modules: Scripting with Julia
- Haskell Modules: Scripting with Haskell
If you want to use this project without the overhead of having to initialize a invesdwin-context bootstrap with its spring-context and module configuration, you can disable the bootstrap with the following code before using any scripts:
de.invesdwin.context.PlatformInitializerProperties.setAllowed(false);
The above configuration options for the invidiual runtimes can still be provided by setting system properties before calling any script. An example for all of this can be found at: ScriptingWithoutBootstrapMain.java
If you need further assistance or have some ideas for improvements and don't want to create an issue here on github, feel free to start a discussion in our invesdwin-platform mailing list.