scriptella.driver.text
Class AbstractTextConnection

java.lang.Object
  extended by scriptella.spi.AbstractConnection
      extended by scriptella.driver.text.AbstractTextConnection
All Implemented Interfaces:
scriptella.spi.Connection
Direct Known Subclasses:
CsvConnection, TextConnection, VelocityConnection

public abstract class AbstractTextConnection
extends scriptella.spi.AbstractConnection

Base class for Text/CSV connections.

TODO: Move this class to a spi.support.text package.

Version:
1.0
Author:
Fyodor Kupolov

Nested Class Summary
 
Nested classes/interfaces inherited from class scriptella.spi.AbstractConnection
scriptella.spi.AbstractConnection.StatementCounter
 
Field Summary
protected  java.lang.String encoding
           
static java.lang.String ENCODING
          Name of the encoding connection property.
protected  java.lang.String eol
           
static java.lang.String EOL
          Name of the eol connection property.
protected  boolean flush
           
static java.lang.String FLUSH
          Name of the flush connection property.
static java.lang.String NULL_STRING
          Name of the null_string connection property.
protected  java.lang.String nullString
           
static java.lang.String SKIP_LINES
          Name of the skip_lines connection property.
protected  int skipLines
           
protected  boolean trim
           
static java.lang.String TRIM
          Name of the trim connection property.
protected  java.net.URL url
           
 
Fields inherited from class scriptella.spi.AbstractConnection
counter
 
Constructor Summary
protected AbstractTextConnection()
          For testing only.
protected AbstractTextConnection(scriptella.spi.DialectIdentifier dialectIdentifier, scriptella.spi.ConnectionParameters parameters)
          Initializes a text connection using specified properties.
 
Method Summary
 java.lang.String getEncoding()
           
 java.lang.String getEol()
           
 java.net.URL getUrl()
          Returns resolved URL for this connection.
 boolean isTrim()
           
protected  java.io.Reader newInputReader()
          Creates a new reader for input.
protected  java.io.Writer newOutputWriter()
          Creates a new writer to send output to.
 
Methods inherited from class scriptella.spi.AbstractConnection
commit, getDialectIdentifier, getExecutedStatementsCount, isReadonly, rollback, setDialectIdentifier, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface scriptella.spi.Connection
close, executeQuery, executeScript
 

Field Detail

encoding

protected final java.lang.String encoding

trim

protected final boolean trim

flush

protected final boolean flush

url

protected final java.net.URL url

eol

protected final java.lang.String eol

skipLines

protected final int skipLines

nullString

protected final java.lang.String nullString

ENCODING

public static final java.lang.String ENCODING
Name of the encoding connection property. Specifies charset encoding in text files.

See Also:
Constant Field Values

EOL

public static final java.lang.String EOL
Name of the eol connection property. EOL suffix. Default value is \n.

See Also:
Constant Field Values

TRIM

public static final java.lang.String TRIM
Name of the trim connection property. Value of true specifies that the leading and trailing whitespaces should be omitted.

See Also:
Constant Field Values

FLUSH

public static final java.lang.String FLUSH
Name of the flush connection property. Value of true specifies that the outputted content should flushed immediately after the <script> element completes.

See Also:
Constant Field Values

SKIP_LINES

public static final java.lang.String SKIP_LINES
Name of the skip_lines connection property. The number of lines to skip before start reading. Default value is 0 (no lines are skipped).

Only valid for <query> elements.

See Also:
Constant Field Values

NULL_STRING

public static final java.lang.String NULL_STRING
Name of the null_string connection property. If set, specifies value of a string token to be parsed as Java null literal.

See Also:
Constant Field Values
Constructor Detail

AbstractTextConnection

protected AbstractTextConnection()
For testing only.


AbstractTextConnection

protected AbstractTextConnection(scriptella.spi.DialectIdentifier dialectIdentifier,
                                 scriptella.spi.ConnectionParameters parameters)
Initializes a text connection using specified properties.

Parameters:
dialectIdentifier -
parameters -
Method Detail

getEncoding

public java.lang.String getEncoding()

isTrim

public boolean isTrim()

getUrl

public java.net.URL getUrl()
Returns resolved URL for this connection.

If null, the console is used for reading/writing.

Returns:
resolved URL or null.

getEol

public java.lang.String getEol()

newOutputWriter

protected java.io.Writer newOutputWriter()
                                  throws java.io.IOException
Creates a new writer to send output to.

Returns:
writer for output.
Throws:
java.io.IOException - if IO error occured.

newInputReader

protected java.io.Reader newInputReader()
                                 throws java.io.IOException
Creates a new reader for input.

Returns:
reader for input.
Throws:
java.io.IOException - if IO error occured.


Copyright © Copyright 2006-2009 The Scriptella Project Team.