public interface RunningScrapingSession
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
Modifier and Type | Method and Description |
---|---|
void |
addToNumDuplicateRecordsScraped(int numRecordsScraped)
Adds to the number of duplicate records scraped.
|
void |
addToNumErrorRecordsScraped(int numRecordsScraped)
Adds to the number of error records scraped.
|
void |
addToNumNewRecordsScraped(int numRecordsScraped)
Adds to the number of new records scraped.
|
void |
addToNumRecordsScraped(int numRecordsScraped)
Adds to the number of records scraped.
|
void |
addToNumRecordsScraped(java.lang.Object numRecordsScraped)
Adds to the number of records scraped.
|
void |
addToNumUpdatedRecordsScraped(int numRecordsScraped)
Adds to the number of updated records scraped.
|
void |
addToVariable(java.lang.String variable,
int value)
Adds a value to a session variable.
|
void |
breakpoint()
Performs a breakpoint.
|
void |
clearCookies()
Clears all cookies.
|
boolean |
downloadFile(java.lang.String urlString,
java.lang.String fileName)
A utility method for downloading a resource and writing it to a file.
|
void |
executeScript(java.lang.String scriptName)
Executes the named script.
|
long |
getElapsedRunningTime()
Gets the number of milliseconds that have passed since the scraping session started.
|
java.lang.String |
getErrorMessage()
Gets the error message that should be persisted to the database once the scraping session ends.
|
boolean |
getFatalErrorOccurred()
Gets the flag used to indicate whether or not a fatal error occurred while running this scraping session.
|
int |
getNumDuplicateRecordsScraped()
Gets the number of duplicate records scraped for the primary data set corresponding to this scraping session.
|
int |
getNumErrorRecordsScraped()
Gets the number of error records scraped for the primary data set corresponding to this scraping session.
|
int |
getNumNewRecordsScraped()
Gets the number of new records scraped for the primary data set corresponding to this scraping session.
|
int |
getNumRecordsScraped()
Gets the number of records scraped for the primary data set corresponding to this scraping session.
|
int |
getNumScriptsOnStack()
Gets the number of
ScriptContext objects on the stack. |
int |
getNumUpdatedRecordsScraped()
Gets the number of duplicate records scraped for the primary data set corresponding to this scraping session.
|
ScrapingSessionNotifiable |
getScrapingSessionNotifiable()
Gets the object the scraping session will use to notify its progress of.
|
java.lang.Object |
getVariable(java.lang.String variable)
Gets the value of a session variable.
|
void |
log(java.lang.Object message)
Logs a message for the session
|
void |
logCurrentDateAndTime()
Logs the current date and time.
|
void |
logCurrentTime()
Logs the current time.
|
void |
logElapsedRunningTime()
Logs the number of days, hours, minutes, and seconds from the time the scraping session started.
|
void |
pause(long time)
Indicates that the scraping session should pause for the given number of milliseconds.
|
void |
popScriptContext()
Pops the top
ScriptContext object off the stack. |
void |
pushScriptContext(ScriptContext scriptContext)
Pushes a
ScriptContext object on to the stack. |
void |
saveVariables(java.lang.String fileToSaveTo)
Writes out the current session variables to a file.
|
void |
scrapeFile(java.lang.String scrapeableFileIdentifier)
Queues up a
ScrapeableFile to be scraped. |
void |
sendDataToClient(java.lang.String key,
java.lang.Object value)
Queues up an element of data to be sent to a client.
|
void |
sendMail(java.lang.String subject,
java.lang.String body,
java.lang.String recipients,
java.lang.String attachments,
java.lang.String headers)
Sends mail to a pre-specified SMTP server.
|
void |
setCookie(java.lang.String domain,
java.lang.String name,
java.lang.String value)
Allows a cookie to be set in the current session state.
|
void |
setErrorMessage(java.lang.String errorMessage)
Sets the error message that should be persisted to the database once the scraping session ends.
|
void |
setFatalErrorOccurred(boolean fatalErrorOccurred)
Sets the flag used to indicate whether or not a fatal error occurred while running this scraping session.
|
void |
setNumDuplicateRecordsScraped(int numRecordsScraped)
Sets the number of duplicate records scraped.
|
void |
setNumErrorRecordsScraped(int numRecordsScraped)
Sets the number of error records scraped.
|
void |
setNumNewRecordsScraped(int numRecordsScraped)
Sets the number of new records scraped.
|
void |
setNumRecordsScraped(int numRecordsScraped)
Sets the number of records scraped for the primary data set corresponding to this scraping session.
|
void |
setNumRecordsScraped(java.lang.Object numRecordsScraped)
Sets the number of records scraped for the primary data set corresponding to this scraping session.
|
void |
setNumUpdatedRecordsScraped(int numRecordsScraped)
Sets the number of duplicate records scraped.
|
void |
setVariable(java.lang.String variable,
java.lang.Object value)
Sets the value of a session variable
|
void |
stopScraping()
Indicates that the scraping session should stop scraping as soon as possible.
|
void |
stopScraping(StopScrapingCallType callType,
java.lang.String explanation)
Indicates that the scraping session should stop scraping as soon as possible.
|
void |
terminateAllAnonymousProxies()
Stops all of the currently running proxy instances
|
@Nullable java.lang.Object getVariable(java.lang.String variable)
variable
- The name of the variablevoid setVariable(@NotNull java.lang.String variable, @Nullable java.lang.Object value)
variable
- The variable.value
- The value of the variable.void addToVariable(java.lang.String variable, int value) throws java.lang.Exception
variable
- The name of the session variable.value
- The value to add.java.lang.Exception
void scrapeFile(java.lang.String scrapeableFileIdentifier) throws java.lang.Exception
ScrapeableFile
to be scraped.scrapeableFileIdentifier
- The identifier of the file to be scraped.java.lang.Exception
void stopScraping()
void stopScraping(@NotNull StopScrapingCallType callType, @Nullable java.lang.String explanation)
callType
- The type of stop being issuedexplanation
- An explanation string for the stopvoid log(java.lang.Object message)
message
- The message to be logged.void pause(long time) throws java.lang.Exception
time
- The amount of time to pause, in milliseconds.java.lang.Exception
boolean downloadFile(java.lang.String urlString, java.lang.String fileName) throws java.lang.Exception
urlString
- The Uniform Resource Locator of the resource.fileName
- The full path that the downloaded resource should be written to. Example "C:\\downloaded.gif". The "\" character should be included in
the
path twice for each instance of it's use in order for it to be not treated as an escape character.java.lang.Exception
void breakpoint() throws java.lang.Exception
java.lang.Exception
void sendMail(java.lang.String subject, java.lang.String body, java.lang.String recipients, java.lang.String attachments, java.lang.String headers) throws java.lang.Exception
subject
- The subject line of the e-mail.body
- The text of the body of the e-mail.recipients
- A comma separated list of recipients.attachments
- A comma separated list of local files to be attached.headers
- Additional headers one would like to add to the e-mail.java.lang.Exception
void saveVariables(java.lang.String fileToSaveTo) throws java.lang.Exception
fileToSaveTo
- The file to save the variables to.java.lang.Exception
void setCookie(java.lang.String domain, java.lang.String name, java.lang.String value) throws java.lang.Exception
domain
- The domain of the cookie.name
- The name of the cookie.value
- The value the cookie should hold.java.lang.Exception
void clearCookies() throws java.lang.Exception
java.lang.Exception
void executeScript(java.lang.String scriptName) throws java.lang.Exception
scriptName
- The name of the script to execute.java.lang.Exception
void setNumRecordsScraped(java.lang.Object numRecordsScraped) throws java.lang.Exception
numRecordsScraped
- The number of records scraped.java.lang.Exception
void addToNumRecordsScraped(java.lang.Object numRecordsScraped) throws java.lang.Exception
numRecordsScraped
- The number of records to add.java.lang.Exception
void addToNumRecordsScraped(int numRecordsScraped) throws java.lang.Exception
numRecordsScraped
- The number of records scraped.java.lang.Exception
void addToNumNewRecordsScraped(int numRecordsScraped)
numRecordsScraped
- The number of new records scraped to add.void addToNumDuplicateRecordsScraped(int numRecordsScraped)
numRecordsScraped
- The number of duplicate records scraped to add.void addToNumUpdatedRecordsScraped(int numRecordsScraped)
numRecordsScraped
- The number of updated records scraped to add.void addToNumErrorRecordsScraped(int numRecordsScraped)
numRecordsScraped
- The number of error records scraped to add.void setNumRecordsScraped(int numRecordsScraped) throws java.lang.Exception
numRecordsScraped
- The number of records scraped.java.lang.Exception
boolean getFatalErrorOccurred() throws java.lang.Exception
java.lang.Exception
void setFatalErrorOccurred(boolean fatalErrorOccurred) throws java.lang.Exception
fatalErrorOccurred
- A boolean.java.lang.Exception
@NotNull java.lang.String getErrorMessage() throws java.lang.Exception
java.lang.Exception
void setErrorMessage(java.lang.String errorMessage) throws java.lang.Exception
errorMessage
- The error message to set.java.lang.Exception
long getElapsedRunningTime() throws java.lang.Exception
java.lang.Exception
void logElapsedRunningTime() throws java.lang.Exception
java.lang.Exception
void logCurrentTime() throws java.lang.Exception
java.lang.Exception
void logCurrentDateAndTime() throws java.lang.Exception
java.lang.Exception
int getNumRecordsScraped() throws java.lang.Exception
java.lang.Exception
void setNumNewRecordsScraped(int numRecordsScraped) throws java.lang.Exception
numRecordsScraped
- The number of new records scraped.java.lang.Exception
void setNumDuplicateRecordsScraped(int numRecordsScraped) throws java.lang.Exception
numRecordsScraped
- The number of duplicate records scraped.java.lang.Exception
void setNumUpdatedRecordsScraped(int numRecordsScraped) throws java.lang.Exception
numRecordsScraped
- The number of duplicate records scraped.java.lang.Exception
void setNumErrorRecordsScraped(int numRecordsScraped) throws java.lang.Exception
numRecordsScraped
- The number of error records scraped.java.lang.Exception
int getNumNewRecordsScraped() throws java.lang.Exception
java.lang.Exception
int getNumDuplicateRecordsScraped() throws java.lang.Exception
java.lang.Exception
int getNumUpdatedRecordsScraped() throws java.lang.Exception
java.lang.Exception
int getNumErrorRecordsScraped() throws java.lang.Exception
java.lang.Exception
void sendDataToClient(java.lang.String key, java.lang.Object value) throws java.lang.Exception
key
- The key identifier of the data.value
- The value portion of the data.java.lang.Exception
void terminateAllAnonymousProxies() throws java.lang.Exception
java.lang.Exception
void pushScriptContext(ScriptContext scriptContext)
ScriptContext
object on to the stack.scriptContext
- A ScriptContext
object.void popScriptContext()
ScriptContext
object off the stack.int getNumScriptsOnStack()
ScriptContext
objects on the stack.@Nullable ScrapingSessionNotifiable getScrapingSessionNotifiable()