Interface CustomWrapper
- All Known Implementing Classes:
AbstractCustomWrapper
public interface CustomWrapper
All VDP Custom Wrappers must implement this interface. A default implementation
is provided (
AbstractCustomWrapper). For convenience, the user is
encouraged to extend AbstractCustomWrapper instead of implementing
CustomWrapper directly.-
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()Defines how this Custom Wrappers performs acommitoperation in its data source in the context of a distributed transaction.intdelete(CustomWrapperConditionHolder condition, Map<String, String> inputValues) Defines how this Custom Wrapper deletes data from the data source.Defines this Custom Wrapper's configuration based on several configurable properties provided by theCustomWrapperConfigurationclass.Defines what input parameters supports the Data Source associated to the wrapper.Defines what input parameters supports this Custom Wrapper.getSchemaParameters(Map<String, String> inputValues) Defines the schema of this Custom Wrapper.intDefines how this Custom Wrapper inserts values into the data source.voidprepare()Defines how this Custom Wrapper performs aprepareoperation in its data source in the context of a distributed transaction.voidrollback()Defines how this Custom Wrapper performs arollbackoperation in its data source in the context of a distributed transaction.voidrun(CustomWrapperConditionHolder condition, List<CustomWrapperFieldExpression> projectedFields, CustomWrapperResult result, Map<String, String> inputValues) Defines how this Custom Wrapper acts when being queried.booleanstop()Stops the execution of this Custom Wrapper.intupdate(Map<CustomWrapperFieldExpression, Object> updateValues, CustomWrapperConditionHolder condition, Map<String, String> inputValues) Defines how this Custom Wrapper updates data in the data source.
-
Method Details
-
getDataSourceInputParameters
CustomWrapperInputParameter[] getDataSourceInputParameters()Defines what input parameters supports the Data Source associated to the wrapper.- Returns:
- an array of
CustomWrapperInputParameter - See Also:
-
getInputParameters
CustomWrapperInputParameter[] getInputParameters()Defines what input parameters supports this Custom Wrapper.- Returns:
- an array of
CustomWrapperInputParameter - See Also:
-
getSchemaParameters
CustomWrapperSchemaParameter[] getSchemaParameters(Map<String, String> inputValues) throws CustomWrapperExceptionDefines the schema of this Custom Wrapper.- Parameters:
inputValues- a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined ingetInputParameters()) with their current values.- Returns:
- an array of
CustomWrapperSchemaParameterthat defines the schema of this Custom Wrapper. - Throws:
CustomWrapperException- Throw this exception if there is any error during the process of obtaining the schema of the wrapper based on these parameters. 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:
-
run
void run(CustomWrapperConditionHolder condition, List<CustomWrapperFieldExpression> projectedFields, CustomWrapperResult result, Map<String, String> inputValues) throws CustomWrapperExceptionDefines how this Custom Wrapper acts when being queried. Typically, this will involve analyzing the passedconditionandinputValues, constructing a query taking into account the passedprojectedFields, retrieving data from this Custom Wrapper data source and finally inserting such data in the passedresultobject.- Parameters:
condition- the query's condition (akin to theWHEREclause in a SQL query).projectedFields- the query's projected fields (akin to theSELECTclause in a SQL query).result- an object which receives the data retrieved by this Custom Wrapper.inputValues- a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined ingetInputParameters()) with their current values.- Throws:
CustomWrapperException- Throw this exception if there is an error during the execution of this wrapper. 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:
-
stop
boolean stop()Stops the execution of this Custom Wrapper.- Returns:
trueif this Custom Wrapper can stop its execution,falseotherwise.
-
insert
int insert(Map<CustomWrapperFieldExpression, Object> insertValues, Map<String, throws CustomWrapperExceptionString> inputValues) Defines how this Custom Wrapper inserts values into the data source. Typically, this will involve analyzing the passedinsertValuesand then accessing the data source to perform the required insertion.- 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 ingetInputParameters()) 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
int delete(CustomWrapperConditionHolder condition, Map<String, String> inputValues) throws CustomWrapperExceptionDefines how this Custom Wrapper deletes data from the data source. Typically, this will involve analyzing the passedconditionand then accessing the data source to perform the required deletions.- 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 ingetInputParameters()) 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
int update(Map<CustomWrapperFieldExpression, Object> updateValues, CustomWrapperConditionHolder condition, Map<String, throws CustomWrapperExceptionString> inputValues) Defines how this Custom Wrapper updates data in the data source. Typically, this will involve analyzing the passedupdateValuesandcondition, and then accessing the data source to perform the required updates.- 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 ingetInputParameters()) 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
void commit()Defines how this Custom Wrappers performs acommitoperation in its data source in the context of a distributed transaction. -
rollback
void rollback()Defines how this Custom Wrapper performs arollbackoperation in its data source in the context of a distributed transaction. -
prepare
void prepare()Defines how this Custom Wrapper performs aprepareoperation in its data source in the context of a distributed transaction. -
getConfiguration
CustomWrapperConfiguration getConfiguration()Defines this Custom Wrapper's configuration based on several configurable properties provided by theCustomWrapperConfigurationclass.- Returns:
- a
CustomWrapperConfigurationinstance defining this Custom Wrapper configuration parameters.
-