org.ops4j.monitors.stream
Class StreamMonitorRouter

java.lang.Object
  extended by org.ops4j.monitors.stream.StreamMonitorRouter
All Implemented Interfaces:
StreamMonitor

public class StreamMonitorRouter
extends Object
implements StreamMonitor

A router that handles multicasr distribution of monitor events to registered monitors.

Version:
$Id$
Author:
Open Particpation Software for Java

Constructor Summary
StreamMonitorRouter()
          Creation of a new network monitor router.
 
Method Summary
 void addStreamMonitor(StreamMonitor monitor)
          Add a monitor to the list of monitors managed by this router.
 StreamMonitor getMonitor(int index)
          Returns a Monitor.
 void notifyCompletion(URL resource)
          Notify all subscribing monitors of a download completion event.
 void notifyError(URL resource, String message)
          Notify the monitor of the an error during the download process.
 void notifyUpdate(URL resource, int expected, int count)
          Notify all subscribing monitors of a updated event.
 void removeStreamMonitor(StreamMonitor monitor)
          Remove a monitor to the list of monitors managed by this router.
 int size()
          Returns the number of Monitors that are being handled by this router.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamMonitorRouter

public StreamMonitorRouter()
Creation of a new network monitor router.

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 StreamMonitor
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 StreamMonitor
Parameters:
resource - the url of the downloaded resource

notifyError

public void notifyError(URL resource,
                        String message)
Notify the monitor of the an error during the download process.

Specified by:
notifyError in interface StreamMonitor
Parameters:
resource - the name of the remote resource.
message - a non-localized message describing the problem in english.

addStreamMonitor

public void addStreamMonitor(StreamMonitor monitor)
Add a monitor to the list of monitors managed by this router.

Parameters:
monitor - the monitor to add

removeStreamMonitor

public void removeStreamMonitor(StreamMonitor monitor)
Remove a monitor to the list of monitors managed by this router.

Parameters:
monitor - the monitor to add

size

public int size()
Returns the number of Monitors that are being handled by this router.

Returns:
the number of Monitors that are being handled by this router.

getMonitor

public StreamMonitor getMonitor(int index)
Returns a Monitor.

Parameters:
index - The index in the List of the Monitor to return.
Returns:
a regsitered StreamMonitor.


Copyright © 2006-2013 OPS4J - Open Participation Software for Java. All Rights Reserved.