All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.andthehorseyourodeinon.netgrep.SearchEngineMonitorService

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----com.andthehorseyourodeinon.ghear.Service
                   |
                   +----com.andthehorseyourodeinon.netgrep.SearchEngineMonitorService

public abstract class SearchEngineMonitorService
extends Service
Abstract class for a Search Engine Monitor (or Tracker) Service. A general Search Engine Monitor will query a serach engine for specific terms, and keep track of the results and the order of the results. A Tracker has the additional functionality of tracking the position of a given site for particular keywords.

Version:
$Id: SearchEngineMonitorService.java,v 1.1 2000/05/16 22:44:24 samuelg Exp $

Variable Index

 o depth
 o firstTime
 o hasNewUrls
 o lastAccessed
 o mets
 o postFix
 o queryString
 o searchHost
 o searchTerm
 o soughtSite
 o theRequest
 o updateFrequency
 o urls

Constructor Index

 o SearchEngineMonitorService(Properties, Metrics, String, String, String, String, String, int)

Method Index

 o currentPosition()
Override this method if writing a Tracker
 o getRequest()
 o getResultCount()
 o getSearchDepth()
 o getSearchHost()
 o getSearchString()
 o getServiceName()
Override this method
 o getSiteString()
Override this method
 o getTimestamp()
 o getUrl(String)
Get a specific result URL.
 o getUrls()
Get all result URLs.
 o getUrlsCreatedAfter(Calendar)
Get all result URLs created after a given time.
 o getUrlsModifiedAfter(Calendar)
Get all result URLs modified after a given time.
 o grabUrlList()
Used in the initialization of the Monitor or Tracker to populate the list of URLs for a given query
 o hasNewUrl()
Is there any new data?
 o hasUrl(String)
Is a given URL in the list of results?
 o history()
Override this method, writing a Tracker
 o isMonitor()
Override this method
 o refreshUrlList()
Used to refresh the list of URLs for all subsequent queries
 o refreshUrlList(boolean)
This code should be overridden for the specific task of Monitoring or Tracking
 o run()
Main thread.
 o sendUpdate(String, String)
Wrapper method to send a notification email.
 o updateTimestamp()

Variables

 o searchTerm
 protected String searchTerm
 o searchHost
 protected String searchHost
 o queryString
 protected String queryString
 o postFix
 protected String postFix
 o soughtSite
 protected String soughtSite
 o depth
 protected int depth
 o urls
 protected Hashtable urls
 o hasNewUrls
 protected boolean hasNewUrls
 o updateFrequency
 protected long updateFrequency
 o lastAccessed
 protected Calendar lastAccessed
 o mets
 protected Metrics mets
 o theRequest
 protected String theRequest
 o firstTime
 protected boolean firstTime

Constructors

 o SearchEngineMonitorService
 public SearchEngineMonitorService(Properties options,
                                   Metrics mets,
                                   String searchTerm,
                                   String searchHost,
                                   String queryString,
                                   String postFix,
                                   String site,
                                   int depth)
Parameters:
options - Properties general to all the search engine Monitors and Trackers.
mets - Metrics for all the search engine Monitors and Trackers.
searchTerm - a String containing the search terms to use against the search engine.
searchHost - the base address of the URL for the search engine.
queryString - a template for a query to the search engine.
postFix - a template for anything on the URL after the search terms.
site - the base URL (e.g., www.site.com) for a site to be tracked.
depth - the number of results from the search engine to consider.

Methods

 o run
 public void run()
Main thread. Sleeps for a given period of time, then updates the query results

Overrides:
run in class Service
 o grabUrlList
 public void grabUrlList()
Used in the initialization of the Monitor or Tracker to populate the list of URLs for a given query

 o refreshUrlList
 public void refreshUrlList()
Used to refresh the list of URLs for all subsequent queries

 o refreshUrlList
 public void refreshUrlList(boolean reportNewUrls)
This code should be overridden for the specific task of Monitoring or Tracking

 o hasUrl
 public boolean hasUrl(String theUrl)
Is a given URL in the list of results?

Parameters:
theUrl - String representation of the URL
Returns:
true if URL is in the list
 o getUrl
 public SearchEngineRecord getUrl(String theUrl)
Get a specific result URL.

Parameters:
theUrl - String representation of the URL
Returns:
a SearchEngineRecord of the URL requested, or null if it's not in the list of results.
 o getUrlsModifiedAfter
 public Vector getUrlsModifiedAfter(Calendar cal)
Get all result URLs modified after a given time.

Parameters:
cal - Calendar containing the threshhold time
Returns:
a Vector of SearchEngineRecords of URLs modified after specified time.
 o getUrls
 public Vector getUrls()
Get all result URLs.

Returns:
a Vector of SearchEngineRecords of URLs.
 o getUrlsCreatedAfter
 public Vector getUrlsCreatedAfter(Calendar cal)
Get all result URLs created after a given time.

Parameters:
cal - Calendar containing the threshhold time
Returns:
a Vector of SearchEngineRecords of URLs created after specified time.
 o sendUpdate
 public void sendUpdate(String subject,
                        String text)
Wrapper method to send a notification email.

Parameters:
subject - subject of the email.
text - body of the email.
 o updateTimestamp
 public void updateTimestamp()
 o getTimestamp
 public Calendar getTimestamp()
 o hasNewUrl
 public boolean hasNewUrl()
Is there any new data?

Returns:
true if new URLs exist in the result list
 o getSearchString
 public String getSearchString()
 o getSiteString
 public String getSiteString()
Override this method

 o currentPosition
 public String currentPosition()
Override this method if writing a Tracker

 o isMonitor
 public boolean isMonitor()
Override this method

 o getSearchHost
 public String getSearchHost()
 o history
 public String history()
Override this method, writing a Tracker

 o getSearchDepth
 public int getSearchDepth()
 o getResultCount
 public int getResultCount()
 o getRequest
 public String getRequest()
 o getServiceName
 public String getServiceName()
Override this method

Overrides:
getServiceName in class Service

All Packages  Class Hierarchy  This Package  Previous  Next  Index