Dynamic Template in Java

cb.jdynamite.analyser
Class DefaultAnalyser

java.lang.Object
  |
  +--cb.jdynamite.analyser.DefaultAnalyser
All Implemented Interfaces:
ITemplateAnalyser

public class DefaultAnalyser
extends java.lang.Object
implements ITemplateAnalyser

This class analyses the input template document and builds the JDynamiTe document structure, which is made up of "ITemplateElements".
A JDynamiTe document is structurally a tree where the nodes are "DynamicElement" objects, and where the leaves are the other objects.
An analyser is attached to an "ITemplateDocument" (JDynamiTe object), which is the "root" Dynamic Element of the tree.

See Also:
JDynamiTe

Field Summary
static java.lang.String HTML_BEGIN_DYNAMIC_TAG
          HTML default "Begin Dynamic Element" tag.
static java.lang.String HTML_BEGIN_IGNORED_TAG
          HTML default "Begin Ignored Element" tag.
static java.lang.String HTML_END_DYNAMIC_TAG
          HTML default "End Dynamic Element" tag.
static java.lang.String HTML_END_IGNORED_TAG
          HTML default "End Ignored Element" tag.
static java.lang.String HTML_VARIABLE_TAG
          HTML default "Variable" tag.
static java.lang.String SCRIPT_BEGIN_DYNAMIC_TAG
           
static java.lang.String SCRIPT_END_DYNAMIC_TAG
           
static java.lang.String SCRIPT_VARIABLE_TAG
           
static java.lang.String XML_BEGIN_DYNAMIC_TAG
           
static java.lang.String XML_END_DYNAMIC_TAG
           
static java.lang.String XML_VARIABLE_TAG
           
 
Constructor Summary
DefaultAnalyser()
           
 
Method Summary
 void analyse(ITemplateDocument rootDocument, IDynamicElement rootElem, java.io.BufferedReader inputText)
           
 void DefaultAnalyser()
           
protected  void doAnalyse(IDynamicElement dynElem, int depth)
           
 boolean getDebug()
           
 gnu.regexp.RE getDynamicBeginRegExp()
           
 gnu.regexp.RE getDynamicEndRegExp()
           
 gnu.regexp.RE getIgnoredBeginRegExp()
           
 gnu.regexp.RE getIgnoredEndRegExp()
           
 gnu.regexp.RE getVariableRegExp()
           
 void setDebug(boolean debugMode)
           
 void setDynamicBeginRegExp(java.lang.String dynamicBeginRegExp)
           
 void setDynamicEndRegExp(java.lang.String dynamicEndRegExp)
           
 void setIgnoredBeginRegExp(java.lang.String ignoredBeginRegExp)
           
 void setIgnoredEndRegExp(java.lang.String ignoredEndRegExp)
           
 void setVariableRegExp(java.lang.String variableRegExp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML_VARIABLE_TAG

public static java.lang.String HTML_VARIABLE_TAG
HTML default "Variable" tag. This is the regular expression for a word (within brackets) made up of alplanumeric (and '.', '_', ':', '-') character(s). Examples : "Table2.name" or "page-title".
"[\w._:-]+" is the regular expression for a word made up of alplanumeric (and '.', '_', ':', '-') character(s).
Important: the variable name (the key) is this word wich matches the first "regexp" subexpression. That's why this word should be enclosed within brackets.
See GNU regexp package documentation for more details on regular expressions.

HTML_BEGIN_DYNAMIC_TAG

public static java.lang.String HTML_BEGIN_DYNAMIC_TAG
HTML default "Begin Dynamic Element" tag. This regular expression is :
"<!-- *BEGIN *DYNAMIC.*: *([\w._:-]+) *-->".
For example:
"<-- BEGIN DYNAMIC : myList -->".
or
"<-- BEGIN DYNAMIC BLOCK: myList -->".
Important: the element name is this word wich matches the first "regexp" subexpression. That's why this word should be enclosed within brackets.
See GNU regexp package documentation.

HTML_END_DYNAMIC_TAG

public static java.lang.String HTML_END_DYNAMIC_TAG
HTML default "End Dynamic Element" tag. This regular expression is :
"<-- *END *DYNAMIC.*-->".
For example:
"<-- END DYNAMIC : myList -->".
or
"<-- END DYNAMIC BLOCK: myList -->".
See GNU regexp package documentation.

HTML_BEGIN_IGNORED_TAG

public static java.lang.String HTML_BEGIN_IGNORED_TAG
HTML default "Begin Ignored Element" tag. This regular expression is :
 "<!-- *BEGIN *IGNORED.*: *([\w._:-]+) *-->".
 
For example:
 "<-- BEGIN IGNORED : myLinesExample -->".
 
See GNU regexp package documentation.
Since:
JDynamiTe 1.1

HTML_END_IGNORED_TAG

public static java.lang.String HTML_END_IGNORED_TAG
HTML default "End Ignored Element" tag. This regular expression is :
 "<-- *END *IGNORED.*-->".
 
For example:
 "<-- END IGNORED : myList -->".
 
See GNU regexp package documentation.
Since:
JDynamiTe 1.1

XML_VARIABLE_TAG

public static java.lang.String XML_VARIABLE_TAG

XML_BEGIN_DYNAMIC_TAG

public static java.lang.String XML_BEGIN_DYNAMIC_TAG

XML_END_DYNAMIC_TAG

public static java.lang.String XML_END_DYNAMIC_TAG

SCRIPT_VARIABLE_TAG

public static java.lang.String SCRIPT_VARIABLE_TAG

SCRIPT_BEGIN_DYNAMIC_TAG

public static java.lang.String SCRIPT_BEGIN_DYNAMIC_TAG

SCRIPT_END_DYNAMIC_TAG

public static java.lang.String SCRIPT_END_DYNAMIC_TAG
Constructor Detail

DefaultAnalyser

public DefaultAnalyser()
Method Detail

DefaultAnalyser

public void DefaultAnalyser()

analyse

public void analyse(ITemplateDocument rootDocument,
                    IDynamicElement rootElem,
                    java.io.BufferedReader inputText)
             throws java.io.IOException
Specified by:
analyse in interface ITemplateAnalyser

getVariableRegExp

public gnu.regexp.RE getVariableRegExp()
Specified by:
getVariableRegExp in interface ITemplateAnalyser

setVariableRegExp

public void setVariableRegExp(java.lang.String variableRegExp)
                       throws cb.jdynamite.analyser.REException

getDynamicBeginRegExp

public gnu.regexp.RE getDynamicBeginRegExp()

setDynamicBeginRegExp

public void setDynamicBeginRegExp(java.lang.String dynamicBeginRegExp)
                           throws cb.jdynamite.analyser.REException

getDynamicEndRegExp

public gnu.regexp.RE getDynamicEndRegExp()

setDynamicEndRegExp

public void setDynamicEndRegExp(java.lang.String dynamicEndRegExp)
                         throws cb.jdynamite.analyser.REException

getIgnoredBeginRegExp

public gnu.regexp.RE getIgnoredBeginRegExp()

setIgnoredBeginRegExp

public void setIgnoredBeginRegExp(java.lang.String ignoredBeginRegExp)
                           throws cb.jdynamite.analyser.REException

getIgnoredEndRegExp

public gnu.regexp.RE getIgnoredEndRegExp()

setIgnoredEndRegExp

public void setIgnoredEndRegExp(java.lang.String ignoredEndRegExp)
                         throws cb.jdynamite.analyser.REException

getDebug

public boolean getDebug()

setDebug

public void setDebug(boolean debugMode)

doAnalyse

protected void doAnalyse(IDynamicElement dynElem,
                         int depth)

JDynamiTe

Copyright Christophe Bouleau