filetools.filegenerators
Class HelpFileWikiIndexGenerator

java.lang.Object
  extended by filetools.filegenerators.HelpFileIndexDBCompendiumGenerator
      extended by filetools.filegenerators.HelpFileWikiIndexGenerator
All Implemented Interfaces:
IFileGenerator

public class HelpFileWikiIndexGenerator
extends HelpFileIndexDBCompendiumGenerator

This class provides functionality for generating texts in mediawiki syntax and in different styles. These texts contain links to html-helpfiles for all Matlab-functions in the matlab reference directory. Two styles are available: a simple table-format where each cell contains a link to a function or a singleline-mode, where each function is presented in a single row. In singleline-mode a short description of the func is also given. This class may be instanced or used as a stand-alone application.

Author:
osiris

Field Summary
private static int CELLWIDTH
           
static java.lang.String DBPROPERTYFILE
          Name of the property file which contains data for the db-connection
private static java.lang.String HTMLBASE
          Base directory of the Matlab html-reference
private static int NUM_COLS
          Some definitions for the format of the tables
private  java.util.Hashtable<java.lang.String,java.lang.String[]> searchExceptions
          Contains all exceptions (beginnings of the filenames which shouldn't be written into the target-file)
private  boolean singleline
           
static java.lang.String SINGLELINE_ARG
          Definition of the commandline-arg which switches singleline-mode on
private static int SINGLELINE_WIDTH
           
static java.lang.String STARTFILE
          Name of the file which should be included as the first category
private static java.lang.String TECHDOCREFDIR
          Part of the path which marks the reference-directory
 
Fields inherited from class filetools.filegenerators.HelpFileIndexDBCompendiumGenerator
DB_TABLENAME, HTML_EXTENSION, outputFileWriter, properties
 
Constructor Summary
HelpFileWikiIndexGenerator()
          Only constructor of this class.
 
Method Summary
protected  void endProcessQuery(java.sql.ResultSet resultSet)
          This function is called for every query after the processing of its results.
private  void generateCategory(java.lang.String category)
          Writes a category into the target-file.
private  java.lang.String getQuery(java.lang.String begin)
          Generates a string which contains a MySQL-query for getting the relevant data
static void main(java.lang.String[] args)
           
protected  void processRow(java.sql.ResultSet row)
          In this function concrete classes need to define what to do with a single row of the result of the last executed query.
protected  void processTask()
          This function contains the code which manages the whole task.
 void setSingleline(boolean singleline)
          Switches the singleline-mode on or off.
private  void writeCell(java.lang.String function, java.lang.String path, java.lang.String description)
          Writes a single cell or, if singleline-mode is active, two cells (which build the content of one row) into the table
 
Methods inherited from class filetools.filegenerators.HelpFileIndexDBCompendiumGenerator
connectToDB, generateFile, includeFile, readPropertiesFromFile, sendAndProcessQuery, setProperties, startProcessQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TECHDOCREFDIR

private static final java.lang.String TECHDOCREFDIR
Part of the path which marks the reference-directory

See Also:
Constant Field Values

HTMLBASE

private static final java.lang.String HTMLBASE
Base directory of the Matlab html-reference

See Also:
Constant Field Values

DBPROPERTYFILE

public static final java.lang.String DBPROPERTYFILE
Name of the property file which contains data for the db-connection

See Also:
Constant Field Values

STARTFILE

public static final java.lang.String STARTFILE
Name of the file which should be included as the first category

See Also:
Constant Field Values

SINGLELINE_ARG

public static final java.lang.String SINGLELINE_ARG
Definition of the commandline-arg which switches singleline-mode on

See Also:
Constant Field Values

NUM_COLS

private static final int NUM_COLS
Some definitions for the format of the tables

See Also:
Constant Field Values

CELLWIDTH

private static final int CELLWIDTH
See Also:
Constant Field Values

SINGLELINE_WIDTH

private static final int SINGLELINE_WIDTH
See Also:
Constant Field Values

singleline

private boolean singleline

searchExceptions

private java.util.Hashtable<java.lang.String,java.lang.String[]> searchExceptions
Contains all exceptions (beginnings of the filenames which shouldn't be written into the target-file)

Constructor Detail

HelpFileWikiIndexGenerator

public HelpFileWikiIndexGenerator()
Only constructor of this class. All exceptions are defined here.

Method Detail

processTask

protected void processTask()
Description copied from class: HelpFileIndexDBCompendiumGenerator
This function contains the code which manages the whole task. Concrete classes have to override this function to define what to do.

Specified by:
processTask in class HelpFileIndexDBCompendiumGenerator
See Also:
HelpFileIndexDBCompendiumGenerator.processTask()

generateCategory

private void generateCategory(java.lang.String category)
                       throws java.io.IOException,
                              java.sql.SQLException
Writes a category into the target-file. A Category consists of a title whose text is the given string and a table which contains the result of the DB-search with the category.

Parameters:
category - Specifies the beginning of all filenames to retrieve from the DB. This is also the title of this category
Throws:
java.io.IOException
java.sql.SQLException

getQuery

private java.lang.String getQuery(java.lang.String begin)
Generates a string which contains a MySQL-query for getting the relevant data

Parameters:
begin - Specifies the beginning of the filenames which should be returned
Returns:
string which contains the MySQL-query

processRow

protected void processRow(java.sql.ResultSet row)
                   throws java.sql.SQLException,
                          java.io.IOException
Description copied from class: HelpFileIndexDBCompendiumGenerator
In this function concrete classes need to define what to do with a single row of the result of the last executed query.

Specified by:
processRow in class HelpFileIndexDBCompendiumGenerator
Parameters:
row - ResultSet in which the row to process is the actual one. So one can get the results by using the get... functions of row
Throws:
java.sql.SQLException
java.io.IOException
See Also:
#processRow(java.sql.ResultSet)

endProcessQuery

protected void endProcessQuery(java.sql.ResultSet resultSet)
                        throws java.sql.SQLException,
                               java.io.IOException
Description copied from class: HelpFileIndexDBCompendiumGenerator
This function is called for every query after the processing of its results. Derived classes may override this function to implement some functionalities.

Overrides:
endProcessQuery in class HelpFileIndexDBCompendiumGenerator
Parameters:
resultSet - ResultSet after all rows of the result were processed.
Throws:
java.sql.SQLException
java.io.IOException
See Also:
#endProcessQuery(java.sql.ResultSet)

writeCell

private void writeCell(java.lang.String function,
                       java.lang.String path,
                       java.lang.String description)
                throws java.io.IOException
Writes a single cell or, if singleline-mode is active, two cells (which build the content of one row) into the table

Parameters:
function - Filename of the helpfile
path - Absolute path of the file
description - A closer description, needed only in singleline-mode
Throws:
java.io.IOException

setSingleline

public void setSingleline(boolean singleline)
Switches the singleline-mode on or off.

Parameters:
singleline - Set this param true to turn singleline-mode on

main

public static void main(java.lang.String[] args)
Parameters:
args - Specifies the name of the file to generate and additional params