org.apache.avalon.excalibur.monitor
Class Resource

java.lang.Object
  |
  +--org.apache.avalon.excalibur.monitor.Resource
All Implemented Interfaces:
Modifiable
Direct Known Subclasses:
StreamResource

public abstract class Resource
extends java.lang.Object
implements Modifiable

Managed Resource. All resources must have a constructor that takes a String and converts it to the needed format (i.e. File). A Managed Resource in the Monitor section has only one property needed to be changed: last modified. The property name for the last modified event will be the same as the resource key. Implementations may add additional properties, but for most instances the last modified property will be enough.

Version:
$Id: Resource.java,v 1.2 2001/12/11 09:53:30 jefft Exp $
Author:
Berin Loritsch

Field Summary
protected  java.beans.PropertyChangeSupport m_eventSupport
           
protected  long m_previousModified
           
protected static java.lang.String MODIFIED
           
 
Constructor Summary
Resource(java.lang.String location)
          Required constructor.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          This is the prefered method of registering a PropertyChangeListender.
protected  void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          This is a convenience if you want to expose other properties for the Resource.
protected  void addPropertyChangeListenersFrom(Resource other)
          Abstract method to add the PropertyChangeListeners in another Resource to this one.
 java.lang.String getResourceKey()
          Return the key for the resource.
 boolean hasListeners()
          This is the preferred method of determining if a Resource has listeners.
protected  boolean hasListeners(java.lang.String property)
          This is a convenience if you want to expose other properties for the Resource.
abstract  long lastModified()
          The time this was last modified.
protected  void removeAllPropertyChangeListeners()
          This cleanup method removes all listeners
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          This is the prefered method of unregistering a PropertyChangeListender.
protected  void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          This is a convenience if you want to expose other properties for the Resource.
 void testModifiedAfter(long time)
          Test whether this has been modified since time X
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODIFIED

protected static final java.lang.String MODIFIED

m_eventSupport

protected java.beans.PropertyChangeSupport m_eventSupport

m_previousModified

protected long m_previousModified
Constructor Detail

Resource

public Resource(java.lang.String location)
         throws java.lang.Exception
Required constructor. The String location is transformed by the specific resource monitor. For instance, a FileResource will be able to convert a string representation of a path to the proper File object.
Method Detail

getResourceKey

public final java.lang.String getResourceKey()
Return the key for the resource.

lastModified

public abstract long lastModified()
The time this was last modified.
Specified by:
lastModified in interface Modifiable

testModifiedAfter

public void testModifiedAfter(long time)
Test whether this has been modified since time X
Specified by:
testModifiedAfter in interface Modifiable

addPropertyChangeListenersFrom

protected void addPropertyChangeListenersFrom(Resource other)
Abstract method to add the PropertyChangeListeners in another Resource to this one.

addPropertyChangeListener

public final void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
This is the prefered method of registering a PropertyChangeListender. It automatically registers the listener for the last modified event.

addPropertyChangeListener

protected void addPropertyChangeListener(java.lang.String property,
                                         java.beans.PropertyChangeListener listener)
This is a convenience if you want to expose other properties for the Resource. It is protected now, but you may override it with public access later.

removePropertyChangeListener

public final void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
This is the prefered method of unregistering a PropertyChangeListender. It automatically registers the listener for the last modified event.

removePropertyChangeListener

protected void removePropertyChangeListener(java.lang.String property,
                                            java.beans.PropertyChangeListener listener)
This is a convenience if you want to expose other properties for the Resource. It is protected now, but you may override it with public access later.

hasListeners

public final boolean hasListeners()
This is the preferred method of determining if a Resource has listeners.

removeAllPropertyChangeListeners

protected void removeAllPropertyChangeListeners()
This cleanup method removes all listeners

hasListeners

protected boolean hasListeners(java.lang.String property)
This is a convenience if you want to expose other properties for the Resource. It is protected now, but you may override it with public access later.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.