org.apache.avalon.excalibur.source
Interface ModifiableSource
- All Superinterfaces:
- Source
- All Known Implementing Classes:
- URLSource
- public interface ModifiableSource
- extends Source
Describes a Source
object whose data content can change.
The overall handling of this object is very similar to the handling
of the source object: using the getInputStream() method you get
always the upto-date content. When you're done with using the
source object, you have to release it.
If you want to track changes of the source object, this interface
offers you some support for it by providing a SourceValidity object.
How does the caching work?
The first time you get a ModifiableSource object, you simply ask
it for it's content via getInputStream() and then get the validity
object by invoking getValidity. (Further calls to getValidity always
return the same object! This is not updated!)
The caching algorithm can now store this validity object together
with the system identifier of the source.
The next time, the caching algorithm wants to check if the cached
content is still valid. It has a validity object already to check
against.
If it is still the same ModifiableSource than the first time, you
have to call discardValidity() in order to discard the stored validity
in the ModifiableSource object. If it is a new ModifiableSource object,
calling discardValidity() should do no harm.
After that an upto-date validity object can retrieved by calling
getValidity(). This can be used to test if the content is still valid
as discribed in the source validity documentation.
If the content is still valid, the cache knows what to do, if not,
the new content can be get using getInputStream().
So either after a call to getValidity() or the getInputStream the
validity object must be the same until discardValidity is called!
- Author:
- Ovidiu Predescu, Carsten Ziegeler
getValidity
public SourceValidity getValidity()
- Get the Validity object. This can either wrap the last modification
date or the expires information or...
If it is currently not possible to calculate such an information
null
is returned.
discardValidity
public void discardValidity()
- Refresh the content of this object after the underlying data
content has changed.
Copyright © 2001 Apache Jakarta Project. All Rights Reserved.