org.apache.avalon.excalibur.monitor
Class ActiveMonitor

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.avalon.excalibur.monitor.ActiveMonitor
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.Loggable, Monitor, java.lang.Runnable, org.apache.avalon.framework.activity.Startable, org.apache.avalon.framework.thread.ThreadSafe

public final class ActiveMonitor
extends org.apache.avalon.framework.logger.AbstractLoggable
implements Monitor, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.activity.Startable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.avalon.framework.configuration.Configurable, java.lang.Runnable

The ActiveMonitor is used to actively check a set of resources to see if they have changed. It will be implemented as a Component, that can be retrieved from the ComponentManager. It defaults to checking every 1 minute. The configuration looks like this:

   <monitor>
     <thread priority="5" frequency="60000"/>
     <init-resources>
       <-- This entry can be repeated for every resource you want to register immediately -->

       <resource key="file:./myfile.html" class="org.apache.avalon.excalibur.monitor.FileResource"/>
     </init-resources>
   </monitor>
 

Version:
$Id: ActiveMonitor.java,v 1.4 2001/12/11 16:14:31 bloritsch Exp $
Author:
Berin Loritsch

Fields inherited from interface org.apache.avalon.excalibur.monitor.Monitor
ROLE
 
Constructor Summary
ActiveMonitor()
           
 
Method Summary
 void addResource(Resource resource)
          Add a resource to monitor.
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Configure the ActiveMonitor.
 Resource getResource(java.lang.String key)
          Find a monitored resource.
 void removeResource(Resource resource)
          Remove a monitored resource by reference.
 void removeResource(java.lang.String key)
          Remove a monitored resource by key.
 void run()
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveMonitor

public ActiveMonitor()
Method Detail

configure

public final void configure(org.apache.avalon.framework.configuration.Configuration conf)
                     throws org.apache.avalon.framework.configuration.ConfigurationException
Configure the ActiveMonitor.
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable

start

public final void start()
                 throws java.lang.Exception
Specified by:
start in interface org.apache.avalon.framework.activity.Startable

stop

public final void stop()
                throws java.lang.Exception
Specified by:
stop in interface org.apache.avalon.framework.activity.Startable

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 final 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.
Specified by:
removeResource in interface Monitor

removeResource

public final void removeResource(Resource resource)
Remove a monitored resource by reference.
Specified by:
removeResource in interface Monitor

run

public final void run()
Specified by:
run in interface java.lang.Runnable


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.