Luca,

Sure I will contribute a PR (hopefully in a few days, a little displaced 
right now from the hurricane). 

Regarding protecting certain calls, I have never done this myself, but I 
think it can be done with a ClassFilter.  
https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/api.html#classfilter_introduction

You can pass the the ClassFilter to the engine, and control which classes 
are visible to the script engine, I will see if I can create an example 
that restricts System.exit().

-Adam




On Tuesday, September 12, 2017 at 10:01:22 AM UTC-4, l.garulli wrote:
>
> Hi Adam,
>
> I think this is very interesting, especially for our JS Functions. Would 
> you like to contribute with a PR?
>
> By the way, have you found a way to protect the user to call things like 
> System.exit()?
>
> Best Regards,
>
> Luca Garulli
> Founder & CEO
> OrientDB LTD <http://orientdb.com/>
>
> On 12 September 2017 at 03:12, <[email protected] <javascript:>> wrote:
>
>> 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
>>
>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OrientDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to