net.dpml.transit.monitor
Class CacheMonitorAdapter

java.lang.Object
  extended by net.dpml.transit.monitor.CacheMonitorAdapter
All Implemented Interfaces:
CacheMonitor, Monitor

public class CacheMonitorAdapter
extends Object
implements CacheMonitor

Adapts cache events to logging messages.

Version:
1.0.3
Author:
Digital Product Meta Library
See Also:
Monitor

Field Summary
 
Fields inherited from interface net.dpml.transit.monitor.Monitor
BOOTSTRAP_DEBUG_KEY
 
Constructor Summary
CacheMonitorAdapter(Adapter adapter)
          Creation of a new adaptive cache monitor.
 
Method Summary
 void addedToLocalCache(URL resource, File localFile)
          Notify the monitor that an artifact has been added to the local cache.
 void failedDownload(Artifact artifact)
          Notify the monitor of a failed download attempt.
 void failedDownloadFromHost(String host, Artifact artifact, Throwable e)
          Notify the monitor of a failed download attempt relative to an identified host.
protected  Adapter getAdapter()
          Returns the adapter assigned to this adaptive monitor.
 boolean isTraceEnabled()
          Test is debug trace monitoring is enabled.
 void removedFromLocalCache(URL resource, File localFile)
          Notify the monitor that an artifact has been removed from the local cache.
 void resourceRequested(Artifact artifact)
          Notify the monitor that an artifact has been requested.
 void trace(String message)
          Notify the monitor of a trace level message to log.
 void updatedLocalCache(URL resource, File localFile)
          Notify the monitor that an artifact in the local cache has been updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheMonitorAdapter

public CacheMonitorAdapter(Adapter adapter)
Creation of a new adaptive cache monitor.

Parameters:
adapter - the adapter to assign to the monitor
Method Detail

resourceRequested

public void resourceRequested(Artifact artifact)
Notify the monitor that an artifact has been requested.

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

addedToLocalCache

public void addedToLocalCache(URL resource,
                              File localFile)
Notify the monitor that an artifact has been added to the local cache.

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

updatedLocalCache

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

Specified by:
updatedLocalCache in interface CacheMonitor
Parameters:
resource - the url of the resource updating the local cache
localFile - the local file that has been updated

removedFromLocalCache

public void removedFromLocalCache(URL resource,
                                  File localFile)
Notify the monitor that an artifact has been removed from the local cache.

Specified by:
removedFromLocalCache in interface CacheMonitor
Parameters:
resource - the url of the resource removed from the local cache
localFile - the local file removed from the cache

failedDownloadFromHost

public void failedDownloadFromHost(String host,
                                   Artifact artifact,
                                   Throwable e)
Notify the monitor of a failed download attempt relative to an identified host.

Specified by:
failedDownloadFromHost in interface CacheMonitor
Parameters:
host - the host raising the fail status
artifact - the requested artifact
e - the exception causing the failure

failedDownload

public void failedDownload(Artifact artifact)
Notify the monitor of a failed download attempt.

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

isTraceEnabled

public boolean isTraceEnabled()
Test is debug trace monitoring is enabled.

Returns:
true if debug trace messages are enabled else false

trace

public void trace(String message)
Notify the monitor of a trace level message to log. An implement is responsible for checking if trace debug logging is enabled before handling content.

Parameters:
message - the trace level message to log

getAdapter

protected Adapter getAdapter()
Returns the adapter assigned to this adaptive monitor.

Returns:
the assigned adapter