net.spy.net
Class URLItem

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.cron.Job
          extended by net.spy.net.URLItem
All Implemented Interfaces:
java.lang.Runnable, ThreadPoolRunnable

public class URLItem
extends Job
implements ThreadPoolRunnable

A particular URL that's being watched.


Constructor Summary
URLItem(java.net.URL u)
          Get a new URLItem at the default interval.
URLItem(java.net.URL u, java.util.Date startDate, TimeIncrement ti)
          Get an instance of URLItem.
URLItem(java.net.URL u, TimeIncrement ti)
          Get a new URLItem with the given interval.
 
Method Summary
 java.lang.String getContent()
          Get the content from the last fetch.
 long getLastRequest()
          Find out when the last request was.
 int getMaxIdleTime()
          Get the maximum number of milliseconds this URL will remain in the container if nothing requests it.
 java.net.URL getURL()
          Get the URL this thing is watching.
protected  void markFinished()
          Override the finished mark to also stop this job if it hasn't been touched recently enough.
 void runJob()
          Ask the URL to update itself if it needs to.
 void setMaxIdleTime(int maxIdleTime)
          Set the maximum number of milliseconds this URL will remain in the container if nothing requests it.
 
Methods inherited from class net.spy.cron.Job
findNextRun, getName, getStartTime, getTimeIncrement, isAlive, isReady, isTrash, markStarted, run, setName, setStartTime, stopRunning, toString
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.spy.util.ThreadPoolRunnable
toString
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

URLItem

public URLItem(java.net.URL u)
Get a new URLItem at the default interval.

Parameters:
u - URL to watch

URLItem

public URLItem(java.net.URL u,
               TimeIncrement ti)
Get a new URLItem with the given interval.

Parameters:
u - URL to watch
ti - the increment

URLItem

public URLItem(java.net.URL u,
               java.util.Date startDate,
               TimeIncrement ti)
Get an instance of URLItem.

Parameters:
u - URL to watch
startDate - time to start
ti - the increment
Method Detail

runJob

public void runJob()
Ask the URL to update itself if it needs to.

Specified by:
runJob in class Job

getContent

public java.lang.String getContent()
                            throws java.io.IOException
Get the content from the last fetch.

Throws:
java.io.IOException

getLastRequest

public long getLastRequest()
Find out when the last request was.

Returns:
the timestamp of the last request.

getURL

public java.net.URL getURL()
Get the URL this thing is watching.

Returns:
the URL

markFinished

protected void markFinished()
Override the finished mark to also stop this job if it hasn't been touched recently enough.

Overrides:
markFinished in class Job

setMaxIdleTime

public void setMaxIdleTime(int maxIdleTime)
Set the maximum number of milliseconds this URL will remain in the container if nothing requests it.


getMaxIdleTime

public int getMaxIdleTime()
Get the maximum number of milliseconds this URL will remain in the container if nothing requests it.



Copyright © 1995-2005 SPY Internetworking. All Rights Reserved.