Standalone usage

Maven Artifact

Usage example

1
2
3
4
5
6
7
8
9
10
11
12
13
14

KevScriptEnginekevs=newKevScriptEngine("https://new-registry.kevoree.org");try{finalStringscript="add node: JavaNode/LATEST/LATEST";finalKevoreeFactoryfactory=newDefaultKevoreeFactory();// a factory to create modelsfinalContainerRootmodel=factory.createContainerRoot();// create an empty modelfactory.root(model);// ignore this but make sure you do it :pkevs.execute(script,model);// in Java, the KevScript engine mutates the given model directlyassert(model.getNodes().get(0).getName().equals("node"));}catch(KevScriptExceptionex){// something went wrong while executing the scriptex.printStackTrace();}

NPM module

1

npm i kevoree-kevscript -S

You will also need tiny-conf & kevoree-commons

Usage example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

constconfig=require('tiny-conf');constKevScript=require('kevoree-kevscript');constLogger=require('kevoree-commons/lib/Logger');constassert=require('assert');// kevoree-kevscript uses tiny-conf under the hood to retrieve// its registry settings, so we have to define them before instantiationconfig.set('registry',{host:'new-registry.kevoree.org',port:443,ssl:true});constkevs=newKevScript(newLogger('KevScript'));constscript='add node: JavascriptNode/LATEST/LATEST';kevs.parse(script,(err,model)=>{if(err){console.error('Something went wrong while executing script',err.message);}else{assert.equal(model.nodes.array[0].name,'node');}});