Class VelocityConnection

All Implemented Interfaces:
Connection

public class VelocityConnection extends AbstractTextConnection
Represents a session to velocity engine.
  • Constructor Details

    • VelocityConnection

      public VelocityConnection(ConnectionParameters parameters)
      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

      public void close() throws ProviderException
      Closes the connection and releases all related resources.
      Throws:
      ProviderException - if a critical failure occured.