echopointng.template
Interface TemplateDataSource

All Known Implementing Classes:
AbstractTemplateDataSource, FileTemplateDataSource, JspTemplateDataSource, ResourceTemplateDataSource, StringTemplateDataSource

public interface TemplateDataSource

TemplateDataSource is used to return template source data and encoding information for this data.

A single TemplateDataSource can be used as the source for multiple TemplatePanels. This helps reduce the memory footprint of the template data. An implementation of this interface must keep the requirement in mind.


Method Summary
 TemplateCachingHints getCachingHints()
          This returns a hint to the template rendering mechanism as to whether this template data can be cached.
 java.lang.String getCanonicalName()
          Returns a canonical name of this TemplateDataSource.
 java.lang.String getCharacterEncoding()
          This returns the character encoding of the TemplateDataSource.
 java.lang.String getContentType()
          This content type of the template data is used by the rendering framework to find an appropriate template compiler.
 java.io.InputStream getInputStream()
          Gets an InputStream of this TemplateDataSource.
 

Method Detail

getCanonicalName

java.lang.String getCanonicalName()
Returns a canonical name of this TemplateDataSource.

The name returned here is used to look up the parsing result of the internal caching, so it should differ for all different TemplateDataSource objects :-)

May return null if this TemplateDataSource is supposed to be parsed each time. The canonical name would be something like a filename or an URL.

Returns:
a unique name of the TemplateDataSource

getContentType

java.lang.String getContentType()
This content type of the template data is used by the rendering framework to find an appropriate template compiler.

An example content type is text/xhtml and cause a template compiler to be found for XHTML template data.

Returns:
the content type of the template data

getCharacterEncoding

java.lang.String getCharacterEncoding()
This returns the character encoding of the TemplateDataSource.

This will be used to create a new InputStreamReader(stream,characterEncoding) from the InputStream return by getInputStream().

Returns:
the character encoding of the TemplateDataSource as defined by the java.io.InputStreamReader() specification.
See Also:
InputStreamReader.InputStreamReader(java.io.InputStream, java.lang.String)

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Gets an InputStream of this TemplateDataSource.

Note that this method may be called multiple times in the life of the TemplateDataSource. So you probably have to implement a buffer if your underlying data source is transient ..

Returns:
a InputStream containing the template data
Throws:
java.io.IOException

getCachingHints

TemplateCachingHints getCachingHints()
This returns a hint to the template rendering mechanism as to whether this template data can be cached. If null is returned then the template data will never be cached.

However the inverse is not necessarily the case. You may return a TemplateCachingHints, however this does not mean the rendering mechanism will cache the template data.

You might return null if the template data is especially large and you dont want it retained in cache memory.

Returns:
null if the template data should not be cached or a TemplateCachingHints to say how it might be cached.