com.bitmechanic.maxq.generator
Class TemplateLogic

java.lang.Object
  extended by com.bitmechanic.maxq.generator.TemplateLogic
Direct Known Subclasses:
HttpUnitTemplateLogic

public class TemplateLogic
extends java.lang.Object

A helper object that can be used in the test templates.

The TemplateCodeGenerator renders the themeTest.vm template, evaluating the #set() expressions contained in there. If $templateLogic variable is set, it's value is used as a name of the class to be instantiated. A single instance of the class is associated with a TemplateCodeGenerator throughout its lifetime, therefore it is strongly recommended for the logic class to be stateless. The instance will be available during rendering themeNewScenario.vm and themeInterchange.vm templates in the $logic variable.

No interface requirements are imposed on the class selected using $templateLogic variable.

Version:
$Id: TemplateLogic.java,v 1.1 2005/03/17 10:54:38 rkrzewsk Exp $
Author:
Rafal Krzewski

Constructor Summary
TemplateLogic()
          Creates new TemplateLogic instance.
 
Method Summary
 java.lang.String escapeParam(java.lang.String param)
          Escape a form parameter value in a way suitable for a String literal.
 java.lang.String getBaseUrl()
          Returns the applications base URL.
protected  Config getConfig()
          Returns the MaxQ config.
 java.lang.String getRelativeUrl(java.lang.String url)
          Returns an URL relative to the configured base URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateLogic

public TemplateLogic()
Creates new TemplateLogic instance.

Method Detail

getBaseUrl

public java.lang.String getBaseUrl()
Returns the applications base URL.

Returns:
the applications base URL.

getRelativeUrl

public java.lang.String getRelativeUrl(java.lang.String url)
Returns an URL relative to the configured base URL.

Parameters:
url - the URL.
Returns:
an URL relative to the configured base URL.

escapeParam

public java.lang.String escapeParam(java.lang.String param)
Escape a form parameter value in a way suitable for a String literal.

" and \ characters will be escaped with a leading \.

Parameters:
param - parameter value.
Returns:
escaped parameter value.

getConfig

protected Config getConfig()
Returns the MaxQ config.

Returns:
the MaxQ config.