public class ScriptInstance
extends java.lang.Object
implements java.lang.Comparable
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
static int |
WHENTORUN_AFTER_EACH_PATTERN_APPLICATION |
static int |
WHENTORUN_AFTER_FILE_IS_SCRAPED |
static int |
WHENTORUN_AFTER_HTTPREQUEST |
static int |
WHENTORUN_AFTER_HTTPRESPONSE |
static int |
WHENTORUN_AFTER_PATTERN_IS_APPLIED |
static int |
WHENTORUN_AFTER_SCRAPINGSESSION_ENDS |
static int |
WHENTORUN_ALWAYS_AT_THE_END |
static int |
WHENTORUN_BEFORE_ALL_HTTPTRANSACTIONS |
static int |
WHENTORUN_BEFORE_EACH_PATTERN_APPLICATION |
static int |
WHENTORUN_BEFORE_FILE_IS_SCRAPED |
static int |
WHENTORUN_BEFORE_HTTPREQUEST |
static int |
WHENTORUN_BEFORE_HTTPRESPONSE |
static int |
WHENTORUN_BEFORE_PATTERN_IS_APPLIED |
static int |
WHENTORUN_BEFORE_SCRAPINGSESSION_BEGINS
Possible values for the whenToRun variable.
|
static int |
WHENTORUN_ONCE_IF_NO_MATCHES |
static int |
WHENTORUN_ONCE_IF_PATTERN_MATCHES |
Constructor and Description |
---|
ScriptInstance()
Required by castor.
|
ScriptInstance(ScriptInstance scriptInstance)
Makes a script instance by copying another.
|
ScriptInstance(Script script,
int whenToRun,
int sequence,
boolean enabled)
Generates a new ScriptInstance.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object sInstance)
Allows these things to be sorted.
|
void |
delete()
Deletes this specific instance from the database.
|
void |
deleteByContainerObject()
Deletes the script instance from the database.
|
void |
dumpToLog()
Dumps the script instance to the log.
|
boolean |
equals(java.lang.Object obj)
We override this so that we can check for dupes.
|
int |
getExtractorPatternID()
Gets the ID of the extractor pattern associated with this script instance.
|
int |
getHTTPSessionID()
Gets the ID of the HTTP session associated with this script instance.
|
static java.lang.String |
getHumanReadableFormOfWhenToRunValue(int whenToRun)
Gets a human-friendly description of the given "WHENTORUN" value.
|
int |
getScrapeableFileID()
Gets the ID of the scrapeable file associated with this script instance.
|
int |
getScrapingSessionID()
Gets the ID of the scraping session associated with this script instance.
|
Script |
getScript()
Gets the script.
|
int |
getSequence()
Gets the sequence in which the script should be run.
|
int |
getWhenToRun()
Indicates when the script should be run.
|
boolean |
isEnabled()
Indicates whether or not this script instance is enabled.
|
void |
save()
Saves the script instance to the database.
|
void |
setEnabled(boolean enabled)
Determines whether or not this script instance is enabled.
|
void |
setExtractorPatternID(int extractorPatternID)
Sets the ID of the extractor pattern associated with this script instance.
|
void |
setHTTPSessionID(int httpSessionID)
Sets the ID of the HTTP session associated with this script instance.
|
void |
setScrapeableFileID(int scrapeableFileID)
Sets the ID of the scrapeable file associated with this script instance.
|
void |
setScrapingSessionID(int scrapingSessionID)
Sets the ID of the scraping session associated with this script instance.
|
void |
setScript(Script script)
Sets the script.
|
void |
setSequence(int sequence)
Sets the sequence in which the script should be run.
|
void |
setWhenToRun(int whenToRun)
Sets when the script should be run.
|
public static org.apache.log4j.Logger log
public static final int WHENTORUN_BEFORE_SCRAPINGSESSION_BEGINS
public static final int WHENTORUN_AFTER_SCRAPINGSESSION_ENDS
public static final int WHENTORUN_ALWAYS_AT_THE_END
public static final int WHENTORUN_BEFORE_FILE_IS_SCRAPED
public static final int WHENTORUN_AFTER_FILE_IS_SCRAPED
public static final int WHENTORUN_BEFORE_PATTERN_IS_APPLIED
public static final int WHENTORUN_AFTER_PATTERN_IS_APPLIED
public static final int WHENTORUN_BEFORE_EACH_PATTERN_APPLICATION
public static final int WHENTORUN_AFTER_EACH_PATTERN_APPLICATION
public static final int WHENTORUN_ONCE_IF_PATTERN_MATCHES
public static final int WHENTORUN_ONCE_IF_NO_MATCHES
public static final int WHENTORUN_BEFORE_ALL_HTTPTRANSACTIONS
public static final int WHENTORUN_BEFORE_HTTPREQUEST
public static final int WHENTORUN_AFTER_HTTPREQUEST
public static final int WHENTORUN_BEFORE_HTTPRESPONSE
public static final int WHENTORUN_AFTER_HTTPRESPONSE
public ScriptInstance()
public ScriptInstance(Script script, int whenToRun, int sequence, boolean enabled)
script
- The associated script.whenToRun
- When the script should be run.sequence
- The sequence in which the script should be run.enabled
- Indicates whether or not the script instance is enabled.public ScriptInstance(@NotNull ScriptInstance scriptInstance)
scriptInstance
- The ScriptInstance
to copy.public void setScript(Script script)
script
- The script.public int getWhenToRun()
public void setWhenToRun(int whenToRun)
whenToRun
- A value as defined by one of the "WHENTORUN" scripts in this class..public int getSequence()
public void setSequence(int sequence)
sequence
- The sequence.public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- A boolean.public int getScrapingSessionID()
public void setScrapingSessionID(int scrapingSessionID)
scrapingSessionID
- The ID of the scraping session.public int getScrapeableFileID()
public void setScrapeableFileID(int scrapeableFileID)
scrapeableFileID
- The ID of the scrapeable file.public int getExtractorPatternID()
public void setExtractorPatternID(int extractorPatternID)
extractorPatternID
- The ID of the extractor pattern.public int getHTTPSessionID()
public void setHTTPSessionID(int httpSessionID)
httpSessionID
- The ID of the HTTP session.public static java.lang.String getHumanReadableFormOfWhenToRunValue(int whenToRun)
whenToRun
- When the script instance should be run.String
.public void save()
public void deleteByContainerObject()
public void delete()
public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare.public int compareTo(java.lang.Object sInstance)
compareTo
in interface java.lang.Comparable
sInstance
- The ScriptInstance
with which we want to
compare.public void dumpToLog()