|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pig.scripting.ScriptEngine
org.apache.pig.scripting.js.JsScriptEngine
public class JsScriptEngine
ScriptEngine implementation for JavaScript
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.pig.scripting.ScriptEngine |
|---|
ScriptEngine.SupportedScriptLang |
| Field Summary |
|---|
| Fields inherited from class org.apache.pig.scripting.ScriptEngine |
|---|
NAMESPACE_SEPARATOR |
| Constructor Summary | |
|---|---|
JsScriptEngine()
|
|
| Method Summary | |
|---|---|
protected Object |
eval(String expr)
|
static JsScriptEngine |
getInstance()
|
protected Map<String,Object> |
getParamsFromVariables()
Returns a map from local variable names to their values |
protected String |
getScriptingLang()
Gets ScriptEngine classname or keyword for the scripting language |
Object |
jsCall(String functionName,
Object[] passedParams)
call a javascript function |
Object |
jsEval(String name,
Reader scriptReader)
evaluate javascript from a reader |
Object |
jsEval(String name,
String script)
evaluate a javascript String |
org.mozilla.javascript.Scriptable |
jsNewArray(long size)
creates a new javascript array |
org.mozilla.javascript.Scriptable |
jsNewObject()
creates a new JavaScript object |
void |
jsPut(String name,
Object value)
put a value in the current scope |
protected void |
load(String name,
InputStream script)
|
protected Map<String,List<PigStats>> |
main(PigContext pigContext,
String scriptFile)
Actually runs the script file. |
void |
registerFunctions(String path,
String namespace,
PigContext pigContext)
Registers scripting language functions as Pig functions with given namespace |
| Methods inherited from class org.apache.pig.scripting.ScriptEngine |
|---|
getInstance, getJarPath, getPigStatsMap, getScriptAsStream, getSupportedScriptLang, run |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JsScriptEngine()
| Method Detail |
|---|
public static JsScriptEngine getInstance()
public Object jsEval(String name,
String script)
name - the name of the script (for error messages)script - the content of the script
public Object jsEval(String name,
Reader scriptReader)
name - the name of the script (for error messages)scriptReader - the content of the script
public void jsPut(String name,
Object value)
name - the name of the variablevalue - its value
public Object jsCall(String functionName,
Object[] passedParams)
functionName - the name of the functionpassedParams - the parameters to pass
public org.mozilla.javascript.Scriptable jsNewObject()
public org.mozilla.javascript.Scriptable jsNewArray(long size)
size - the size of the array
protected Object eval(String expr)
protected void load(String name,
InputStream script)
protected Map<String,List<PigStats>> main(PigContext pigContext,
String scriptFile)
throws IOException
ScriptEngine
main in class ScriptEnginepigContext - ScriptPigContext to run the script filescriptFile - the file
IOException
public void registerFunctions(String path,
String namespace,
PigContext pigContext)
throws IOException
ScriptEngine
registerFunctions in class ScriptEnginepath - path of the scriptnamespace - namespace for the functionspigContext - pigcontext to register functions to pig in the given namespace
IOException
protected Map<String,Object> getParamsFromVariables()
throws IOException
ScriptEngine
getParamsFromVariables in class ScriptEngineIOExceptionprotected String getScriptingLang()
ScriptEngine
getScriptingLang in class ScriptEngine
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||