|
The Encog Project | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.encog.bot.spider.workload.memory.MemoryWorkloadManager
public class MemoryWorkloadManager
MemoryWorkloadManager: This class implements a workload manager that stores the list of URL's in memory. This workload manager only supports spidering against a single host. For multiple hosts use the SQLWorkloadManager.
| Field Summary | |
|---|---|
static int |
WAIT_FOR_WORK
How many seconds to wait for work. |
| Constructor Summary | |
|---|---|
MemoryWorkloadManager()
|
|
| Method Summary | |
|---|---|
boolean |
add(java.net.URL url,
java.net.URL source,
int depth)
Add the specified URL to the workload. |
void |
clear()
Clear the workload. |
boolean |
contains(java.net.URL url)
Determine if the workload contains the specified URL. |
java.net.URL |
convertURL(java.lang.String url)
Convert the specified String to a URL. |
java.lang.String |
getCurrentHost()
Get the current host. |
int |
getDepth(java.net.URL url)
Get the depth of the specified URL. |
java.net.URL |
getSource(java.net.URL url)
Get the source page that contains the specified URL. |
java.net.URL |
getWork()
Get a new URL to work on. |
void |
init(Spider spider)
Setup this workload manager for the specified spider. |
void |
markError(java.net.URL url)
Mark the specified URL as error. |
void |
markProcessed(java.net.URL url)
Mark the specified URL as successfully processed. |
java.lang.String |
nextHost()
Move on to process the next host. |
void |
resume()
Setup the workload so that it can be resumed from where the last spider left the workload. |
void |
waitForWork(int time,
java.util.concurrent.TimeUnit length)
If there is currently no work available, then wait until a new URL has been added to the workload. |
boolean |
workloadEmpty()
Return true if there are no more workload units. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int WAIT_FOR_WORK
| Constructor Detail |
|---|
public MemoryWorkloadManager()
| Method Detail |
|---|
public boolean add(java.net.URL url,
java.net.URL source,
int depth)
add in interface WorkloadManagerurl - The URL to be added.source - The page that contains this URL.depth - The depth of this URL.
public void clear()
clear in interface WorkloadManagerpublic boolean contains(java.net.URL url)
contains in interface WorkloadManagerurl - The URL to check.
public java.net.URL convertURL(java.lang.String url)
convertURL in interface WorkloadManagerurl - A String to convert into a URL.
public java.lang.String getCurrentHost()
getCurrentHost in interface WorkloadManagerpublic int getDepth(java.net.URL url)
getDepth in interface WorkloadManagerurl - The URL to get the depth of.
public java.net.URL getSource(java.net.URL url)
getSource in interface WorkloadManagerurl - The URL to seek the source for.
public java.net.URL getWork()
getWork in interface WorkloadManagerpublic void init(Spider spider)
init in interface WorkloadManagerspider - The spider using this workload manager.public void markError(java.net.URL url)
markError in interface WorkloadManagerurl - The URL that had an error.public void markProcessed(java.net.URL url)
markProcessed in interface WorkloadManagerurl - The URL to mark as processed.public java.lang.String nextHost()
nextHost in interface WorkloadManagerpublic void resume()
resume in interface WorkloadManager
public void waitForWork(int time,
java.util.concurrent.TimeUnit length)
waitForWork in interface WorkloadManagertime - The amount of time to wait.length - What tiem unit is being used.public boolean workloadEmpty()
workloadEmpty in interface WorkloadManager
|
The Encog Project | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||