org.apache.avalon.excalibur.monitor.impl
Class AbstractMonitor

java.lang.Object
  extended byorg.apache.avalon.excalibur.monitor.impl.AbstractMonitor
All Implemented Interfaces:
Component, Monitor
Direct Known Subclasses:
ActiveMonitor, PassiveMonitor

public abstract class AbstractMonitor
extends java.lang.Object
implements Monitor

The AbstractMonitor class is a useful base class which all Monitors can extend. The particular monitoring policy is defined by the particular implementation.

Version:
$Id: AbstractMonitor.java,v 1.5 2004/02/28 11:47:35 cziegeler Exp $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.avalon.excalibur.monitor.Monitor
ROLE
 
Constructor Summary
AbstractMonitor()
           
 
Method Summary
 void addResource(Resource resource)
          Add a resource to monitor.
 void addResources(Resource[] resources)
          Add an array of resources to monitor.
 Resource getResource(java.lang.String key)
          Find a monitored resource.
protected  Resource[] getResources()
          Return an array containing all the resources currently monitored.
 void removeResource(Resource resource)
          Remove a monitored resource by reference.
 void removeResource(java.lang.String key)
          Remove a monitored resource by key.
protected  void scanAllResources()
          Scan through all resources to determine if they have changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMonitor

public AbstractMonitor()
Method Detail

addResources

public final void addResources(Resource[] resources)
Add an array of resources to monitor.

Parameters:
resources - the resources to monitor

addResource

public final void addResource(Resource resource)
Add a resource to monitor. The resource key referenced in the other interfaces is derived from the resource object.

Specified by:
addResource in interface Monitor

getResource

public Resource getResource(java.lang.String key)
Find a monitored resource. If no resource is available, return null

Specified by:
getResource in interface Monitor

removeResource

public final void removeResource(java.lang.String key)
Remove a monitored resource by key. Will throw NPE, if no resource with given key.

Specified by:
removeResource in interface Monitor

removeResource

public final void removeResource(Resource resource)
Remove a monitored resource by reference. Will throw NPE, if resource has been removed from monitor.

Specified by:
removeResource in interface Monitor

getResources

protected Resource[] getResources()
Return an array containing all the resources currently monitored.

Returns:
an array containing all the resources currently monitored.

scanAllResources

protected void scanAllResources()
Scan through all resources to determine if they have changed.



Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.