Hi,
My day job is mostly server-side JS using Nashorn.
I noticed that there are native wrappers for groovy/scala but there does not seem to be a native wrapper for Nashorn, So, I started working on one for my own purposes. Do you think this is something the larger community would be interested in?
The goal is a light JS/Nashorn wrapper with a streamlined API suitable for scripting environments and server-side script. No extra jars are necessary, just include a single JS script the top of your nashorn file. Here is an example script:
load("OrientDB_Doc.js");
odb = new ODB();
// opens a DB pool
odb.openDB("plocal:/orientDB/databases/myTest", "admin", "admin");
odb.execute("insert into Person (name, age) VALUES ('George Washington', 67)");
// returns native JS code
r = odb.select("select * from Person");
r.forEach(function (obj) {
println(obj.name + " " + obj.age);
});
odb.closePool();
The benefit of using a script like this is the user does not need to worry themselves with the complicated Types that OrientDB has (IMHO). And the functions (by default, but optionally) return native JS objects instead of ODocuments, which is eaiser to deal with in Nashorn.
The Doc API is almost done, and later I can make the graph API. Let me know if this is something that the community might want... or perhaps it is already done I just did not see it.
Best,
-Adam