org.melati.app
Class AbstractTemplateApp

Package class diagram package AbstractTemplateApp
java.lang.Object
  extended by org.melati.app.AbstractConfigApp
      extended by org.melati.app.AbstractPoemApp
          extended by org.melati.app.AbstractTemplateApp
All Implemented Interfaces:
App
Direct Known Subclasses:
DSDApp, TemplateApp

public abstract class AbstractTemplateApp
extends AbstractPoemApp
implements App

Base class to use Melati as an application with a Template Engine. To create your own application simply extend this class, overriding the doTemplateRequest(org.melati.Melati, org.melati.template.TemplateContext) method.


Field Summary
protected  TemplateEngine templateEngine
           
 
Fields inherited from class org.melati.app.AbstractConfigApp
melatiConfig, output
 
Constructor Summary
AbstractTemplateApp()
           
 
Method Summary
protected  String addExtension(String templateName)
          The template extension is added in an overridable method to allow the application developer to specify their own template extensions.
protected  void doPoemRequest(Melati melati)
          Fulfill AbstractPoemApp's promises.
protected abstract  String doTemplateRequest(Melati melati, TemplateContext templateContext)
          Override this method to build up your own output.
 Melati init(String[] args)
          Initialise.
 
Methods inherited from class org.melati.app.AbstractPoemApp
_handleException, doConfiguredRequest, handleException, poemContext, poemContextWithLDB, prePoemSession, setTableTroidMethod, term
 
Methods inherited from class org.melati.app.AbstractConfigApp
applyNamedArguments, getSysAdminEmail, getSysAdminName, melatiConfig, run, setOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.melati.app.App
run, setOutput
 

Field Detail

templateEngine

protected TemplateEngine templateEngine
Constructor Detail

AbstractTemplateApp

public AbstractTemplateApp()
Method Detail

init

public Melati init(String[] args)
            throws MelatiException
Initialise.

Overrides:
init in class AbstractPoemApp
Parameters:
args - the command line arguments
Returns:
a configured Melati a newly created Melati
Throws:
MelatiException - if something goes wrong during initialisation
See Also:
AbstractPoemApp.init(java.lang.String[])

doPoemRequest

protected void doPoemRequest(Melati melati)
                      throws Exception
Fulfill AbstractPoemApp's promises.

Specified by:
doPoemRequest in class AbstractPoemApp
Parameters:
melati - the Melati
Throws:
Exception - if anything goes wrong
See Also:
AbstractPoemApp.doPoemRequest(org.melati.Melati)

addExtension

protected String addExtension(String templateName)
The template extension is added in an overridable method to allow the application developer to specify their own template extensions.


doTemplateRequest

protected abstract String doTemplateRequest(Melati melati,
                                            TemplateContext templateContext)
                                     throws Exception
Override this method to build up your own output.

Parameters:
melati - the current Melati
templateContext - the current TemplateContext
Returns:
a Template name, possibly excluding extension.
Throws:
Exception


Copyright © 2000-2010 PanEris. All Rights Reserved.