|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.scripting.ScriptEngine
public abstract class ScriptEngine
Base class for various scripting implementations
Nested Class Summary | |
---|---|
static class |
ScriptEngine.SupportedScriptLang
|
Field Summary | |
---|---|
static String |
NAMESPACE_SEPARATOR
|
Constructor Summary | |
---|---|
ScriptEngine()
|
Method Summary | |
---|---|
static ScriptEngine |
getInstance(String scriptingLang)
Gets instance of the scriptEngine for the given scripting language |
static String |
getJarPath(Class<?> clazz)
Figures out the jar location from the class |
protected abstract Map<String,Object> |
getParamsFromVariables()
Returns a map from local variable names to their values |
protected Map<String,List<PigStats>> |
getPigStatsMap()
Gets the collection of PigStats after the script is run. |
protected static InputStream |
getScriptAsStream(String scriptPath)
open a stream load a script locally or in the classpath |
protected abstract String |
getScriptingLang()
Gets ScriptEngine classname or keyword for the scripting language |
static ScriptEngine.SupportedScriptLang |
getSupportedScriptLang(String file)
|
protected abstract Map<String,List<PigStats>> |
main(PigContext context,
String scriptFile)
Actually runs the script file. |
abstract void |
registerFunctions(String path,
String namespace,
PigContext pigContext)
Registers scripting language functions as Pig functions with given namespace |
Map<String,List<PigStats>> |
run(PigContext pigContext,
String scriptFile)
Runs a script file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NAMESPACE_SEPARATOR
Constructor Detail |
---|
public ScriptEngine()
Method Detail |
---|
protected static InputStream getScriptAsStream(String scriptPath)
scriptPath
- the path of the script
IllegalStateException
- if we could not open a streampublic static ScriptEngine.SupportedScriptLang getSupportedScriptLang(String file) throws IOException
file
- the file to inspect
IOException
- if there was an error reading the file or if the file defines explicitly an unknown #!public abstract void registerFunctions(String path, String namespace, PigContext pigContext) throws IOException
path
- path of the scriptnamespace
- namespace for the functionspigContext
- pigcontext to register functions to pig in the given namespace
IOException
protected abstract Map<String,List<PigStats>> main(PigContext context, String scriptFile) throws IOException
context
- ScriptPigContext
to run the script filescriptFile
- the file
IOException
protected abstract String getScriptingLang()
protected abstract Map<String,Object> getParamsFromVariables() throws IOException
IOException
public static String getJarPath(Class<?> clazz) throws FileNotFoundException
clazz
- class in the jar file
FileNotFoundException
public static ScriptEngine getInstance(String scriptingLang) throws IOException
scriptingLang
- ScriptEngine classname or keyword for the scriptingLang
IOException
public Map<String,List<PigStats>> run(PigContext pigContext, String scriptFile) throws ExecException, IOException
pigContext
- PigContext
to run the script filescriptFile
- the file
PigStats
objects. One for each runtime
instance of Pig
in the script. For named pipelines, the
map key is the name of the pipeline. For unnamed pipeline, the map key
is the script id associated with the instance.
ExecException
IOException
protected Map<String,List<PigStats>> getPigStatsMap()
PigStats
after the script is run.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |