org.openmobileis.embedded.webserver.templates
Class TemplateManager

java.lang.Object
  extended byorg.openmobileis.embedded.webserver.templates.TemplateManager

public class TemplateManager
extends java.lang.Object

Title: OpenMobileIS project source
Description: Manage pattern (templates) for HTML forms used by the PDA web server

It is based on singleton model. The path gives the location of the patterns (should terminate by a file separator). The API getHTMLFile (patternName, variables) allow to get the HTML file from a pattern and a list of variables. The default implementation use the freemarker template manager. See freemarker for more information. Inside the pattern, the variables are tagged by ${}.

Since:
JDK 1.1
Version:
1.0.
Author:
Philippe Delrieu

Method Summary
 void cacheUnavailable(CacheEvent e)
           
 void elementRemoved(CacheEvent e)
           
 void elementUpdated(CacheEvent e)
           
 void elementUpdateFailed(CacheEvent e)
           
static TemplateManager getManager()
           
 Template getTemplate(java.lang.String relatifPath)
          return the template with specified relative name.
 TemplateModelRoot getTemplateModelRoot()
          initialize template structure for this request.
protected  void init()
          init template and cache management.
 void sendResponse(java.lang.String templateName, TemplateModelRoot modelRoot, HttpServletResponse res)
           
 void setTemplateRootPath(java.lang.String rootPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getManager

public static TemplateManager getManager()

setTemplateRootPath

public void setTemplateRootPath(java.lang.String rootPath)

init

protected void init()
init template and cache management. cache template is use to detect cache update during synchronization


cacheUnavailable

public void cacheUnavailable(CacheEvent e)

elementUpdated

public void elementUpdated(CacheEvent e)

elementUpdateFailed

public void elementUpdateFailed(CacheEvent e)

elementRemoved

public void elementRemoved(CacheEvent e)

getTemplateModelRoot

public TemplateModelRoot getTemplateModelRoot()
initialize template structure for this request.


getTemplate

public Template getTemplate(java.lang.String relatifPath)
return the template with specified relative name. The path to find the temlpate is template install directory(intalpath/cn/openmischannel/template/"+relatifName. The relatid name must not begin with file separator. The relative name must is plate-forme specific file separators. Return null if not found.


sendResponse

public void sendResponse(java.lang.String templateName,
                         TemplateModelRoot modelRoot,
                         HttpServletResponse res)
                  throws java.io.IOException,
                         TemplateNotFoundException
Throws:
java.io.IOException
TemplateNotFoundException


Copyright 2005 e-Care. All Rights Reserved.