DataHandler

From GreenVulcano Wiki
Revision as of 08:37, 30 March 2012 by Anonymous (talk) (Description)
Jump to: navigation, search

Description

DataHandler Architecture

The DataHandler is a component extremely performable and configurable, which deals with extraction, edition, insertion and deletion of data and execution of stored procedures/functions of one or more RDBMS using JDBC APIs. It is only available in the Enterprise version.

This component works on XML defined by XSD. Through maps of transformation, the XML input is received and normalized into another XML, which defines the data types and values, necessary to perform operations on the database. Thereafter, the DataHandler performs operations on the database configured for the service. Depending on the type of operation configured, the DataHandler returns an output consisting in a report that describes the operation result, and a XML which, through a transformation map, is converted into a second XML defined by one XSD.

GreenVulcano® ESB Configuration

The configuration of this component occurs in three steps:

  • Definition of XSD in input and output of the service;
  • Definition of maps of conversion from the format defined in the XSD created and vice versa;
  • Composition of select/update calls in SQL language for finding/changing data in the database.

The language used for map transformation is XSLT 1.0.

DataHandler vs JDBC

Here are some differences between the connector JDBC and DataHandler (DH):

  • The JDBC connector can generally operate on a single record, operations on multiple records must be controlled by an Iterator
  • The DataHandler can handle more operations by a single invocation, the operations are controlled by the stylesheet of data conversion
  • The JDBC connector can execute the statement configured as it appears
  • The DataHandler can process a statement opportunely modified by metadata.
   select first_name, last_name, city from anagrafic
   where last_name = '@{{LAST_NAME}}'
   decode{{@{{CITY}}::NULL:: ::and city='@{{CITY}}'}}
If the parameter CITY is not populated the corresponding where clause will not be included in the statement
DataHandler vs JDBC

Here are some differences between * The DataHandler can perform multiple operations depending on data:

    • deleting a record on Table A -> removal of records matching the table B
    • inserting a record on Table A -> insert a record equivalent of an audit table C
  • Both components are used to extract the data into an internal XML format, the DH allows to aggregate results of multiple select into a single service.
  • The DH returns, in the internal XML, information about the type of fields extracted (numeric, string, date, c/blob) and its precision (date format, decimal/whole cipher, separators). That information can be used in subsequent manipulations/transformations of the data.
  • Both components can invoke the stored procedure/function, but DH allows a best control of the parameters IN/OUT and the number /sequence of procedures to be invoked, even before or after other statements typology:
    • data entry (insert statement)
    • validation procedure (call statement)
    • extraction results validation (select statement)
  • The DataHandler can operate on multiple tables in a single invocation.
  • The DH, using XA compliant JDBC connections, can operate on multiple databases in a single invocation.
  • The DH during transformations of input/output data (before of insert/update/delete and after of select), can use the helpers presents in the XSL maps that allow to perform SQL queries or scripts JavaScript and its result can be used to enhance the input/output data:
   Insert: XML with the city names -> database with numeric id => SQL retriever that maps name 
                                   -> id for inserts/updates and id -> name for the select
  • The DataHandler can perform a series of parallel data extraction into tables, or with groupings, diferents, aggregate the partial results and send the aggregate to the DTE for an eventual data transformation.
  • The DataHandler can perform a series of data extraction (also from different databases) + XML transformation (different from each other) and then add the result (via XPath) into a single document to be returned to the caller.
  • The DataHandler backs to the caller (application) a report about the operation performed: number of read/inserted/updated/discarded records and, for those discarded, also a description of the discard cause (eg. invalid data, an empty required field, key violation)
  • The DataHandler can be configured for each information change service, to behave in an appropriate manner depending on the type of the error found in the interaction with the DB (are blocked by default):
    • Platform Error
    • Data Error
    • Constraint Error
    • Error Statement
    • Security Error