Search code examples
javascriptjythonrhinomaximo

What programming language is this Maximo automation script written in?


I'm trying to teach myself Maximo automation scripting.

I've come across a script in the Maximo help. I want to try to understand how it works.

But first, what programming language is it written in?

service.log("I want to multiply 2 numbers and log the result")
from java.util import HashMap
a=3
b=2
ctx = HashMap()
ctx.put("x",a)
ctx.put("y",b)
service.invokeScript("MULTIPLY",ctx)
service.log("the result is "+str(ctx.get("z")))

Edit:

I've found a similar-looking script that is labelled as being JS (download PDF):

importPackage(java.util)
importPackage(Packages.psdi.server)
var ctx = new HashMap();
ctx.put("url","http://localhost:7001/maximo/oslc/script/countryapi?_lid=wilson&_lpwd=wilson");
service.invokeScript("LIB_HTTPCLIENT",ctx);
var jsonResp = ctx.get("response");
var countries = JSON.parse(jsonResp);

However, it has semicolons at the end of each line, whereas the first script does not.

I don't know if that helps or not.


Solution

  • From the docs:

    The source code must be written in the languages that are supported by the following script engines:

    • Mozilla Rhino, version 1.6 release 2
    • Jython, version 2.5.2

    Your first snippet looks like Jython. The second looks like Javascript (Rhino).