public class ScriptContext
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
ScriptContext.ScriptRunner |
| Modifier and Type | Field and Description |
|---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
| Constructor and Description |
|---|
ScriptContext()
Sets up a script context to be run standalone.
|
ScriptContext(RunningScrapingSession runningScrapingSession)
Sets up a script context using the given running scraping session.
|
| Modifier and Type | Method and Description |
|---|---|
DataRecord |
getDataRecord()
Get the current data record.
|
DataSet |
getDataSet()
Gets the current data set.
|
java.lang.String |
getExtractorPatternName() |
bsh.Interpreter |
getInterpreter()
Gets a reference to the
Interpreter used by BeanShell. |
RunningScrapeableFile |
getRunningScrapeableFile()
Get the current
ScrapeableFile. |
RunningScrapingSession |
getRunningScrapingSession()
Gets the current
RunningScrapingSession. |
Script |
getScript()
Gets the script that should be executed.
|
void |
process()
Processes the script.
|
void |
resetContextVariables()
Rests context variables to null.
|
void |
setCommandLineParams(CommandLineParams commandLineParams)
Set the current command-line parameters.
|
void |
setDataRecord(DataRecord dataRecord)
Sets the current data set.
|
void |
setDataSet(DataSet dataSet)
Sets the current extracted data.
|
void |
setExtractorPatternName(java.lang.String name)
Sets the current extractorPatternName to the given
String. |
void |
setHTTPSession(HTTPSession httpSession)
Set the current
HTTPSession. |
void |
setInterpreter(bsh.Interpreter interpreter)
Sets a reference to the
Interpreter used by BeanShell. |
void |
setRunningHTTPRequest(RunningHTTPRequest httpRequest)
Set the current
HTTPRequest. |
void |
setRunningHTTPResponse(RunningHTTPResponse httpResponse)
Set the current
HTTPResponse. |
void |
setRunningScrapeableFile(RunningScrapeableFile scrapeableFile)
Set the current
ScrapeableFile. |
void |
setScript(Script script)
Sets the script that should be executed.
|
void |
terminate()
Ends the execution of this script pre-maturely.
|
void |
unsetVariables()
Unsets the current variables.
|
public ScriptContext()
public ScriptContext(RunningScrapingSession runningScrapingSession)
runningScrapingSession - The current RunningScrapingSession.@Nullable public Script getScript()
public void setScript(Script script)
script - The script.@Nullable public DataRecord getDataRecord()
DataRecord.public void setDataRecord(DataRecord dataRecord)
dataRecord - The data set.public void setDataSet(DataSet dataSet)
dataSet - The extracted data.@Nullable public RunningScrapingSession getRunningScrapingSession()
RunningScrapingSession.RunningScrapingSession.@Nullable public RunningScrapeableFile getRunningScrapeableFile()
ScrapeableFile.ScrapeableFile.public void setRunningScrapeableFile(RunningScrapeableFile scrapeableFile)
ScrapeableFile.scrapeableFile - The ScrapeableFile.public void setRunningHTTPRequest(RunningHTTPRequest httpRequest)
HTTPRequest.httpRequest - The HTTPRequest.public void setRunningHTTPResponse(RunningHTTPResponse httpResponse)
HTTPResponse.httpResponse - The HTTPResponse.public void setHTTPSession(HTTPSession httpSession)
HTTPSession.httpSession - The HTTPSession.public void setExtractorPatternName(java.lang.String name)
String.name - the name of the extractor pattern.@Nullable public java.lang.String getExtractorPatternName()
public void setCommandLineParams(CommandLineParams commandLineParams)
commandLineParams - The command-line parameters.@Nullable public bsh.Interpreter getInterpreter()
Interpreter used by BeanShell.Interpreter object.public void setInterpreter(bsh.Interpreter interpreter)
Interpreter used by BeanShell.interpreter - An Interpreter object.public void resetContextVariables()
public void terminate()
public void process()
throws ScriptException
ScriptExceptionpublic void unsetVariables()