org.melati.template
Class NoTemplateEngine

Package class diagram package NoTemplateEngine
java.lang.Object
  extended by org.melati.template.AbstractTemplateEngine
      extended by org.melati.template.NoTemplateEngine
All Implemented Interfaces:
ServletTemplateEngine, TemplateEngine

public class NoTemplateEngine
extends AbstractTemplateEngine
implements ServletTemplateEngine

The null ServletTemplateEngine.

Author:
Tim Joyce

Field Summary
 
Fields inherited from class org.melati.template.AbstractTemplateEngine
roots
 
Constructor Summary
NoTemplateEngine()
          Constructor.
 
Method Summary
 String expandedTemplate(Template melatiTemplate, TemplateContext templateContext)
          Expand the Template against the context.
 void expandTemplate(MelatiWriter out, String templateName, TemplateContext templateContext)
          Expand the Template against the context.
 void expandTemplate(MelatiWriter out, Template melatiTemplate, TemplateContext templateContext)
          Expand the Template against the context.
 Object getEngine()
          Get the underlying engine.
 String getName()
          The name of the template engine (used to find the templets).
 ServletTemplateContext getServletTemplateContext(Melati melati)
          Throw exception.
 MelatiWriter getServletWriter(javax.servlet.http.HttpServletResponse response, boolean buffered)
          Get a Writer which can write to Servlet output.
 MelatiStringWriter getStringWriter()
          Return a MelatiStringWriter.
 TemplateContext getTemplateContext(Melati melati)
          Throw exception.
 void init(MelatiConfig config)
          Construct a null Engine.
 void init(MelatiConfig melatiConfig, javax.servlet.http.HttpServlet servlet)
          Construct a new Engine for use in a servlet environment.
 Template template(String templateName)
          Get a template given its name.
 String templateExtension()
           
 
Methods inherited from class org.melati.template.AbstractTemplateEngine
addRoot, getRoots, getTemplateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.melati.template.TemplateEngine
addRoot, getRoots, getTemplateName
 

Constructor Detail

NoTemplateEngine

public NoTemplateEngine()
Constructor.

Method Detail

init

public void init(MelatiConfig config)
Construct a null Engine.

Specified by:
init in interface TemplateEngine
Parameters:
config - a MelatiConfig

init

public void init(MelatiConfig melatiConfig,
                 javax.servlet.http.HttpServlet servlet)
          throws TemplateEngineException
Construct a new Engine for use in a servlet environment.

Specified by:
init in interface ServletTemplateEngine
Parameters:
melatiConfig - a MelatiConfig
servlet - the servlet we are within
Throws:
TemplateEngineException - if any problem occurs with the engine
See Also:
TemplateServlet

getTemplateContext

public TemplateContext getTemplateContext(Melati melati)
                                   throws TemplateEngineException
Throw exception.

Specified by:
getTemplateContext in interface TemplateEngine
Parameters:
melati - the Melati
Returns:
a TemplateContext
Throws:
TemplateEngineException - if any problem occurs with the engine

getServletTemplateContext

public ServletTemplateContext getServletTemplateContext(Melati melati)
                                                 throws TemplateEngineException
Throw exception.

Specified by:
getServletTemplateContext in interface ServletTemplateEngine
Parameters:
melati - the Melati
Returns:
an exception
Throws:
TemplateEngineException - always

getName

public String getName()
The name of the template engine (used to find the templets).

Specified by:
getName in interface TemplateEngine
Returns:
the name of the current configured template engine

templateExtension

public String templateExtension()
Specified by:
templateExtension in interface TemplateEngine
Returns:
the extension of the templates used by this template engine

template

public Template template(String templateName)
Get a template given its name.

Specified by:
template in interface TemplateEngine
Parameters:
templateName - the name of the template to find
Returns:
a template

expandTemplate

public void expandTemplate(MelatiWriter out,
                           String templateName,
                           TemplateContext templateContext)
                    throws TemplateEngineException
Expand the Template against the context.

Specified by:
expandTemplate in interface TemplateEngine
Parameters:
out - a MelatiWriter to output on
templateName - the name of the template to expand
templateContext - the ServletTemplateContext to expand the template against
Throws:
TemplateEngineException - if invoked

expandTemplate

public void expandTemplate(MelatiWriter out,
                           Template melatiTemplate,
                           TemplateContext templateContext)
                    throws TemplateEngineException
Expand the Template against the context.

Specified by:
expandTemplate in interface TemplateEngine
Parameters:
out - a MelatiWriter to output on
melatiTemplate - the Template to expand
templateContext - the ServletTemplateContext to expand the template against
Throws:
TemplateEngineException - if invoked

expandedTemplate

public String expandedTemplate(Template melatiTemplate,
                               TemplateContext templateContext)
                        throws TemplateEngineException
Expand the Template against the context.

Specified by:
expandedTemplate in interface TemplateEngine
Parameters:
melatiTemplate - the Template to expand
templateContext - the ServletTemplateContext to expand the template against
Returns:
the interpolated template as a String
Throws:
TemplateEngineException - if invoked
See Also:
(org.melati.template.Template, org.melati.template.TemplateContext)

getServletWriter

public MelatiWriter getServletWriter(javax.servlet.http.HttpServletResponse response,
                                     boolean buffered)
Description copied from interface: ServletTemplateEngine
Get a Writer which can write to Servlet output.

Specified by:
getServletWriter in interface ServletTemplateEngine
Parameters:
response - the HttpServletResponse that this writer will be part of
buffered - whether the writer should be buffered
Returns:
a MelatiWriter appropriate for this engine.

getStringWriter

public MelatiStringWriter getStringWriter()
Return a MelatiStringWriter.

Specified by:
getStringWriter in interface TemplateEngine
Returns:
a MelatiStringWriter.
See Also:
TemplateEngine.getStringWriter(), Melati.getStringWriter()

getEngine

public Object getEngine()
Get the underlying engine.

Specified by:
getEngine in interface TemplateEngine
Returns:
'none'


Copyright © 2000-2010 PanEris. All Rights Reserved.