Package scriptella.driver.velocity
Class VelocityConnection
java.lang.Object
scriptella.spi.AbstractConnection
scriptella.driver.text.AbstractTextConnection
scriptella.driver.velocity.VelocityConnection
- All Implemented Interfaces:
Connection
Represents a session to velocity engine.
-
Nested Class Summary
Nested classes/interfaces inherited from class scriptella.spi.AbstractConnection
AbstractConnection.StatementCounter -
Field Summary
Fields inherited from class scriptella.driver.text.AbstractTextConnection
ENCODING, EOL, FLUSH, FORMAT_PREFIX, NULL_STRING, SKIP_LINES, TRIMFields inherited from class scriptella.spi.AbstractConnection
counter -
Constructor Summary
ConstructorsConstructorDescriptionVelocityConnection(ConnectionParameters parameters) Instantiates a velocity connection. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the connection and releases all related resources.voidexecuteQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback) Executes a query specified by its content.voidexecuteScript(Resource scriptContent, ParametersCallback parametersCallback) Executes a script specified by its content.Methods inherited from class scriptella.driver.text.AbstractTextConnection
getConnectionParameters, newInputReader, newOutputWriterMethods inherited from class scriptella.spi.AbstractConnection
commit, getDialectIdentifier, getExecutedStatementsCount, isReadonly, rollback, setDialectIdentifier, toString
-
Constructor Details
-
VelocityConnection
Instantiates a velocity connection.- Parameters:
parameters- connection parameters.
-
-
Method Details
-
executeScript
public void executeScript(Resource scriptContent, ParametersCallback parametersCallback) throws ProviderException Executes a script specified by its content.scriptContent may be used as a key for caching purposes, i.e. provider may precompile scripts and use compiled versions for subsequent executions.
This method is synchronized to to prevent multiple threads from working with the same writer. Additionally single velocityEngine and context adapter instances are used.
- Parameters:
scriptContent- script content.parametersCallback- callback to get parameter values.- Throws:
ProviderException- if script execution failed.
-
executeQuery
public void executeQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback) throws ProviderException Executes a query specified by its content.- Parameters:
queryContent- query content.parametersCallback- callback to get parameter values.queryCallback- callback to call for each result set element produced by this query.- Throws:
ProviderException- if query execution failed.- See Also:
-
close
Closes the connection and releases all related resources.- Throws:
ProviderException- if a critical failure occured.
-