public class ScrapeableSessionManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log |
Constructor and Description |
---|
ScrapeableSessionManager() |
Modifier and Type | Method and Description |
---|---|
static void |
addScrapeableSession(ScrapeableSession scrapeableSession)
Adds a
ScrapeableSession to the manager. |
static void |
completeScrapeableSession(ScrapingSession scrapingSession)
Handles a
ScrapeableSession whose corresponding ScrapingSession has completed. |
static ScrapeableSession |
getMostRecentScrapeableSession(java.lang.String scrapingSessionName)
Gets the most recently run
ScrapeableSession based on the given ScrapingSession . |
static int |
getNumScrapeableSessions()
Gets the number of scrapeable sessions held by the manager.
|
static ScrapeableSession |
getPriorScrapeableSession(ScrapeableSession scrapeableSession)
Gets the
ScrapeableSession that ran just prior to the given ScrapeableSession . |
static ScrapeableSession |
getScrapeableSession(int id)
Gets the
ScrapeableSession with the given ID. |
static ScrapeableSession |
getScrapeableSession(ScrapingSession scrapingSession)
Gets a
ScrapeableSession based on the given ScrapingSession . |
static ScrapeableSession |
getScrapeableSession(java.lang.String scrapingSessionName)
Gets a
ScrapeableSession based on the given ScrapingSession name. |
static SynchronizedListAccessibleLock<ScrapeableSession> |
getScrapeableSessions()
Gets a direct reference to the object containing the various
ScrapeableSessionManager objects. |
static boolean |
isLoaded()
Indicates whether or not the manager has been loaded.
|
protected static void |
load()
Loads up any existing
ScrapeableSession objects from the database. |
static void |
nullScrapingSessionReference(ScrapingSession scrapingSession)
Nulls out the reference to the given
ScrapingSession if a ScrapeableSession containing that ScrapingSession is
found. |
static void |
reload()
Reloads all objects from the database.
|
static void |
removeScrapeableSession(int id)
Removes the
ScrapeableSession with the given ID. |
static void |
removeScrapeableSession(ScrapeableSession scrapeableSession)
Removes the given
ScrapeableSession . |
static void |
replaceScrapingSession(ScrapingSession oldScrapingSession,
ScrapingSession newScrapingSession)
Handles replacing one scraping session with another.
|
static void |
save()
Saves all of the constituent
ScrapeableSession objects that are still in process. |
static void |
setPreviousValuesOnScrapeableSessions()
Iterates through the current set of
ScrapeableSession objects, setting the "previous" values on each. |
static void |
setScrapeableSessionStatus(ScrapingSession scrapingSession,
java.lang.String status)
Sets the status for a
ScrapeableSession if one is found. |
static void |
sortScrapeableSessions()
Sorts the existing set of
ScrapeableSession objects. |
protected static void load()
ScrapeableSession
objects from the database.public static void reload()
public static void replaceScrapingSession(@Nullable ScrapingSession oldScrapingSession, @Nullable ScrapingSession newScrapingSession)
oldScrapingSession
- The ScrapingSession
to be replaced.newScrapingSession
- The ScrapingSession
to replace.public static boolean isLoaded()
public static void setPreviousValuesOnScrapeableSessions()
ScrapeableSession
objects, setting the "previous" values on each.public static void sortScrapeableSessions()
ScrapeableSession
objects.@Nullable @InternalOnly public static SynchronizedListAccessibleLock<ScrapeableSession> getScrapeableSessions()
ScrapeableSessionManager
objects.TreeSet
containing ScrapeableSession
objects.public static int getNumScrapeableSessions()
public static void addScrapeableSession(@Nullable ScrapeableSession scrapeableSession)
ScrapeableSession
to the manager.scrapeableSession
- A ScrapeableSession
.public static void removeScrapeableSession(int id)
ScrapeableSession
with the given ID.id
- The ID of the ScrapeableSession
.public static void removeScrapeableSession(@Nullable ScrapeableSession scrapeableSession)
ScrapeableSession
.scrapeableSession
- The ScrapeableSession
to remove.public static ScrapeableSession getScrapeableSession(int id)
ScrapeableSession
with the given ID.id
- The ID of the ScrapeableSession
.ScrapeableSession
, if found; null, otherwise.@Nullable public static ScrapeableSession getMostRecentScrapeableSession(@Nullable java.lang.String scrapingSessionName)
ScrapeableSession
based on the given ScrapingSession
.scrapingSessionName
- A ScrapingSession
name.ScrapeableSession
, if found; null, otherwise.@Nullable public static ScrapeableSession getScrapeableSession(@Nullable ScrapingSession scrapingSession)
ScrapeableSession
based on the given ScrapingSession
.scrapingSession
- A ScrapingSession
.ScrapeableSession
, if found; null, otherwise.@Nullable public static ScrapeableSession getScrapeableSession(@Nullable java.lang.String scrapingSessionName)
ScrapeableSession
based on the given ScrapingSession
name.scrapingSessionName
- A ScrapingSession
name.ScrapeableSession
, if found; null, otherwise.public static void nullScrapingSessionReference(@Nullable ScrapingSession scrapingSession)
ScrapingSession
if a ScrapeableSession
containing that ScrapingSession
is
found.scrapingSession
- The ScrapingSession
.public static void setScrapeableSessionStatus(@Nullable ScrapingSession scrapingSession, java.lang.String status)
ScrapeableSession
if one is found.scrapingSession
- The ScrapingSession
corresponding to the ScrapeableSession
.status
- The status to set.public static void completeScrapeableSession(ScrapingSession scrapingSession)
ScrapeableSession
whose corresponding ScrapingSession
has completed.scrapingSession
- The ScrapingSession
that was completed.public static void save()
ScrapeableSession
objects that are still in process.@Nullable public static ScrapeableSession getPriorScrapeableSession(@Nullable ScrapeableSession scrapeableSession)
ScrapeableSession
that ran just prior to the given ScrapeableSession
.scrapeableSession
- The ScrapeableSession
to compare.ScrapeableSession
, if found; null, otherwise.