com.adventnet.html.staticssi
Class HtmlParser

java.lang.Object
  |
  +--com.adventnet.html.staticssi.HtmlParser

public class HtmlParser
extends java.lang.Object

This class parse a given shtml file, that contains set of SSI tags as defined in the SSITags class and substitute with html tags after executing each SSI tag. The MibCompiler will generate a template .shtml file for each instrumentation, that will have required information about the MBean. Using the defined SSI tags the user can customize the html pages for his instrumentaion.

See Also:
com.adventnet.ssiparser.SSITags, com.adventnet.ssiparser.HtmlParser

Field Summary
(package private)  Log log
           
 
Constructor Summary
HtmlParser()
          No argument constructor to initialize the HtmlParser.
 
Method Summary
 void appendResult(java.lang.StringBuffer strBuf, java.util.Vector resultVec, boolean isAdminUser)
           
static boolean checkFilePerms(java.lang.String fileName, java.lang.String access)
           
 java.lang.String expandSSITags(java.lang.String args, java.util.Hashtable hashtable)
          It will expand the param name if it contains any var tag value.
 java.lang.String filterSearch(java.util.Hashtable table, boolean isAdminUser)
           
 java.lang.String getDirectoryName()
          Getter for the default directory name.
 java.util.Hashtable getHashtable()
          Gettter for the hashtable contains var ssi tag and its value.
 java.lang.String getIndexFileName()
          Getter for the index file name.
 java.lang.String getIndexMainFileName()
          Getter for the index Main frame file name.
 java.lang.String getServerName()
          Getter for the server name.
 StaticUtil getUtilsObject()
           
 java.lang.String parse(java.lang.String fName)
          Parses the given html file according to SSI syntax.
 void parseForSubstitutes(java.lang.String fName)
          This function will parse the .shtml files and find out each var ssi tag and keep them in a hash table.
 void resultsFound(java.lang.String name, boolean searchForScalar, boolean searchForTable, java.util.Vector resultVec)
           
 boolean resultsFound(java.lang.StringBuffer strBuf, java.lang.String name)
           
 java.lang.String runGetTableTag(java.lang.String args)
           
 java.lang.String runGetTag(java.lang.String args)
           
static void setDirectoryName(java.lang.String dir)
          Setter for default directory.
 void setHashtable(java.lang.Object o)
          Setter for the hash table.
static void setIndexFileName(java.lang.String fName)
          Set the index file name which is to be parsed for SSI tags when the file name is not mentioned from the client.
static void setIndexMainFileName(java.lang.String fName)
          Set the index Main file name which is to be parsed for SSI tags when the file name is not mentioned from the client.
 void setRefreshTime(int time)
          Setter for the refresh time.
 void setServerName(java.lang.String name)
          Setter for server name.
 void setUtilsObject(StaticUtil su)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

Log log
Constructor Detail

HtmlParser

public HtmlParser()
No argument constructor to initialize the HtmlParser.
Method Detail

setUtilsObject

public void setUtilsObject(StaticUtil su)

getUtilsObject

public StaticUtil getUtilsObject()

setServerName

public void setServerName(java.lang.String name)
Setter for server name. It is used if dynamic html page generation option is selected.
Parameters:
name - - the server name for identification purpose.

getServerName

public java.lang.String getServerName()
Getter for the server name. It is used if dynamic html page generation option is selected.
Returns:
the server name.

setDirectoryName

public static void setDirectoryName(java.lang.String dir)
Setter for default directory. In the case of customized html page creation the file will be searched in this directory on receving a request from the client.
Parameters:
dir - the default directory name where all html files are placed.

getDirectoryName

public java.lang.String getDirectoryName()
Getter for the default directory name. This directory will contain all the .shtml files
Returns:
the default directory name.

setIndexFileName

public static void setIndexFileName(java.lang.String fName)
Set the index file name which is to be parsed for SSI tags when the file name is not mentioned from the client. By default it is "custom_index.html".
Parameters:
index - file Name.

getIndexFileName

public java.lang.String getIndexFileName()
Getter for the index file name.
Parameters:
the - index file name.

setRefreshTime

public void setRefreshTime(int time)
Setter for the refresh time.
Parameters:
time - - the time value for refesh time.

setIndexMainFileName

public static void setIndexMainFileName(java.lang.String fName)
Set the index Main file name which is to be parsed for SSI tags when the file name is not mentioned from the client. By default it is "index_main.html".
Parameters:
index - file Name.

getIndexMainFileName

public java.lang.String getIndexMainFileName()
Getter for the index Main frame file name.
Parameters:
the - index file name.

parse

public java.lang.String parse(java.lang.String fName)
                       throws java.lang.Exception
Parses the given html file according to SSI syntax. It will identify each SSI tags and do the action as defined for each tag. For the given html the parser will generate a new html file with the substituted value of SSI tags.
Parameters:
fName - the html file to be parsed.
Returns:
the new html file with substituted SSI tags.
Throws:
if - any error occur while parsing the html file.

checkFilePerms

public static boolean checkFilePerms(java.lang.String fileName,
                                     java.lang.String access)
                              throws java.io.IOException

parseForSubstitutes

public void parseForSubstitutes(java.lang.String fName)
This function will parse the .shtml files and find out each var ssi tag and keep them in a hash table.
Parameters:
fName - - the name of the .shtml

getHashtable

public java.util.Hashtable getHashtable()
Gettter for the hashtable contains var ssi tag and its value.
Returns:
the hashtable contains the var tag and value pairs.

setHashtable

public void setHashtable(java.lang.Object o)
Setter for the hash table.
Parameters:
o - - the hashtable to set.

expandSSITags

public java.lang.String expandSSITags(java.lang.String args,
                                      java.util.Hashtable hashtable)
It will expand the param name if it contains any var tag value.
Parameters:
args - - the param name.
hashtable - - the hashtable contains set of tag and value pairs.

runGetTableTag

public java.lang.String runGetTableTag(java.lang.String args)
                                throws java.lang.Exception

runGetTag

public java.lang.String runGetTag(java.lang.String args)
                           throws java.lang.Exception

filterSearch

public java.lang.String filterSearch(java.util.Hashtable table,
                                     boolean isAdminUser)
                              throws ParseException

resultsFound

public boolean resultsFound(java.lang.StringBuffer strBuf,
                            java.lang.String name)

resultsFound

public void resultsFound(java.lang.String name,
                         boolean searchForScalar,
                         boolean searchForTable,
                         java.util.Vector resultVec)

appendResult

public void appendResult(java.lang.StringBuffer strBuf,
                         java.util.Vector resultVec,
                         boolean isAdminUser)