Class AbstractCustomWrapper
java.lang.Object
com.denodo.vdb.engine.customwrapper.AbstractCustomWrapper
- All Implemented Interfaces:
CustomWrapper
Default implementation of
CustomWrapper. Subclasses need only to
implement the methods CustomWrapper.getSchemaParameters(Map) and
CustomWrapper.run(CustomWrapperConditionHolder, List, CustomWrapperResult, Map), as default implementations for the rest of the
required methods are provided.
Nevertheless, the user is encouraged to override any of the methods provided by this class if necessary.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int'Debug' log levelprotected static final int'Error' log levelprotected static final int'Fatal' log levelprotected static final int'Info' log levelprotected static final int'Trace' log levelprotected static final int'Warn' log level -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()By default, does nothing.intdelete(CustomWrapperConditionHolder condition, Map<String, String> inputValues) By default, does nothing and returns0.By default, returns aCustomWrapperConfigurationinstance with all the configuration parameters set to their default values.Returns theCustomWrapperPlanof the current wrapper execution.By default, an empty array is returned.By default, an empty array is returned.protected final CustomWrapperInputParameterValuegetInputParameterValue(String name) Returns the actualCustomWrapperInputParameterValueassociated to theCustomWrapperInputParameterspecified by the name.protected final List<CustomWrapperOrderByExpression> If the Custom Wrapper declares in theCustomWrapperConfigurationthat it supports orderBy delegations, it returns aListwith the expressions in the ORDER BY clause delegated to the custom wrapper.Returns the schema of this wrapper.intBy default, does nothing and returns0.protected final voidAdds an entry log, with the specified level.voidprepare()By default, does nothing.voidrollback()By default, does nothing.final voidsetInputParameterValues(Map<String, CustomWrapperInputParameterValue> paramValues) Sets the input parameter values with type information.final voidsetOrderByExpressions(List<CustomWrapperOrderByExpression> orderByExpressions) Sets the order by expressions when they are delegated to the sourcevoidsetSchema(CustomWrapperSchemaParameter[] customWrapperSchema) Important: do not invoke this method.booleanstop()By default, does nothing and returnsfalse.intupdate(Map<CustomWrapperFieldExpression, Object> updateValues, CustomWrapperConditionHolder condition, Map<String, String> inputValues) By default, does nothing and returns0.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CustomWrapper
getSchemaParameters, run
-
Field Details
-
LOG_TRACE
protected static final int LOG_TRACE'Trace' log level- See Also:
-
LOG_DEBUG
protected static final int LOG_DEBUG'Debug' log level- See Also:
-
LOG_INFO
protected static final int LOG_INFO'Info' log level- See Also:
-
LOG_WARN
protected static final int LOG_WARN'Warn' log level- See Also:
-
LOG_ERROR
protected static final int LOG_ERROR'Error' log level- See Also:
-
LOG_FATAL
protected static final int LOG_FATAL'Fatal' log level- See Also:
-
-
Constructor Details
-
AbstractCustomWrapper
protected AbstractCustomWrapper()
-
-
Method Details
-
getDataSourceInputParameters
By default, an empty array is returned.- Specified by:
getDataSourceInputParametersin interfaceCustomWrapper- Returns:
- an array of
CustomWrapperInputParameter - See Also:
-
getInputParameters
By default, an empty array is returned.- Specified by:
getInputParametersin interfaceCustomWrapper- Returns:
- an array of
CustomWrapperInputParameter - See Also:
-
insert
public int insert(Map<CustomWrapperFieldExpression, Object> insertValues, Map<String, String> inputValues) throws CustomWrapperExceptionBy default, does nothing and returns0.- Specified by:
insertin interfaceCustomWrapper- Parameters:
insertValues- a Map<CustomWrapperFieldExpression, Object> which associates fields with values, in similar fashion to theINSERTstatement inSQL.inputValues- a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined inCustomWrapper.getInputParameters()) with their current values.- Returns:
- the number of successfully inserted values.
- Throws:
CustomWrapperException- Throw this exception from your code if there is an error inserting a row in the underlying data source. The execution engine will capture this exception and will interrupt the execution of this custom wrapper, interrupt the query and return the error message of this exception to the client application.- See Also:
-
delete
public int delete(CustomWrapperConditionHolder condition, Map<String, String> inputValues) throws CustomWrapperExceptionBy default, does nothing and returns0.- Specified by:
deletein interfaceCustomWrapper- Parameters:
condition- the deletion condition (akin to theWHEREclause in aSQLDELETEstatement).inputValues- a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined inCustomWrapper.getInputParameters()) with their current values.- Returns:
- the number of successfully deleted values.
- Throws:
CustomWrapperException- Throw this exception from your code if there is an error deleting a row in the underlying data source. The execution engine will capture this exception and will interrupt the execution of this custom wrapper, interrupt the query and return the error message of this exception to the client application.- See Also:
-
update
public int update(Map<CustomWrapperFieldExpression, Object> updateValues, CustomWrapperConditionHolder condition, Map<String, String> inputValues) throws CustomWrapperExceptionBy default, does nothing and returns0.- Specified by:
updatein interfaceCustomWrapper- Parameters:
updateValues- a Map<CustomWrapperFieldExpression, Object> which associates fields with values, in similar fashion to theUPDATEstatement inSQL. The value can be a literal expressed as a Java object or a field expressed as aCustomWrapperFieldExpressioncondition- the insert condition (akin to theWHEREclause in aSQLUPDATEstatement).inputValues- a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined inCustomWrapper.getInputParameters()) with their current values.- Returns:
- the number of successfully updated values.
- Throws:
CustomWrapperException- Throw this exception if there is an error updating a row in the underlying data source. The execution engine will capture this exception and will interrupt the execution of this custom wrapper, interrupt the query and return the error message of this exception to the client application.- See Also:
-
commit
-
rollback
-
prepare
-
stop
public boolean stop()By default, does nothing and returnsfalse.- Specified by:
stopin interfaceCustomWrapper- Returns:
trueif this Custom Wrapper can stop its execution,falseotherwise.
-
getConfiguration
By default, returns aCustomWrapperConfigurationinstance with all the configuration parameters set to their default values.- Specified by:
getConfigurationin interfaceCustomWrapper- Returns:
- a
CustomWrapperConfigurationinstance defining this Custom Wrapper configuration parameters.
-
setInputParameterValues
public final void setInputParameterValues(Map<String, CustomWrapperInputParameterValue> paramValues) Sets the input parameter values with type information.- Parameters:
paramValues- input parameter values to be set
-
getInputParameterValue
Returns the actualCustomWrapperInputParameterValueassociated to theCustomWrapperInputParameterspecified by the name.- Parameters:
name- the name of theCustomWrapperInputParameterwhoseCustomWrapperInputParameterValueis returned.- Returns:
- the actual
CustomWrapperInputParameterValueassociated to theCustomWrapperInputParameterspecified by the name.
-
setOrderByExpressions
Sets the order by expressions when they are delegated to the source- Parameters:
orderByExpressions- order by expressions to be set
-
getOrderByExpressions
If the Custom Wrapper declares in theCustomWrapperConfigurationthat it supports orderBy delegations, it returns aListwith the expressions in the ORDER BY clause delegated to the custom wrapper.- Returns:
- a
Listwith the expressions in the ORDER BY clause delegated to the custom wrapper.
-
log
-
getCustomWrapperPlan
Returns theCustomWrapperPlanof the current wrapper execution.- Returns:
- the
CustomWrapperPlanof the current wrapper execution.
-
getSchema
Returns the schema of this wrapper. This method returnsnullif invoked from the constructor of the custom wrapper. It has to invoked once the class has been instanced.- Returns:
- array of
CustomWrapperSchemaParameterobjects that represent the schema of this wrapper. - Since:
- 7.0u20200310
-
setSchema
Important: do not invoke this method. For internal purposes only.- Parameters:
customWrapperSchema- -- Since:
- 7.0u20200310
-