Hi,
Following this post (
https://groups.google.com/forum/#!topic/aureliusgraphs/HwVggTCLg0Y ), I'm trying to do the same thing. I'm using rexster-protocol 2.6.0.
I have modified rexster-cassandra-es.xml to include the script <init-scripts>scripts/get_or_create.groovy</init-scripts>.
Inside the file, I have the following code:
def getOrCreateNode(g, key, val) {
def p = g.V(key, val)
return p.hasNext() ? p.next() : g.addVertex([key:val])
}
In my java client, I call the method like this:
Map<String, Object> arg = new HashMap<String, Object>();
arg.put("key", "userName");
arg.put("val", "s333333");
List<Object> userV= client.execute("getOrCreateNode(g, key, val);", arg);
I get the following exception:
Exception in thread "main" com.tinkerpop.rexster.client.RexProException: An error occurred while processing the script for language [groovy]. All transactions across all graphs in the session have been concluded with failure: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.getOrCreateNode() is applicable for argument types: (com.thinkaurelius.titan.graphdb.database.StandardTitanGraph, java.lang.String, java.lang.String) values: [titangraph[cassandra:[127.0.0.1]], userName, ...]
at com.tinkerpop.rexster.client.RexsterClient.execute(RexsterClient.java:220)
I restarted rexster after adding the script file.
Can someone please let me know what I'm doing wrong?
Thanks.