Stellent
HowToComponents
JavaDoc

intradoc.common
Class DynamicHtml

java.lang.Object
  |
  +--intradoc.common.DynamicHtml

public class DynamicHtml
extends java.lang.Object

Loads and evaluates idoc script resources containing Intradoc server side script.


Field Summary
static int CLOSE_TAG_EXTRA_LENGTH
           
 DynamicHtml m_capturedVersion
          If m_tempKey is null, set to a version up the linked list (opposite the order of m_priorScript) to pop to when disposing of this instance.
 java.util.Vector m_data
          Raw (character) data attached to the dynamic html.
protected  int m_exteriorNestingLevel
          Tracks exterior nesting level (loop and endloop structures creating an exterior nesting).
protected  java.util.Vector m_exteriorNestingTracker
          Array of ParseLocationInfo objects for the exterior nesting level (loop and endloop nestings).
 java.lang.String m_fileName
          If html is parsed from file, this is the name of the file.
 HtmlChunk[] m_htmlChunkArray
          Used to speed up processing, especially in HPUX.
 java.util.Vector m_htmlChunks
          Array with each item being either a piece of HTML or a script action.
protected  java.util.Vector m_interiorNestingTracker
          Vector holding array of Vectors with each Vector entry being an array of ParseLocationInfo objects.
protected  boolean m_isInData
          Used to indicate whether we are in the middle of extracting a raw data construct inside the file.
static int m_maximumExecutionRecursion
          Maximum nesting level during execution of script.
 int m_parseCharOffset
          Parse character offset from beginning of line where script occurs.
 int m_parseLine
          Parse line where script occurs.
 DynamicHtml m_priorScript
          Back pointer to previous implementation of this resource.
 java.lang.String m_resourceString
          If html is parsed directly of a string, then this is the original string for error reporting.
 java.lang.String m_sourceEncoding
          The character set encoding of the source for this object.
 java.lang.String m_tempKey
          Indicates the key to use when looking it up as a temporary resource.
 long m_timeStamp
          Timestamp of resource being used to load this object.
static char[] XML_SCRIPT_TAG
           
static char[] XML_SCRIPT_TAG_END_CHARS
           
static char[] XML_SCRIPT_TAG_START_CHARS
          Constant prefix used when parsing XML style Idoc script (used in hcsp pages).
 
Constructor Summary
DynamicHtml()
          Default constructor.
 
Method Summary
protected  void addChunks(java.io.Reader reader, java.io.CharArrayWriter outbuf, ParseOutput parseOutput, IdcBreakpoints bp)
          Does actual work of parsing HTML server side script into preparsed 'chunks'.
 void addNestingInfo(java.util.Vector parseInfos, ParseOutput parseOutput)
          Stores nesting information (loop -> endloop or if -> endif).
 void checkBreakpoint(HtmlChunk chunk, GrammarElement elt, DynamicHtmlOutput dynCallback)
           
protected  boolean checkCondition(HtmlChunk chunk, DynamicHtmlOutput dynCallback, GrammarElement elt)
          Calls callback interface to do a condition check.
protected  void createAbsoluteSyntaxException(HtmlChunk chunk, ParseSyntaxException e)
          Creates a ParseSyntaxException by merging information from a ParseSyntaxException containing relative error information with the absolute location information the HtmlChunk object.
 void createNestingException(java.util.Vector parseInfos, java.lang.String msg)
          Throws an exception computing appropriate offsets based on nested loops or conditionals.
 DynamicHtml findEarliestValidPriorScript(DynamicHtml priorResource)
          Using file name matches it compares a new object (this one) against a prexisting object (the passed in parameter) and tries to pick out an appropriate prior script parent that would make an appropriate prior script for the new object.
protected  boolean findScriptTag(java.io.Reader reader, ParseOutput parseOutput)
           
 DynamicHtml getPriorScript()
          Retrieves backpointer to prior implementation of this script resource.
 void loadHtml(java.io.Reader reader, java.lang.String fileName, boolean isXmlSyntax)
          Loads HTML server side script from a reader.
 void loadHtmlEx(java.io.Reader reader, java.lang.String fileName, boolean isXmlSyntax, IdcBreakpoints bp)
           
 void loadHtmlInContext(java.io.Reader reader, ParseOutput parseOutput)
          Loads HTML server side script, can be called on resources stored inside files.
 void loadHtmlInContextEx(java.io.Reader reader, ParseOutput parseOutput, IdcBreakpoints bp)
           
 void outputHtml(java.io.Writer writer, DynamicHtmlOutput dynCallback)
          Evaluates this server side page and writes results out to a Writer
protected  int outputHtmlEx(int curIndex, java.io.Writer writer, DynamicHtmlOutput dynCallback, int exitType, boolean doOutput, boolean[] isBreak, int[] retType, int nestLevel)
          This service is called recursively.
 GrammarElement parseGrammarStatement(HtmlChunk chunk, GrammarParseState parseState)
          Parses a server side script statement into its grammatical elements.
 void setPriorScript(DynamicHtml priorScript)
          Sets the backpointer to prior implementation of this script resource.
 DynamicHtml shallowClone()
          Used to get a shallow clone so some external reference entries (such as prior script) can be changed.
 DynamicHtml shallowCloneWithPriorScript(DynamicHtml priorScript)
          Used to perform a shallow clone of this object so a different prior script can be assigned.
protected  void substituteVariable(HtmlChunk chunk, java.io.Writer writer, DynamicHtmlOutput dynCallback, GrammarElement elt)
          Calls callback interface to substitute variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_SCRIPT_TAG_START_CHARS

public static final char[] XML_SCRIPT_TAG_START_CHARS
Constant prefix used when parsing XML style Idoc script (used in hcsp pages).


XML_SCRIPT_TAG_END_CHARS

public static final char[] XML_SCRIPT_TAG_END_CHARS

XML_SCRIPT_TAG

public static final char[] XML_SCRIPT_TAG

CLOSE_TAG_EXTRA_LENGTH

public static final int CLOSE_TAG_EXTRA_LENGTH
See Also:
Constant Field Values

m_htmlChunks

public java.util.Vector m_htmlChunks
Array with each item being either a piece of HTML or a script action.


m_htmlChunkArray

public HtmlChunk[] m_htmlChunkArray
Used to speed up processing, especially in HPUX. Arrays aren't synchronized so no contention occurs for the objects, as opposed to Vectors.


m_sourceEncoding

public java.lang.String m_sourceEncoding
The character set encoding of the source for this object. Set only if known for sure and might cause problems if changed when output is generated from this object. Note: this encoding is the Java VM name for the encoding.


m_timeStamp

public long m_timeStamp
Timestamp of resource being used to load this object. This value is not supplied internally but is provided purely for the convenience of external users of this object.


m_interiorNestingTracker

protected java.util.Vector m_interiorNestingTracker
Vector holding array of Vectors with each Vector entry being an array of ParseLocationInfo objects. A ParseLocationInfo object is added each time an "if" construct is encountered, and removed each time an endif is encountered. At the start of a loop, a new Vector of ParseLocationInfo objects is appended and at the end of the loop the array of objects should be empty. If it is not then there is an error.


m_exteriorNestingLevel

protected int m_exteriorNestingLevel
Tracks exterior nesting level (loop and endloop structures creating an exterior nesting). Used to keep track of what index to use into the m_nestingTracker Vector.


m_exteriorNestingTracker

protected java.util.Vector m_exteriorNestingTracker
Array of ParseLocationInfo objects for the exterior nesting level (loop and endloop nestings).


m_priorScript

public DynamicHtml m_priorScript
Back pointer to previous implementation of this resource. Allows usage of inheritance model in resource includes.


m_tempKey

public java.lang.String m_tempKey
Indicates the key to use when looking it up as a temporary resource. If is null, then it is not at the root of a partial temporary stack. If key has a value, then m_capturedVersion is new version to swap in. Note: if m_capturedVersion is null then there is no persistent active version and all references in the active collection should be removed.


m_capturedVersion

public DynamicHtml m_capturedVersion
If m_tempKey is null, set to a version up the linked list (opposite the order of m_priorScript) to pop to when disposing of this instance. Otherwise points to the original noncloned version of this resource.


m_parseLine

public int m_parseLine
Parse line where script occurs.


m_parseCharOffset

public int m_parseCharOffset
Parse character offset from beginning of line where script occurs.


m_fileName

public java.lang.String m_fileName
If html is parsed from file, this is the name of the file.


m_resourceString

public java.lang.String m_resourceString
If html is parsed directly of a string, then this is the original string for error reporting. If attribute is null then resource was parsed iteratively from a reader.


m_data

public java.util.Vector m_data
Raw (character) data attached to the dynamic html. It consists of a vector of HtmlChunk triplets. The first is the begin data chunk, which contains information about the type of data. The second contains the data and the third is the end data chunk.


m_isInData

protected boolean m_isInData
Used to indicate whether we are in the middle of extracting a raw data construct inside the file.


m_maximumExecutionRecursion

public static final int m_maximumExecutionRecursion
Maximum nesting level during execution of script. Note that an if statement (or else, elseif), loop (or loopwhile), or include with cause an increment in this nesting level. So will the execution of script by any function or grammar construct (such as eval(...)).

See Also:
Constant Field Values
Constructor Detail

DynamicHtml

public DynamicHtml()
Default constructor.

Method Detail

loadHtml

public void loadHtml(java.io.Reader reader,
                     java.lang.String fileName,
                     boolean isXmlSyntax)
              throws java.io.IOException,
                     ParseSyntaxException
Loads HTML server side script from a reader.

java.io.IOException
ParseSyntaxException

loadHtmlEx

public void loadHtmlEx(java.io.Reader reader,
                       java.lang.String fileName,
                       boolean isXmlSyntax,
                       IdcBreakpoints bp)
                throws java.io.IOException,
                       ParseSyntaxException
java.io.IOException
ParseSyntaxException

loadHtmlInContext

public void loadHtmlInContext(java.io.Reader reader,
                              ParseOutput parseOutput)
                       throws java.io.IOException,
                              ParseSyntaxException
Loads HTML server side script, can be called on resources stored inside files.

java.io.IOException
ParseSyntaxException

loadHtmlInContextEx

public void loadHtmlInContextEx(java.io.Reader reader,
                                ParseOutput parseOutput,
                                IdcBreakpoints bp)
                         throws java.io.IOException,
                                ParseSyntaxException
java.io.IOException
ParseSyntaxException

findScriptTag

protected boolean findScriptTag(java.io.Reader reader,
                                ParseOutput parseOutput)
                         throws java.io.IOException,
                                ParseSyntaxException
java.io.IOException
ParseSyntaxException

addChunks

protected void addChunks(java.io.Reader reader,
                         java.io.CharArrayWriter outbuf,
                         ParseOutput parseOutput,
                         IdcBreakpoints bp)
                  throws java.io.IOException,
                         ParseSyntaxException
Does actual work of parsing HTML server side script into preparsed 'chunks'.

java.io.IOException
ParseSyntaxException

createNestingException

public void createNestingException(java.util.Vector parseInfos,
                                   java.lang.String msg)
                            throws ParseSyntaxException
Throws an exception computing appropriate offsets based on nested loops or conditionals.

ParseSyntaxException

addNestingInfo

public void addNestingInfo(java.util.Vector parseInfos,
                           ParseOutput parseOutput)
Stores nesting information (loop -> endloop or if -> endif).


parseGrammarStatement

public GrammarElement parseGrammarStatement(HtmlChunk chunk,
                                            GrammarParseState parseState)
                                     throws ParseSyntaxException
Parses a server side script statement into its grammatical elements.

ParseSyntaxException
See Also:
GrammarParser

outputHtml

public void outputHtml(java.io.Writer writer,
                       DynamicHtmlOutput dynCallback)
                throws java.io.IOException,
                       ParseSyntaxException
Evaluates this server side page and writes results out to a Writer

Parameters:
writer - Merged script page is written out to here.
dynCallback - A callback object that evaluates the statements in the page.
java.io.IOException
ParseSyntaxException
See Also:
DynamicHtmlOutput

outputHtmlEx

protected int outputHtmlEx(int curIndex,
                           java.io.Writer writer,
                           DynamicHtmlOutput dynCallback,
                           int exitType,
                           boolean doOutput,
                           boolean[] isBreak,
                           int[] retType,
                           int nestLevel)
                    throws java.io.IOException,
                           ParseSyntaxException
This service is called recursively. Returns next index location to process. exitType = 0 -> do not exit. exitType > 0 -> equals HtmlChunk type to return on.

java.io.IOException
ParseSyntaxException

checkBreakpoint

public void checkBreakpoint(HtmlChunk chunk,
                            GrammarElement elt,
                            DynamicHtmlOutput dynCallback)

getPriorScript

public DynamicHtml getPriorScript()
Retrieves backpointer to prior implementation of this script resource.


setPriorScript

public void setPriorScript(DynamicHtml priorScript)
Sets the backpointer to prior implementation of this script resource.


shallowClone

public DynamicHtml shallowClone()
Used to get a shallow clone so some external reference entries (such as prior script) can be changed. Note: the shallow clone drops the prior script reference.


shallowCloneWithPriorScript

public DynamicHtml shallowCloneWithPriorScript(DynamicHtml priorScript)
Used to perform a shallow clone of this object so a different prior script can be assigned.


findEarliestValidPriorScript

public DynamicHtml findEarliestValidPriorScript(DynamicHtml priorResource)
Using file name matches it compares a new object (this one) against a prexisting object (the passed in parameter) and tries to pick out an appropriate prior script parent that would make an appropriate prior script for the new object. If no file name matches are found in the ancenstry, then the current script can be used as the prior script otherwise the parent of the earliest matching file name is used. This method is needed because we never discard old loads of a resource. The only way we can discover that an existing resource needs to be replaced by a new resource is to see if the have a file name match.


substituteVariable

protected void substituteVariable(HtmlChunk chunk,
                                  java.io.Writer writer,
                                  DynamicHtmlOutput dynCallback,
                                  GrammarElement elt)
                           throws java.io.IOException,
                                  ParseSyntaxException
Calls callback interface to substitute variable.

java.io.IOException
ParseSyntaxException

checkCondition

protected boolean checkCondition(HtmlChunk chunk,
                                 DynamicHtmlOutput dynCallback,
                                 GrammarElement elt)
                          throws java.io.IOException,
                                 ParseSyntaxException
Calls callback interface to do a condition check.

java.io.IOException
ParseSyntaxException

createAbsoluteSyntaxException

protected void createAbsoluteSyntaxException(HtmlChunk chunk,
                                             ParseSyntaxException e)
                                      throws ParseSyntaxException
Creates a ParseSyntaxException by merging information from a ParseSyntaxException containing relative error information with the absolute location information the HtmlChunk object.

ParseSyntaxException


(c) 1996-2005  All rights reserved.  Stellent, Inc.