EchoPoint API - 3.0.0b5
App Webcontainer

echopoint.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.
 String getCanonicalName()
          Returns a canonical name of this TemplateDataSource.
 String getCharacterEncoding()
          This returns the character encoding of the TemplateDataSource.
 TemplateCompilerHints getCompilerHints()
          This returns a hint to the underlying template compiler mechanism as to how the template data should be compiled into XHTML.
 String getContentType()
          This content type of the template data is used by the rendering framework to find an appropriate template compiler.
 InputStream getInputStream()
          Gets an InputStream of this TemplateDataSource.
 

Method Detail

getCanonicalName

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

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

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

InputStream getInputStream()
                           throws 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:
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.

getCompilerHints

TemplateCompilerHints getCompilerHints()
This returns a hint to the underlying template compiler mechanism as to how the template data should be compiled into XHTML.

Most of the TemplateCompilerHints properties are really aimed as JAXP XML parser implementations but you can provide generic values via the getAttribute() mechanism.

Returns:
a TemplateCompilerHints implementation or null if there are no compiler hints

EchoPoint API - 3.0.0b5
App Webcontainer