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 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 CustomWrapperException
      Defines the schema of this Custom Wrapper.
      Parameters:
      inputValues - a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined in getInputParameters()) with their current values.
      Returns:
      an array of CustomWrapperSchemaParameter that 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 CustomWrapperException
      Defines how this Custom Wrapper acts when being queried. Typically, this will involve analyzing the passed condition and inputValues, constructing a query taking into account the passed projectedFields, retrieving data from this Custom Wrapper data source and finally inserting such data in the passed result object.
      Parameters:
      condition - the query's condition (akin to the WHERE clause in a SQL query).
      projectedFields - the query's projected fields (akin to the SELECT clause 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 in getInputParameters()) 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:
      true if this Custom Wrapper can stop its execution, false otherwise.
    • insert

      int insert(Map<CustomWrapperFieldExpression, Object> insertValues, Map<String,String> inputValues) throws CustomWrapperException
      Defines how this Custom Wrapper inserts values into the data source. Typically, this will involve analyzing the passed insertValues and 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 the INSERT statement in SQL.
      inputValues - a Map<String, String> which associates this Custom Wrapper's input parameters' names (as defined in 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

      int delete(CustomWrapperConditionHolder condition, Map<String,String> inputValues) throws CustomWrapperException
      Defines how this Custom Wrapper deletes data from the data source. Typically, this will involve analyzing the passed condition and then accessing the data source to perform the required deletions.
      Parameters:
      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 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

      int update(Map<CustomWrapperFieldExpression, Object> updateValues, CustomWrapperConditionHolder condition, Map<String,String> inputValues) throws CustomWrapperException
      Defines how this Custom Wrapper updates data in the data source. Typically, this will involve analyzing the passed updateValues and condition, 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 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 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

      void commit()
      Defines how this Custom Wrappers performs a commit operation in its data source in the context of a distributed transaction.
    • rollback

      void rollback()
      Defines how this Custom Wrapper performs a rollback operation in its data source in the context of a distributed transaction.
    • prepare

      void prepare()
      Defines how this Custom Wrapper performs a prepare operation 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 the CustomWrapperConfiguration class.
      Returns:
      a CustomWrapperConfiguration instance defining this Custom Wrapper configuration parameters.