net.dpml.transit.monitor
Class NetworkMonitorAdapter

java.lang.Object
  extended bynet.dpml.transit.monitor.AbstractAdapter
      extended bynet.dpml.transit.monitor.NetworkMonitorAdapter
All Implemented Interfaces:
Monitor, NetworkMonitor

public class NetworkMonitorAdapter
extends net.dpml.transit.monitor.AbstractAdapter
implements NetworkMonitor

Adapts network events to logging messages.

Version:
1.0.0
Author:
The Digital Product Meta Library

Field Summary
 
Fields inherited from interface net.dpml.transit.monitor.Monitor
BOOTSTRAP_DEBUG_KEY
 
Constructor Summary
NetworkMonitorAdapter(Adapter adapter)
          Creation of a new network monitor adapter.
 
Method Summary
protected  Adapter getAdapter()
          Returns the adapter assigned to this adaptive monitor.
 boolean isTraceEnabled()
          Test is debug trace monitoring is enabled.
 void notifyCompletion(URL resource)
          Handle the notification of the completion of of download process.
 void notifyUpdate(URL resource, int expected, int count)
          Handle the notification of an update in the download status.
 void trace(String message)
          Notify the monitor of a trace level message to log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkMonitorAdapter

public NetworkMonitorAdapter(Adapter adapter)
Creation of a new network monitor adapter.

Parameters:
adapter - the logging adapter
Method Detail

notifyUpdate

public void notifyUpdate(URL resource,
                         int expected,
                         int count)
Handle the notification of an update in the download status.

Specified by:
notifyUpdate in interface NetworkMonitor
Parameters:
resource - the name of the remote resource being downloaded.
expected - the expected number of bytes to be downloaded.
count - the number of bytes downloaded.

notifyCompletion

public void notifyCompletion(URL resource)
Handle the notification of the completion of of download process.

Specified by:
notifyCompletion in interface NetworkMonitor
Parameters:
resource - the url of the completed resource

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