net.dpml.transit.monitor
Class NetworkMonitorRouter

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

public class NetworkMonitorRouter
extends AbstractMonitorRouter
implements NetworkMonitor, Router

A router that handles multicasr distribution of 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
NetworkMonitorRouter()
           
 
Method Summary
 void addMonitor(Monitor monitor)
          Add a monitor to the list of monitors managed by this router.
 void notifyCompletion(URL resource)
          Notify all subscribing monitors of a download completion event.
 void notifyUpdate(URL resource, int expected, int count)
          Notify all subscribing monitors of a updated event.
 
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

NetworkMonitorRouter

public NetworkMonitorRouter()
Method Detail

notifyUpdate

public void notifyUpdate(URL resource,
                         int expected,
                         int count)
Notify all subscribing monitors of a updated event.

Specified by:
notifyUpdate in interface NetworkMonitor
Parameters:
resource - the url of the updated resource
expected - the size in bytes of the download
count - the progress in bytes

notifyCompletion

public void notifyCompletion(URL resource)
Notify all subscribing monitors of a download completion event.

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

addMonitor

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

Specified by:
addMonitor in interface Router
Overrides:
addMonitor in class AbstractMonitorRouter
Parameters:
monitor - the monitor to add
Throws:
IllegalArgumentException - if the supplied monitor is not a NetworkMonitor