scriptella.driver.text
Class TextScriptExecutor

java.lang.Object
  extended by scriptella.driver.text.TextScriptExecutor
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class TextScriptExecutor
extends java.lang.Object
implements java.io.Closeable, java.io.Flushable

Writes a text content to the output and performs properties expansion.

This class is a simplified template engine similar to Velocity, but of course less powerful. Nevertheless this executor is generally faster than external template engines and does not require any additional libraries.

Example:

Script:
 $rownum;$name;$surname;${email.trim().replaceAll('@','_at_')}
 
Parameters:
rownum name surname email
1 John G john@nosuchhost.com
Result:
 1;John;G;john_at_nosuchhost.com
 

Version:
1.0
Author:
Fyodor Kupolov
See Also:
PropertiesSubstitutor

Constructor Summary
TextScriptExecutor(java.io.Writer out, boolean trim, java.lang.String eol, java.lang.String nullString)
          Creates an executor.
 
Method Summary
 void close()
           
 void execute(java.io.Reader reader, scriptella.spi.ParametersCallback pc, scriptella.spi.AbstractConnection.StatementCounter counter)
          Parses a script from read, expands properties and produces the output.
 void flush()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextScriptExecutor

public TextScriptExecutor(java.io.Writer out,
                          boolean trim,
                          java.lang.String eol,
                          java.lang.String nullString)
Creates an executor.

Parameters:
out - writer for output.
trim - true if each line in the output file should be trimmed
eol - EOL separator.
nullString - null string.
Method Detail

execute

public void execute(java.io.Reader reader,
                    scriptella.spi.ParametersCallback pc,
                    scriptella.spi.AbstractConnection.StatementCounter counter)
Parses a script from read, expands properties and produces the output.

Parameters:
reader - script content.
pc - parameters for substitution.
counter - statements counter.

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException


Copyright © Copyright 2006-2009 The Scriptella Project Team.