EchoPoint
1.0

echopoint.template
Class AbstractDataSource

java.lang.Object
  extended byechopoint.template.AbstractDataSource
All Implemented Interfaces:
DataSource, java.io.Serializable
Direct Known Subclasses:
FileDataSource, ReaderDataSource, StreamDataSource, StringDataSource

public abstract class AbstractDataSource
extends java.lang.Object
implements DataSource, java.io.Serializable

A base class for DataSources implementation

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_ENCODING
          the default encoding is iso-8859-1
 
Constructor Summary
AbstractDataSource()
          AbstractDataSource constructor with encoding.
AbstractDataSource(java.lang.String encoding)
          AbstractDataSource constructor with encoding.
 
Method Summary
abstract  java.lang.String getCanonicalName()
          Returns a canonical name of this DataSource.
 java.lang.String getCharacterEncoding()
          Returns the encoding used by the DataSource
abstract  java.io.Reader getInputReader()
          Gets an Reader of this DataSource.
abstract  long lastModified()
          Returns the time the content of this DataSource was last modified.
 void setCharacterEncoding(java.lang.String newEncoding)
          Sets the encoding used by the data source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ENCODING

public static java.lang.String DEFAULT_ENCODING
the default encoding is iso-8859-1

Constructor Detail

AbstractDataSource

public AbstractDataSource()
AbstractDataSource constructor with encoding.


AbstractDataSource

public AbstractDataSource(java.lang.String encoding)
AbstractDataSource constructor with encoding.

Method Detail

getCanonicalName

public abstract java.lang.String getCanonicalName()
Returns a canonical name of this DataSource.

The name returned here is used to look up the parsing result of the internal caching, so it should differ for all different Sources :-) May return null if this Source is supposed to be parsed each time. The canonical name would be something like a filename or an URL.

Specified by:
getCanonicalName in interface DataSource

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Returns the encoding used by the DataSource

Specified by:
getCharacterEncoding in interface DataSource
Returns:
java.lang.String

getInputReader

public abstract java.io.Reader getInputReader()
                                       throws java.io.IOException
Gets an Reader of this DataSource.

Note that this method may be called twice if the page has to be parsed first. So you probably have to implement a buffer if your underlying source is transient ..

Specified by:
getInputReader in interface DataSource
Throws:
java.io.IOException

lastModified

public abstract long lastModified()
Returns the time the content of this DataSource was last modified.

The return value is used to decide whether to reparse a Source or not. Reparsing is done if the value returned here differs from the value returned at the last processing time. This may not return a 'real' time, it needs just to be comparable to itself; so some sort of version counter would be perfect as well.

Specified by:
lastModified in interface DataSource
Returns:
long a modification time

setCharacterEncoding

public void setCharacterEncoding(java.lang.String newEncoding)
Sets the encoding used by the data source

Parameters:
newEncoding - java.lang.String

EchoPoint
1.0