https://github.com/ow2-proactive/jsr223-scala
JSR223 script engine for Scala
https://github.com/ow2-proactive/jsr223-scala
Last synced: 15 days ago
JSON representation
JSR223 script engine for Scala
- Host: GitHub
- URL: https://github.com/ow2-proactive/jsr223-scala
- Owner: ow2-proactive
- License: agpl-3.0
- Created: 2018-03-15T15:45:09.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-09-06T09:40:26.000Z (over 1 year ago)
- Last Synced: 2025-05-13T11:15:02.062Z (15 days ago)
- Language: Java
- Size: 88.9 KB
- Stars: 0
- Watchers: 10
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsr223-scala
JSR223 script engine for Scala.
## Build
$> ./gradlew clean build
to generate jsr223-scala\build\libs\jsr223-scala-xx.jar
## Usage
This Scala script engine wrapper is discoverable under "scalaw" name
(http://docs.oracle.com/javase/7/docs/technotes/guides/scripting/programmer_guide/index.html).## Bindings
User has access from the scala script to predefined variables, according to the current script context. Here are some of themval result = 123
val loop = 2
val runs = 4
val selected = falseConsidering a simple 2-tasks workflow with task_A -> task_B
// In task_A
variables.put("AA", "aa")
variables.put("BB", Array(1, 2, 3))
variables.put("CC", Map("name" -> "Gromit", "likes" -> "cheese", "id" -> "1234"))
val result = Map(0 -> "abc", 1 -> "def")// In task_B
println(variables.get("AA")) // aa
val arr = variables.get("BB").valueCast[Array[Int]]
println(arr(0)) // 1
println(variables.get("CC").values) // MapLike.DefaultValuesIterable(Gromit, cheese, 1234)
println(variables.get("CC").get("name")) // Some(Gromit)
println(results(0).getValue.get(0)) // Some(abc)