kryshen.tema
Class Tema

java.lang.Object
  extended by kryshen.tema.Tema

public class Tema
extends java.lang.Object

Tema main class.

Author:
Mikhail A. Kryshen

Field Summary
static java.lang.String AUTHOR
           
static java.lang.String TITLE
           
static java.lang.String VERSION
           
 
Constructor Summary
Tema()
           
 
Method Summary
static java.io.Reader createCachedFileReader(java.io.File file)
          Creates StringReader for a cached file if caching is enabled or a BufferedReader.
static java.io.BufferedReader createFileReader(java.io.File file)
           
static java.io.BufferedWriter createFileWriter(java.lang.String filename)
           
static TemplateReader createTemplateReader(java.io.File file)
           
static java.sql.Connection getDbConnection()
          Get database connection.
static java.lang.String getProperty(java.lang.String name)
          Get configuration property.
static java.lang.String getProperty(java.lang.String name, java.lang.String fallback)
          Get configuration property.
static void main(java.lang.String[] args)
           
static int query(TemplateReader templateReader, java.sql.PreparedStatement ps, java.util.List<java.lang.String> args, TemplateParser superParser, java.io.Writer out)
          Process database query.
static java.lang.String readFile(java.io.File file)
          Read text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TITLE

public static final java.lang.String TITLE
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

AUTHOR

public static final java.lang.String AUTHOR
See Also:
Constant Field Values
Constructor Detail

Tema

public Tema()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        java.sql.SQLException,
                        java.lang.ClassNotFoundException,
                        java.lang.InstantiationException,
                        java.lang.IllegalAccessException
Throws:
java.io.IOException
java.sql.SQLException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

getProperty

public static java.lang.String getProperty(java.lang.String name)
Get configuration property.


getProperty

public static java.lang.String getProperty(java.lang.String name,
                                           java.lang.String fallback)
Get configuration property.


query

public static int query(TemplateReader templateReader,
                        java.sql.PreparedStatement ps,
                        java.util.List<java.lang.String> args,
                        TemplateParser superParser,
                        java.io.Writer out)
                 throws java.io.IOException,
                        java.sql.SQLException,
                        TemplateException
Process database query.

Parameters:
templateReader - reader for the template to fill with data.
ps - query statement to execute.
args - list of query parameters.
superParser - invoking object.
out - Writer to output processed data.
Returns:
number of processed rows in query result.
Throws:
java.io.IOException
java.sql.SQLException
TemplateException

createFileWriter

public static java.io.BufferedWriter createFileWriter(java.lang.String filename)
                                               throws java.io.IOException
Throws:
java.io.IOException

createFileReader

public static java.io.BufferedReader createFileReader(java.io.File file)
                                               throws java.io.IOException
Throws:
java.io.IOException

createTemplateReader

public static TemplateReader createTemplateReader(java.io.File file)
                                           throws java.io.IOException
Throws:
java.io.IOException

createCachedFileReader

public static java.io.Reader createCachedFileReader(java.io.File file)
                                             throws java.io.IOException
Creates StringReader for a cached file if caching is enabled or a BufferedReader.

Parameters:
file - File to read.
Returns:
Reader for a file.
Throws:
java.io.IOException

readFile

public static java.lang.String readFile(java.io.File file)
                                 throws java.io.IOException
Read text file.

Returns:
file contents.
Throws:
java.io.IOException

getDbConnection

public static java.sql.Connection getDbConnection()
Get database connection.

Returns:
database connection if any was configured.