net.dpml.transit.monitor
Class CacheMonitorRouter

java.lang.Object
  extended bynet.dpml.transit.monitor.AbstractMonitorRouter
      extended bynet.dpml.transit.monitor.CacheMonitorRouter
All Implemented Interfaces:
CacheMonitor, Monitor, Router

public class CacheMonitorRouter
extends AbstractMonitorRouter
implements CacheMonitor, Router

The cache monitor router is responsible for the dispatiching of cache monitor events to registered monitors.

Version:
1.0.1
Author:
Digital Product Meta Library

Field Summary
 
Fields inherited from interface net.dpml.transit.monitor.Monitor
BOOTSTRAP_DEBUG_KEY
 
Constructor Summary
CacheMonitorRouter()
           
 
Method Summary
 void addedToLocalCache(URL resource, File localFile)
          Notify all monitors that a request artifact has been added to the local cache.
 void addMonitor(Monitor monitor)
          Addition of a monitor to the list of monitors maintained by this router.
 void failedDownload(Artifact artifact)
          Notify all monitors that an artifact request failed.
 void failedDownloadFromHost(String host, Artifact artifact, Throwable cause)
          Notify all monitors that an artifact request on a named host failed.
 void removedFromLocalCache(URL resource, File localFile)
          Notify all monitors that an artifact in the local cache was removed.
 void resourceRequested(Artifact artifact)
          Notify all monitors that a request for an artifact has been received.
 void updatedLocalCache(URL resource, File localFile)
          Notify all monitors that an artifact in the local cache has been updated.
 
Methods inherited from class net.dpml.transit.monitor.AbstractMonitorRouter
removeMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.dpml.transit.monitor.Router
removeMonitor
 

Constructor Detail

CacheMonitorRouter

public CacheMonitorRouter()
Method Detail

resourceRequested

public void resourceRequested(Artifact artifact)
Notify all monitors that a request for an artifact has been received.

Specified by:
resourceRequested in interface CacheMonitor
Parameters:
artifact - the requested artifact

addedToLocalCache

public void addedToLocalCache(URL resource,
                              File localFile)
Notify all monitors that a request artifact has been added to the local cache.

Specified by:
addedToLocalCache in interface CacheMonitor
Parameters:
resource - the url of the remote resource
localFile - the local file added to the cache

updatedLocalCache

public void updatedLocalCache(URL resource,
                              File localFile)
Notify all monitors that an artifact in the local cache has been updated.

Specified by:
updatedLocalCache in interface CacheMonitor
Parameters:
resource - the url of the remote resource
localFile - the local file that was modified

removedFromLocalCache

public void removedFromLocalCache(URL resource,
                                  File localFile)
Notify all monitors that an artifact in the local cache was removed.

Specified by:
removedFromLocalCache in interface CacheMonitor
Parameters:
resource - the url of the remote resource
localFile - the local file that was removed

failedDownloadFromHost

public void failedDownloadFromHost(String host,
                                   Artifact artifact,
                                   Throwable cause)
Notify all monitors that an artifact request on a named host failed.

Specified by:
failedDownloadFromHost in interface CacheMonitor
Parameters:
host - the remote host
artifact - the requested artifact
cause - the cause of the failure

failedDownload

public void failedDownload(Artifact artifact)
Notify all monitors that an artifact request failed.

Specified by:
failedDownload in interface CacheMonitor
Parameters:
artifact - the requested artifact

addMonitor

public void addMonitor(Monitor monitor)
                throws IllegalArgumentException
Addition of a monitor to the list of monitors maintained by this router.

Specified by:
addMonitor in interface Router
Overrides:
addMonitor in class AbstractMonitorRouter
Parameters:
monitor - the monitor to add
Throws:
IllegalArgumentException - if the monitor does not implement CacheMonitor