public class ScriptInstances
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
Constructor and Description |
---|
ScriptInstances()
Required by castor.
|
ScriptInstances(ScriptInstances scriptInstances)
Creates a new
ScriptInstances by copying the one passed in. |
ScriptInstances(ScriptInstancesContainer owner)
Creates a new
Scriptinstances for the given context. |
Modifier and Type | Method and Description |
---|---|
void |
addScriptInstance(ScriptInstance scriptInstance)
Adds a script instance to the collection.
|
void |
delete()
Deletes the script instances from the database.
|
void |
dumpToLog()
Dumps the script instance objects to the log.
|
int |
getDefaultWhenToRunValue()
Gets the default "WHENTORUN" value given the context of the script instances.
|
int |
getNumScriptInstances()
Gets the number of
ScriptInstance objects. |
java.lang.Object |
getOwner()
Gets the owner of the script instances.
|
java.lang.String |
getOwnerName()
The following are needed only for castor.
|
java.lang.String |
getOwnerType() |
java.util.Iterator |
getScriptInstacesIterator()
Gets an
Iterator over which the script instances can
be iterated. |
ScriptInstance |
getScriptInstance(int sequence)
Gets a script instance from the session.
|
java.util.TreeSet<ScriptInstance> |
getScriptInstances()
Gets all script instances held by this object.
|
int |
getTotalScriptInstances()
Gets the total number of script instances held by this object.
|
javax.swing.JComboBox |
getValidWhenToRunValuesAsComboBox()
Gets valid "WHENTORUN" values for this script instances, given the context.
|
boolean |
isLoaded()
Indicates whether or not the object has been loaded.
|
void |
load()
Loads up the script instances.
|
void |
processScripts(int whenToRun,
ScriptContext scriptContext)
Processes the scripts associated with this object.
|
void |
removeScriptInstance(int sequence)
Removes a script instance.
|
void |
reset()
Resets the script instances so that it doesn't use more memory than it needs to.
|
void |
save()
Saves the script instances to the database.
|
void |
setNotifiable(Notifiable notifiable)
Sets the object the script instances will use to notify when things happen.
|
void |
setOwner(ScriptInstancesContainer owner)
Sets the owner of the script instances.
|
void |
setOwnerName(java.lang.String ownerName) |
void |
setOwnerType(java.lang.String ownerType) |
void |
setScriptInstances(java.util.TreeSet tsScriptInstances)
Sets all script instances held by this object.
|
void |
setSequencesOnScriptInstanceObjects()
Sets the sequence value on each of the script instances based on the order
indicated by the tree set.
|
public ScriptInstances()
public ScriptInstances(ScriptInstancesContainer owner)
Scriptinstances
for the given context.owner
- The owner of the script instances. Can be a ScrapingSession
,
ScrapeableFile
, or ExtractorPattern
.public ScriptInstances(@NotNull ScriptInstances scriptInstances)
ScriptInstances
by copying the one passed in.scriptInstances
- The ScriptInstances
to copy.@Nullable public java.lang.Object getOwner()
ScrapingSession
,
ScrapeableFile
, or ExtractorPattern
.public void setOwner(@NotNull ScriptInstancesContainer owner)
ScrapingSession
,
ScrapeableFile
, or ExtractorPattern
.owner
- The owner.@Nullable public java.lang.String getOwnerName()
public void setOwnerName(java.lang.String ownerName)
@Nullable public java.lang.String getOwnerType()
public void setOwnerType(java.lang.String ownerType)
public void addScriptInstance(@NotNull ScriptInstance scriptInstance)
scriptInstance
- A ScriptInstance
.@NotNull public java.util.Iterator getScriptInstacesIterator()
Iterator
over which the script instances can
be iterated.Iterator
.public void removeScriptInstance(int sequence)
sequence
- The sequence.public void setSequencesOnScriptInstanceObjects()
@Nullable public ScriptInstance getScriptInstance(int sequence)
sequence
- The sequence of the script to be retrieved.public java.util.TreeSet<ScriptInstance> getScriptInstances()
HashSet
of ScriptInstance
objects.public int getNumScriptInstances()
ScriptInstance
objects.public void setScriptInstances(java.util.TreeSet tsScriptInstances)
tsScriptInstances
- A HashSet
of ScriptInstance
objects.public int getTotalScriptInstances()
public void setNotifiable(Notifiable notifiable)
notifiable
- The object.@NotNull public javax.swing.JComboBox getValidWhenToRunValuesAsComboBox()
ScriptInstance
.public int getDefaultWhenToRunValue()
public void save()
public void delete()
public boolean isLoaded()
public void load()
public void reset()
public void processScripts(int whenToRun, @NotNull ScriptContext scriptContext) throws ScriptException
whenToRun
- Determines which scripts are to be executed based
on their "whenToRun" value.scriptContext
- The context in which the scripts should be run.ScriptException
public void dumpToLog()