Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.doc.util.content
Class AbstractVelocityContent

java.lang.Object
  extended by eu.esdihumboldt.hale.doc.util.content.AbstractVelocityContent
All Implemented Interfaces:
org.eclipse.help.IHelpContentProducer
Direct Known Subclasses:
ExamplesContent, FunctionReferenceContent

public abstract class AbstractVelocityContent
extends Object
implements org.eclipse.help.IHelpContentProducer

Help content based on velocity templates. Use getContentFromTemplate(String, String, Callable) in your IHelpContentProducer.getInputStream(String, String, Locale) implementation.

Author:
Simon Templer

Constructor Summary
AbstractVelocityContent()
           
 
Method Summary
protected  InputStream getContentFromTemplate(String contentId, String templateId, Callable<org.apache.velocity.VelocityContext> contextFactory)
          Generate content from the template and the given context factory.
protected abstract  InputStream getTemplate(String templateId)
          Get the template content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.help.IHelpContentProducer
getInputStream
 

Constructor Detail

AbstractVelocityContent

public AbstractVelocityContent()
Method Detail

getContentFromTemplate

protected InputStream getContentFromTemplate(String contentId,
                                             String templateId,
                                             Callable<org.apache.velocity.VelocityContext> contextFactory)
                                      throws Exception
Generate content from the template and the given context factory. If called more than once with the same id, the previously generated content for that id is returned.

Parameters:
contentId - the content id
templateId - the template id (there may be multiple templates)
contextFactory - the context factory, is called once or not at all
Returns:
the content input stream to return in IHelpContentProducer.getInputStream(String, String, Locale)
Throws:
Exception - if an error occurs creating the content

getTemplate

protected abstract InputStream getTemplate(String templateId)
                                    throws Exception
Get the template content.

Parameters:
templateId - the template id (there may be multiple templates)
Returns:
the template as input stream
Throws:
Exception - if an error occurs retrieving the template

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d