com.univocity.api.engine
Interface EngineExecutionContext

All Known Subinterfaces:
RowMappingContext

public interface EngineExecutionContext

The EngineExecutionContext is provided by a DataIntegrationEngine through RowReader and EngineLifecycleContext and allows access to variables and functions in the current EngineScope.

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Method Summary
 boolean containsVariable(String variableName)
          Queries the current scope for the existence of a variable
 Object evaluateExpression(String expression)
          Executes an expression and returns the result.
 Object executeFunction(String functionName, Object... args)
          Invokes a function registered in the DataIntegrationEngine and returns the result
 EngineScope getCurrentActiveScope()
          Returns the current active scope in the DataIntegrationEngine
 Object readVariable(String variableName)
          Reads the value of a variable available in the current scope.
 void setVariable(String variableName, Object value)
          Sets the value of a variable in the current scope.
 

Method Detail

evaluateExpression

Object evaluateExpression(String expression)
Executes an expression and returns the result. Acceptable expressions conform to the following format:

Example:

 setVariable("b", 1);
 setVariable("e", 2);
 evaluateExpression("a, $b, concat( d, $e, 'f')"); //assume the concat function concatenates any number of arguments into a String.
 
Will return an object array with: "a", 1, "d2f"

Parameters:
expression - the expression to be executed
Returns:
the result of the expression.

setVariable

void setVariable(String variableName,
                 Object value)
Sets the value of a variable in the current scope.

Parameters:
variableName - the name of the variable to be set.
value - the value to assign to the variable.

readVariable

Object readVariable(String variableName)
Reads the value of a variable available in the current scope.

Parameters:
variableName - the name of the variable whose value is going to be obtained.
Returns:
the value of the given variable.

containsVariable

boolean containsVariable(String variableName)
Queries the current scope for the existence of a variable

Parameters:
variableName - the name of the variable to have its existence verified
Returns:
true if the current scope contains the given variable, otherwise false.

executeFunction

Object executeFunction(String functionName,
                       Object... args)
Invokes a function registered in the DataIntegrationEngine and returns the result

Parameters:
functionName - the name of the function to be invoked
args - the arguments to pass to the function
Returns:
the result of the function execution with the given arguments. Results can be cached depending on the scope with which they are associated. In this case the function will only be invoked if there is no previous result cached on its scope.

getCurrentActiveScope

EngineScope getCurrentActiveScope()
Returns the current active scope in the DataIntegrationEngine

Returns:
the current active scope


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.