public class SOAPInterface
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
FAILURE |
static java.lang.String[] |
FAILURE_ARRAY |
static java.lang.String[][] |
FAILURE_ARRAY_2D |
static java.lang.String |
FAILURE_STRING |
static org.apache.log4j.Logger |
log
Used for logging.
|
static int |
SUCCESS |
Constructor and Description |
---|
SOAPInterface()
Constructs the SOAP Inteface.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getCompletedScrapingSessions()
Returns the ID's of the completed scraping sessions.
|
java.lang.String[] |
getDataRecord(java.lang.String id,
java.lang.String var)
Get a data record for the given variable.
|
java.lang.String[][] |
getDataSet(java.lang.String id,
java.lang.String var)
Get the data set contained in a variable in a scraping session.
|
java.lang.String |
getLog(java.lang.String filename)
Return the content of a given log file.
|
java.lang.String |
getLog(java.lang.String filename,
boolean start,
int lines)
Returns a portion of the content of a given log file.
|
java.lang.String[] |
getLogNames()
Returns the names of all the files in the log directory of the remote server.
|
long |
getLogSize(java.lang.String filename)
Return the size of the given logfile in bytes.
|
java.lang.String[] |
getRunningScrapingSessions()
Return the ID's of the currently running scraping sessions.
|
java.lang.String |
getScrapingSessionName(java.lang.String id)
Returns the name of the scraping session with key=id.
|
java.lang.String[] |
getScrapingSessionNames()
Returns an array of names of scraping sessions which this server currently has.
|
long |
getScrapingSessionStartTime(java.lang.String id)
Returns the starting time of a particular scraping session as a long.
|
java.lang.String[] |
getScriptNames()
Returns the names of scripts in this server.
|
java.lang.String |
getVariable(java.lang.String id,
java.lang.String var)
Get the value of a certain variable in a scraping session.
|
java.lang.String |
initializeScrapingSession(java.lang.String name)
Initialize this scraping session to allow it to be scraped.
|
static boolean |
isAcceptingConnections()
Returns the value to acceptingConnections, which is the value which dictates if the server is handling remote requests to scrape.
|
int |
isFinished(java.lang.String id)
Returns if the session with key=id is finished.
|
int |
removeCompletedScrapingSession(java.lang.String id)
Remove the scraping session given by id from the list of completed scraping sessions.
|
int |
removeLog(java.lang.String filename)
Remove a log file from the log directory on the remote server.
|
int |
removeScrapingSession(java.lang.String name)
Remove a scraping session from the remote server and from it's database.
|
int |
removeScript(java.lang.String name)
Remove a script from the remote server and it's database.
|
int |
scrape(java.lang.String id)
Scrape the session given by this ID.
|
static int |
setAcceptingConnections(boolean accepting)
Sets the value for acceptingConnections, which will either stop the server from handling requests for remote scrapes or allow them.
|
int |
setTimeout(java.lang.String id,
int minutes)
Set the time out minutes of a scraping session to scrape.
|
int |
setVariable(java.lang.String id,
java.lang.String var,
java.lang.String value)
Set a variable within a scraping session.
|
int |
stopScrapingSession(java.lang.String id)
Stop a scraping session in progress.
|
int |
update(java.lang.String xml)
Update the remote server with an exported scraping session or script.
|
public static org.apache.log4j.Logger log
public static int SUCCESS
public static int FAILURE
@NotNull public static java.lang.String FAILURE_STRING
@NotNull public static java.lang.String[] FAILURE_ARRAY
@NotNull public static java.lang.String[][] FAILURE_ARRAY_2D
public static boolean isAcceptingConnections()
public static int setAcceptingConnections(boolean accepting)
accepting
- value to change acceptingConnections to.@NotNull public java.lang.String[] getScrapingSessionNames()
@NotNull public java.lang.String[] getScriptNames()
@NotNull public java.lang.String[] getRunningScrapingSessions()
String
s, which are the ID's.@NotNull public java.lang.String[] getCompletedScrapingSessions()
public int removeCompletedScrapingSession(@NotNull java.lang.String id)
id
- the ID of the scraping session to be removed.int
representing success or a failure code.public int isFinished(@NotNull java.lang.String id)
id
- the ID of the scraping session to check status.int
representing finished (1), not finished (0) or error (0)@Nullable public java.lang.String getScrapingSessionName(@NotNull java.lang.String id)
id
- the ID of a scraping session.public long getScrapingSessionStartTime(@NotNull java.lang.String id)
id
- the ID of a scraping session.@NotNull public java.lang.String initializeScrapingSession(java.lang.String name)
name
- the name of the scraping session to initialize.public int scrape(@NotNull java.lang.String id)
id
- the ID of a scraping session.public int setVariable(@NotNull java.lang.String id, @NotNull java.lang.String var, java.lang.String value)
id
- the ID of a scraping session that has been initialized.var
- the name of the variable to set.value
- the value to set the variable to.public int setTimeout(@NotNull java.lang.String id, int minutes)
id
- the ID of a scraping session.minutes
- the number of minutes before this session will timeout.public int stopScrapingSession(@NotNull java.lang.String id)
id
- the ID of a scraping session.@Nullable public java.lang.String getVariable(@NotNull java.lang.String id, @NotNull java.lang.String var)
id
- the ID of a scraping session.var
- the name of the variable to get the value of.@NotNull public java.lang.String[] getDataRecord(@NotNull java.lang.String id, @NotNull java.lang.String var)
id
- the ID of a scraping session.var
- the name of a variable in this scraping session.String
s like "key=value" or an empty array if an error happened or the variable is empty.@NotNull public java.lang.String[][] getDataSet(@NotNull java.lang.String id, @NotNull java.lang.String var)
id
- the ID of a scraping session.var
- the name of a variable.String
s.public int update(@NotNull java.lang.String xml)
xml
- the XML contained within an exported scraping session file.public int removeScrapingSession(java.lang.String name)
name
- the name of the scraping session to be removed.public int removeScript(java.lang.String name)
name
- the name of a script to e removed.@Nullable public java.lang.String[] getLogNames()
null
if there is no log directory.public long getLogSize(java.lang.String filename)
filename
- the name of a file in the log directory.long
representing the length in bytes of this file, or 0 if the file does not exist or is empty.@Nullable public java.lang.String getLog(java.lang.String filename)
filename
- the name of the file to get the contents of.String
of the contents of the file, or "" if not possible.@Nullable public java.lang.String getLog(java.lang.String filename, boolean start, int lines)
filename
- the name of a log file.start
- true
to return content from the beginning of a file, false
to start counting lines from the end.lines
- the number of lines from the log file to return.public int removeLog(java.lang.String filename)
filename
- the name of the file to remove.