public class RemoteScrapingSession
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
| Constructor and Description |
|---|
RemoteScrapingSession(java.lang.String name)
Generates a new remote session with the given name using the default settings.
|
RemoteScrapingSession(java.lang.String host,
int port)
Generates a new remote session without a session name.
|
RemoteScrapingSession(java.lang.String name,
java.lang.String host,
int port)
Generates a new remote session with the given name using the given settings.
|
RemoteScrapingSession(java.lang.String name,
java.lang.String host,
int port,
int timeout)
Generates a new remote session with the given name using the given settings.
|
RemoteScrapingSession(java.lang.String name,
java.lang.String host,
int port,
int timeout,
java.lang.String characterSet)
Generates a new remote session with the given name using the given settings.
|
RemoteScrapingSession(java.lang.String name,
java.lang.String host,
int port,
java.lang.String characterSet)
Generates a new remote session with the given name using the given settings.
|
| Modifier and Type | Method and Description |
|---|---|
void |
disconnect()
Disconnects from the remote server and cleans up.
|
void |
doHotSwapFromDatabase()
Indicates that a database hot swap needs to be performed.
|
java.lang.String |
getCharacterSet()
Gets the character set to use.
|
DataReceiver |
getDataReceiver()
Gets a reference to the
DataReceiver object. |
DataRecord |
getDataRecordFromDataSet(java.lang.String dataSetName,
int index)
Gets the value of a data record found in a data set from the remote scraping session.
|
DataRecord |
getNextCachedDataRecord(java.lang.String dataSetName)
Gets the next data record from the given cached data set.
|
DataSet |
getNextCachedDataRecords(java.lang.String dataSetName,
int numRecordsToRetrive)
Gets a
DataSet containing up to the given number of records from a cached DataSet. |
int |
getNumDataRecordsInDataSet(java.lang.String dataSetName)
Gets the number of data records found in a data set.
|
int |
getPollFrequency()
Gets the frequency with which screen-scraper should be polled for data.
|
java.lang.Object |
getVariable(java.lang.String varName)
Gets the value of a variable from the remote scraping session.
|
static java.lang.String |
getVersion()
Gets the version of the driver.
|
void |
loadVariables(java.lang.String fileToReadFrom)
Reads in and loads the session variables that was previously saved to a file.
|
void |
scrape()
Tells the remote scraping session to scrape.
|
boolean |
sessionTimedOut()
Indicates whether or not the session timed out.
|
void |
setDataReceiver(DataReceiver dataReceiver)
Sets the
DataReceiver to be used. |
void |
setDoLazyScrape(boolean doLazyScrape)
Indicates whether or not a lazy scrape should be done on the session.
|
void |
setOutputLogFiles(boolean outputLogFiles)
Indicates whether or not log files should be output.
|
void |
setPollFrequency(int pollFrequency)
Sets the frequency in seconds with which screen-scraper should be polled for data.
|
void |
setTimeout(int timeout)
Sets the timeout, in minutes, for the scraping session.
|
void |
setVariable(java.lang.String varName,
java.lang.Object value)
Sets a session variable on the remote scraping session.
|
void |
setVariable(java.lang.String varName,
java.lang.String value)
Sets a session variable on the remote scraping session.
|
void |
stopServer()
Tells the server to stop.
|
public RemoteScrapingSession(java.lang.String name)
throws RemoteScrapingSessionException,
java.net.UnknownHostException,
java.io.IOException
name - The name of the scraping session.RemoteScrapingSessionExceptionjava.net.UnknownHostExceptionjava.io.IOExceptionpublic RemoteScrapingSession(java.lang.String name,
@NotNull
java.lang.String host,
int port)
throws RemoteScrapingSessionException,
java.net.UnknownHostException,
java.io.IOException
name - The name of the scraping session.host - The host the client should try to connect to.port - The port the client should try to connect to.RemoteScrapingSessionExceptionjava.net.UnknownHostExceptionjava.io.IOExceptionpublic RemoteScrapingSession(java.lang.String name,
@NotNull
java.lang.String host,
int port,
int timeout)
throws RemoteScrapingSessionException,
java.net.UnknownHostException,
java.io.IOException
name - The name of the scraping session.host - The host the client should try to connect to.port - The port the client should try to connect to.timeout - The timeout value for the socket.RemoteScrapingSessionExceptionjava.net.UnknownHostExceptionjava.io.IOExceptionpublic RemoteScrapingSession(java.lang.String name,
@NotNull
java.lang.String host,
int port,
java.lang.String characterSet)
throws RemoteScrapingSessionException,
java.net.UnknownHostException,
java.io.IOException
name - The name of the scraping session.host - The host the client should try to connect to.port - The port the client should try to connect to.characterSet - The character set to use when transferring data across the pipe.RemoteScrapingSessionExceptionjava.net.UnknownHostExceptionjava.io.IOExceptionpublic RemoteScrapingSession(java.lang.String name,
@NotNull
java.lang.String host,
int port,
int timeout,
java.lang.String characterSet)
throws RemoteScrapingSessionException,
java.net.UnknownHostException,
java.io.IOException
name - The name of the scraping session.host - The host the client should try to connect to.port - The port the client should try to connect to.timeout - The timeout value for the socket.characterSet - The character set to use when transferring data across the pipe.RemoteScrapingSessionExceptionjava.net.UnknownHostExceptionjava.io.IOExceptionpublic RemoteScrapingSession(@NotNull java.lang.String host, int port) throws RemoteScrapingSessionException, java.net.UnknownHostException, java.io.IOException
host - The host the client should try to connect to.port - The port the client should try to connect to.RemoteScrapingSessionExceptionjava.net.UnknownHostExceptionjava.io.IOExceptionpublic void scrape()
throws RemoteScrapingSessionException
RemoteScrapingSessionExceptionpublic void stopServer()
throws RemoteScrapingSessionException
RemoteScrapingSessionException@Nullable public java.lang.Object getVariable(@NotNull java.lang.String varName) throws RemoteScrapingSessionException
varName - The name of the desired variable.RemoteScrapingSessionExceptionpublic int getNumDataRecordsInDataSet(java.lang.String dataSetName)
throws RemoteScrapingSessionException
dataSetName - The name of the data set.RemoteScrapingSessionException@NotNull public DataRecord getDataRecordFromDataSet(java.lang.String dataSetName, int index) throws RemoteScrapingSessionException
dataSetName - The name of the data set.index - The index of the data record.RemoteScrapingSessionExceptionpublic void setVariable(@NotNull java.lang.String varName, @Nullable java.lang.Object value) throws RemoteScrapingSessionException
varName - The name of the variable to be set.value - The value to be set.RemoteScrapingSessionException - On error setting the variable on the remote sessionpublic void setVariable(@NotNull java.lang.String varName, @Nullable java.lang.String value) throws RemoteScrapingSessionException
varName - The name of the variable to be set.value - The value to be set.RemoteScrapingSessionException - On error setting the variable on the remote sessionpublic void setTimeout(int timeout)
throws RemoteScrapingSessionException
timeout - The number of minutes before the session should time out.RemoteScrapingSessionExceptionpublic boolean sessionTimedOut()
throws RemoteScrapingSessionException
RemoteScrapingSessionExceptionpublic void setDoLazyScrape(boolean doLazyScrape)
throws RemoteScrapingSessionException
RemoteScrapingSessionExceptionpublic void setOutputLogFiles(boolean outputLogFiles)
throws RemoteScrapingSessionException
RemoteScrapingSessionException@Nullable public DataRecord getNextCachedDataRecord(java.lang.String dataSetName) throws RemoteScrapingSessionException
dataSetName - The name of a cached data set.DataRecordRemoteScrapingSessionException@Nullable public DataSet getNextCachedDataRecords(java.lang.String dataSetName, int numRecordsToRetrive) throws RemoteScrapingSessionException
DataSet containing up to the given number of records from a cached DataSet.dataSetName - The name of a cached data set.numRecordsToRetrive - The number of records to be retrieved from the set.DataSet containing up to the given number of records to be retrieved.RemoteScrapingSessionExceptionpublic void loadVariables(java.lang.String fileToReadFrom)
throws RemoteScrapingSessionException
fileToReadFrom - The file to read the variables from.RemoteScrapingSessionExceptionpublic void doHotSwapFromDatabase()
throws RemoteScrapingSessionException
RemoteScrapingSessionExceptionpublic void disconnect()
throws java.io.IOException
java.io.IOException@Nullable public DataReceiver getDataReceiver()
DataReceiver object.DataReceiver if we have one; null, otherwise.public void setDataReceiver(DataReceiver dataReceiver) throws RemoteScrapingSessionException
DataReceiver to be used.dataReceiver - A DataReceiver.RemoteScrapingSessionExceptionpublic int getPollFrequency()
public void setPollFrequency(int pollFrequency)
throws RemoteScrapingSessionException
pollFrequency - The frequency.RemoteScrapingSessionException@NotNull public static java.lang.String getVersion()
public java.lang.String getCharacterSet()