Skip to main content

NS Model Server

The ns-model-server is a tool that provides a REST-ful API to query and update an NS model.

Installation

Download and unpack the zip file with:

mvn dependency:unpack "-Dartifact=net.democritus.model:ns-model-server-cli:RELEASE:zip:bin" "-DoutputDirectory=."

The zip contains a jar and a lib/ directory. Run the jar with java -jar to access the command line interface.

java -jar ns-model-server-cli-1.10.1.jar

Start the server

Start the model server by passing the location of your expansionSettings.xml to the cli:

java -jar ns-model-server-cli-1.10.1.jar -p=8080 --expansion-settings=/c/NSF/workspace/bookApp/conf/expansionSettings.xml
[INFO] Reading model...
[INFO] Model loaded!
[INFO] Creating model endpoints...
[INFO] Started endpoint /model/elements/JeeApplication/bookApp/1.0.0/modules/elements/JeeComponent/utils
[INFO] Started endpoint /model/elements/JeeApplication/bookApp/1.0.0/modules/elements/JeeComponent/account
[INFO] Started endpoint /model/elements/JeeApplication/bookApp/1.0.0/modules/elements/JeeComponent/assets
[INFO] Started endpoint /model/elements/JeeApplication/bookApp/1.0.0/modules/elements/JeeComponent/workflow
[INFO] Started endpoint /model/elements/JeeApplication/bookApp/1.0.0/modules/elements/JeeComponent/notification
[INFO] Started endpoint /model/elements/JeeApplication/bookApp/1.0.0/modules/elements/JeeComponent/books
[INFO] Started endpoint /model/elements/JeeApplication/bookApp/1.0.0
[INFO] Started endpoint /expansion/settings
[INFO] Started endpoint /expansion
[INFO] Started endpoint /sources
[INFO] Model ready

The server should now be accessible at localhost:8080:

curl http://localhost:8080/
{
"links": {
"server status": "/status",
"data": "/data",
"sources": "/sources",
"validate model": "/validations",
"transmute model": "/transmutations",
"profiles": "/profiles",
"model": "/model",
"reload model": "/model/reload",
"logs": "/logs",
"expansion": "/expansion"
},
"server": {
"version": "1.10.1"
}
}