All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hmsonline.virgil.mapreduce.JavascriptInvoker Maven / Gradle / Ivy

The newest version!
package com.hmsonline.virgil.mapreduce;

import java.util.Map;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class JavascriptInvoker {

	public static synchronized String[][] invokeMap(String script, String rowKey, Map columns)
			throws ScriptException {
		ScriptEngineManager manager = new ScriptEngineManager();
		ScriptEngine jsEngine = manager.getEngineByExtension("js");
		//String value = (String) jsEngine.getFactory().getParameter("THREADING");
		//Compilable jsCompile = (Compilable) jsEngine;
		//CompiledScript run = jsCompile.compile(script);

		jsEngine.eval(script);
		jsEngine.put("rowKey", "foo");
		jsEngine.put("columns", columns);
		jsEngine.eval("map(rowKey, columns)");
		return null;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy