public abstract class AbstractCustomWrapper extends Object implements CustomWrapper
CustomWrapper
. Subclasses need only to
implement the methods CustomWrapper.getSchemaParameters(java.util.Map<java.lang.String, java.lang.String>)
and
CustomWrapper.run(com.denodo.vdb.engine.customwrapper.condition.CustomWrapperConditionHolder, java.util.List<com.denodo.vdb.engine.customwrapper.expression.CustomWrapperFieldExpression>, com.denodo.vdb.engine.customwrapper.CustomWrapperResult, java.util.Map<java.lang.String, java.lang.String>)
, 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.
Modifier and Type | Field and Description |
---|---|
protected static int |
LOG_DEBUG
'Debug' log level
|
protected static int |
LOG_ERROR
'Error' log level
|
protected static int |
LOG_FATAL
'Fatal' log level
|
protected static int |
LOG_INFO
'Info' log level
|
protected static int |
LOG_TRACE
'Trace' log level
|
protected static int |
LOG_WARN
'Warn' log level
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractCustomWrapper() |
Modifier and Type | Method and Description |
---|---|
void |
commit()
By default, does nothing.
|
int |
delete(CustomWrapperConditionHolder condition,
Map<String,String> inputValues)
By default, does nothing and returns
0 . |
CustomWrapperConfiguration |
getConfiguration()
By default, returns a
CustomWrapperConfiguration instance with
all the configuration parameters set to their default values. |
CustomWrapperPlan |
getCustomWrapperPlan()
Returns the
CustomWrapperPlan of the current wrapper execution. |
CustomWrapperInputParameter[] |
getDataSourceInputParameters()
By default, an empty array is returned.
|
CustomWrapperInputParameter[] |
getInputParameters()
By default, an empty array is returned.
|
protected CustomWrapperInputParameterValue |
getInputParameterValue(String name)
Returns the actual
CustomWrapperInputParameterValue associated to
the CustomWrapperInputParameter specified by the name. |
protected List<CustomWrapperOrderByExpression> |
getOrderByExpressions()
If the Custom Wrapper declares in the
CustomWrapperConfiguration
that it supports orderBy delegations, it returns a List with the
expressions in the ORDER BY clause delegated to the custom wrapper. |
CustomWrapperSchemaParameter[] |
getSchema()
Returns the schema of this wrapper.
|
int |
insert(Map<CustomWrapperFieldExpression,Object> insertValues,
Map<String,String> inputValues)
By default, does nothing and returns
0 . |
protected void |
log(int level,
String logMessage)
Adds an entry log, with the specified level.
|
void |
prepare()
By default, does nothing.
|
void |
rollback()
By default, does nothing.
|
void |
setInputParameterValues(Map<String,CustomWrapperInputParameterValue> paramValues)
Sets the input parameter values with type information.
|
void |
setOrderByExpressions(List<CustomWrapperOrderByExpression> orderByExpressions)
Sets the order by expressions when they are delegated to the source
|
void |
setSchema(CustomWrapperSchemaParameter[] customWrapperSchema)
Important: do not invoke this method.
|
boolean |
stop()
By default, does nothing and returns
false . |
int |
update(Map<CustomWrapperFieldExpression,Object> updateValues,
CustomWrapperConditionHolder condition,
Map<String,String> inputValues)
By default, does nothing and returns
0 . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSchemaParameters, run
protected static final int LOG_TRACE
protected static final int LOG_DEBUG
protected static final int LOG_INFO
protected static final int LOG_WARN
protected static final int LOG_ERROR
protected static final int LOG_FATAL
public CustomWrapperInputParameter[] getDataSourceInputParameters()
getDataSourceInputParameters
in interface CustomWrapper
CustomWrapperInputParameter
CustomWrapperInputParameter
public CustomWrapperInputParameter[] getInputParameters()
getInputParameters
in interface CustomWrapper
CustomWrapperInputParameter
CustomWrapperInputParameter
public int insert(Map<CustomWrapperFieldExpression,Object> insertValues, Map<String,String> inputValues) throws CustomWrapperException
0
.insert
in interface CustomWrapper
insertValues
- a Map<CustomWrapperFieldExpression, Object> which associates fields
with values, in similar fashion to the INSERT
statement in SQL
.inputValues
- a Map<String, String> which associates this Custom Wrapper's input
parameters' names (as defined in CustomWrapper.getInputParameters()
) with their current values.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.CustomWrapperFieldExpression
public int delete(CustomWrapperConditionHolder condition, Map<String,String> inputValues) throws CustomWrapperException
0
.delete
in interface CustomWrapper
condition
- the deletion condition (akin to the WHERE
clause in a
SQL
DELETE
statement).inputValues
- a Map<String, String> which associates this Custom Wrapper's input
parameters' names (as defined in CustomWrapper.getInputParameters()
) with their current values.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.CustomWrapperConditionHolder
public int update(Map<CustomWrapperFieldExpression,Object> updateValues, CustomWrapperConditionHolder condition, Map<String,String> inputValues) throws CustomWrapperException
0
.update
in interface CustomWrapper
updateValues
- a Map<CustomWrapperFieldExpression, Object> which associates fields with values, in similar
fashion to the UPDATE
statement in SQL
. The value can be a literal expressed
as a Java object or a field expressed as a CustomWrapperFieldExpression
condition
- the insert condition (akin to the WHERE
clause in a SQL
UPDATE
statement).inputValues
- a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined
in CustomWrapper.getInputParameters()
) with their current values.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.CustomWrapperFieldExpression
,
CustomWrapperConditionHolder
public void commit()
commit
in interface CustomWrapper
public void rollback()
rollback
in interface CustomWrapper
public void prepare()
prepare
in interface CustomWrapper
public boolean stop()
false
.stop
in interface CustomWrapper
true
if this Custom Wrapper can stop its execution,
false
otherwise.public CustomWrapperConfiguration getConfiguration()
CustomWrapperConfiguration
instance with
all the configuration parameters set to their default values.getConfiguration
in interface CustomWrapper
CustomWrapperConfiguration
instance defining this Custom Wrapper
configuration parameters.public final void setInputParameterValues(Map<String,CustomWrapperInputParameterValue> paramValues)
paramValues
- input parameter values to be setprotected final CustomWrapperInputParameterValue getInputParameterValue(String name)
CustomWrapperInputParameterValue
associated to
the CustomWrapperInputParameter
specified by the name.name
- the name of the CustomWrapperInputParameter
whose
CustomWrapperInputParameterValue
is returned.CustomWrapperInputParameterValue
associated to
the CustomWrapperInputParameter
specified by the name.public final void setOrderByExpressions(List<CustomWrapperOrderByExpression> orderByExpressions)
orderByExpressions
- order by expressions to be setprotected final List<CustomWrapperOrderByExpression> getOrderByExpressions()
CustomWrapperConfiguration
that it supports orderBy delegations, it returns a List
with the
expressions in the ORDER BY clause delegated to the custom wrapper.List
with the expressions in the ORDER BY clause
delegated to the custom wrapper.protected final void log(int level, String logMessage)
public CustomWrapperPlan getCustomWrapperPlan()
CustomWrapperPlan
of the current wrapper execution.CustomWrapperPlan
of the current wrapper execution.public CustomWrapperSchemaParameter[] getSchema()
null
if invoked from the constructor of the custom wrapper. It has to
invoked once the class has been instanced.CustomWrapperSchemaParameter
objects that represent the schema of this
wrapper.public void setSchema(CustomWrapperSchemaParameter[] customWrapperSchema)
customWrapperSchema
- -Copyright © 2024 Denodo Technologies. All rights reserved.