net.spy.net
Class URLWatcher

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.net.URLWatcher

public class URLWatcher
extends SpyObject

URLWatcher watches URLs and provides access to the most recent data from the URL.


Constructor Summary
protected URLWatcher()
          Get an instance of URLWatcher.
 
Method Summary
 java.lang.String getContent(java.net.URL u)
          Get the content (as a String) for a given URL.
static URLWatcher getInstance()
          Get the static instance of URLWatcher.
protected  URLItem getNewURLItem(java.net.URL u)
           
 boolean isWatching(java.net.URL u)
          Find out if this URLWatcher is watching a given URL.
static void setInstance(URLWatcher uw)
          Set an instance (for testing).
 void shutdown()
          Instruct the URLWatcher to stop URLWatching.
 void startWatching(URLItem u)
          Start watching the given URL.
 java.lang.String toString()
          String me.
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URLWatcher

protected URLWatcher()
Get an instance of URLWatcher.

Method Detail

getInstance

public static URLWatcher getInstance()
Get the static instance of URLWatcher.

Returns:
the URLWatcher

setInstance

public static void setInstance(URLWatcher uw)
Set an instance (for testing).


toString

public java.lang.String toString()
String me.

Overrides:
toString in class java.lang.Object

isWatching

public boolean isWatching(java.net.URL u)
Find out if this URLWatcher is watching a given URL.

Parameters:
u - the URL to test
Returns:
true if the URL is already being watched

startWatching

public void startWatching(URLItem u)
Start watching the given URL.

Parameters:
u - The item to watch
Throws:
java.util.concurrent.TimeoutException
java.util.concurrent.ExecutionException
java.lang.InterruptedException

shutdown

public void shutdown()
Instruct the URLWatcher to stop URLWatching.


getNewURLItem

protected URLItem getNewURLItem(java.net.URL u)

getContent

public java.lang.String getContent(java.net.URL u)
                            throws java.io.IOException
Get the content (as a String) for a given URL.

Parameters:
u - The URL whose content we want
Returns:
The String contents, or null if none could be retreived
Throws:
java.io.IOException - if there was a problem updating the URL


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