|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.cocoon.components.source.DelayedRefreshSourceWrapper
A wrapper around a Source
that reduces the number of calls to
Source.getLastModified()
which can be a costly operation.
Constructor Summary | |
DelayedRefreshSourceWrapper(Source source,
long delay)
Creates a wrapper for a Source which ensures that
Source.getLastModified() won't be called more than once per
delay milliseconds period. |
Method Summary | |
long |
getContentLength()
Get the content length of the source or -1 if it is not possible to determine the length. |
org.xml.sax.InputSource |
getInputSource()
Return an InputSource object to read the XML
content. |
java.io.InputStream |
getInputStream()
Return an InputStream object to read from the source. |
long |
getLastModified()
Get the last modification time for the wrapped Source . |
java.lang.String |
getSystemId()
Return the unique identifer for this source |
void |
recycle()
|
void |
refresh()
Force the refresh of the wrapped Source , even if the refresh period
isn't over, and starts a new period.
|
void |
toSAX(org.xml.sax.ContentHandler handler)
Generates SAX events representing the object's state. NOTE : if the implementation can produce lexical events, care should be taken that handler can actually be a XMLConsumer that accepts such
events. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DelayedRefreshSourceWrapper(Source source, long delay)
Source
which ensures that
Source.getLastModified()
won't be called more than once per
delay
milliseconds period.source
- the wrapped Source
delay
- the last-modified refresh delay, in millisecondsMethod Detail |
public final long getLastModified()
Source
. The
age of the returned information is guaranteed to be lower than or equal to
the delay specified in the constructor.
This method is also thread-safe, even if the underlying Source is not.
getLastModified
in interface Source
public final void refresh()
Source
, even if the refresh period
isn't over, and starts a new period.
This method is thread-safe, even if the underlying Source is not.
refresh
in interface ModifiableSource
public final long getContentLength()
Source
getContentLength
in interface Source
public final java.io.InputStream getInputStream() throws ProcessingException, java.io.IOException
Source
InputStream
object to read from the source.getInputStream
in interface Source
public final org.xml.sax.InputSource getInputSource() throws ProcessingException, java.io.IOException
Source
InputSource
object to read the XML
content.getInputSource
in interface Source
org.apache.cocoon.environment.Source
InputSource
valueProcessingException
- if an error occursjava.io.IOException
- if an error occurspublic final java.lang.String getSystemId()
Source
getSystemId
in interface Source
public final void recycle()
recycle
in interface org.apache.avalon.excalibur.pool.Recyclable
public final void toSAX(org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException, ProcessingException
XMLizable
handler
can actually be a XMLConsumer
that accepts such
events.toSAX
in interface XMLizable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |