Difference between revisions of "DBOBuilder"

From GreenVulcano Wiki
Jump to: navigation, search
 
(13 intermediate revisions by one other user not shown)
Line 1: Line 1:
DBOBuilder: DataHandler service.
+
==Description==
  
It has the following attributes:
+
[[File:DBOBuilder.jpg|thumb|DBOBuilder with VulCon]]The DBOBuilder element represents a [[DataHandler]] service.
 +
 
 +
Might contain more [[#DBO|DBOs]] that represent all the elementary [[DataHandler]] operations that can be combined in a service.
 +
These [[#DBO|DBO]]s will be executed in order of definition. By default returns the output as a result of the last [[#DBO|DBO]].
 +
The output of a [[#DBO|DBO]] can be used as input of the next.
 +
 
 +
The statements used in the [[DBOBuilder#DBO|DBOs]] may contain metadata resolved at runtime that allows you to customize the actual command to be sent to the database.
 +
 
 +
The properties of the [[GVBuffer]] object can be referenced with the metadata <nowiki>@{{name}}</nowiki>.
 +
The body of the [[GVBuffer]] object, if any, is passed to the processing engine or data transformation engine, or it will be populated with the service output.
 +
 
 +
The following table shows the parameters included into the [[DBOBuilder]] output [[GVBuffer]] containing statistics about the operations done:
 +
{| class="gvtable"
 +
! Parameter !! Description
 +
|-
 +
| REC_TOTAL || number of founded records
 +
|-
 +
| REC_READ || number of read records
 +
|-
 +
| REC_INSERT || number of inserted records
 +
|-
 +
| REC_UPDATE || number of updated records
 +
|-
 +
| REC_DISCARD || number of discarded records
 +
|-
 +
| REC_DISCARD_CAUSE || Report about discarded records
 +
|}
 +
 
 +
=={{GVESB}} configuration==
 +
 
 +
The [[DBOBuilder]] element is used by [[dh-call]] and [[GVDataHandlerConfiguration]].
 +
 +
The following table shows its attributes:
 
{|class="gvtable"
 
{|class="gvtable"
 
! Attribute !! Type !! Description
 
! Attribute !! Type !! Description
Line 22: Line 54:
 
|}
 
|}
  
For example:
+
The following example shows who to configure [[DBOBuilder]] combined with the retrievers (see [[Retriever_Config|RetrieverConfig]]) and the use of metadata inside the statement:  
 
<syntaxhighlight lang="XML"><?xml version="1.0" encoding="UTF-8"?>
 
<syntaxhighlight lang="XML"><?xml version="1.0" encoding="UTF-8"?>
<dh-call class="it.greenvulcano.gvesb.virtual.datahandler.DataHandlerCallOperation" name="TestInsertXML" type="call">
+
<dh-call class="it.greenvulcano.gvesb.virtual.datahandler.DataHandlerCallOperation"
  <DBOBuilder class="it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder" jdbc-connection-name="" name="" type="dbobuilder">
+
        name="DataHandler" type="call">
      <DBOSelect class="it.greenvulcano.gvesb.datahandling.dbo.DBOSelect" name="" type="dbo">
+
    <RetrieverConfig>
           <statement type="select"/>
+
      <GenericRetriever class="it.greenvulcano.gvesb.datahandling.utils.GenericRetriever" type="retriever">
      </DBOSelect>
+
        <DataRetriever cacheable="true" method="getCityID" signature="NAME">
  </DBOBuilder>
+
              select ID from CITY where NAME='@{{NAME}}'
 +
        </DataRetriever>
 +
        <DataRetriever cacheable="true" method="getCityName" signature="ID">
 +
              select NAME from CITY where ID=@{{ID}}
 +
        </DataRetriever>
 +
        <DataRetriever>...
 +
        <DataRetriever>...
 +
        <DataRetriever>...
 +
      </GenericRetriever>
 +
    </RetrieverConfig>
 +
    <DBOBuilder class="it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder"
 +
                jdbc-connection-name="ds.gv_test" name="SearchPerson"
 +
                type="dbobuilder">
 +
      <DHVariables>
 +
          <DHVariable name="decimal-separator" value="."/>
 +
          <DHVariable name="grouping-separator" value=","/>
 +
          <DHVariable name="format" value="#0.00"/>
 +
          <DHVariable name="NAME" value="NULL"/>
 +
          <DHVariable name="CITY" value="NULL"/>
 +
      </DHVariables>
 +
      <DBOSelect class="it.greenvulcano.gvesb.datahandling.dbo.DBOSelect"
 +
                  name="SearchPerson" transformation="SearchPerson" type="dbo">
 +
           <statement id="1" keys="1,2,3" type="select">
 +
              select p.NAME, p.BIRTHDATE, c.NAME, cc.CNUMBER, cc.CREDIT, cc.ENABLED
 +
              from PERSON p, CITY c, CREDIT_CARD cc
 +
              where p.ID_CITY = c.ID
 +
              and p.ID = cc.ID_OWNER
 +
              decode{{@{{NAME}}::NULL::::and p.NAME like '%@{{NAME}}%'}}
 +
              decode{{@{{CITY}}::NULL::::and c.NAME like '%@{{CITY}}%'}}
 +
              order by c.NAME, p.NAME</statement>
 +
        </DBOSelect>
 +
  </DBOBuilder>
 +
  <DBOBuilder .../>
 +
  <DBOBuilder .../>
 
</dh-call>
 
</dh-call>
 
</syntaxhighlight>
 
</syntaxhighlight>
DBOBuilder accepts as children:
 
  
* Description
+
DBOBuilder has the following sub-element:
 +
* [[Description]]
  
* DHAliasList: List of aliases for a given DataHandler service. It contains
+
* DHAliasList: List of aliases for a given [[DataHandler]] service. It contains
** DHAlias: Alias for a DataHandler service with its Description
+
** DHAlias: Alias for a [[DataHandler]] service with its Description
  
* DHVariables: List of default values for DataHandler service's variables. It contains
+
* DHVariables: List of default values for [[DataHandler]] service's variables. It contains
** DHVariable: Default value for DataHandler service's variable including the parameters
+
** DHVariable: Default value for [[DataHandler]] service's variable including the parameters
 
*** Description
 
*** Description
 
*** ''name'': variable name
 
*** ''name'': variable name
 
*** ''value'': variable value
 
*** ''value'': variable value
  
* [[dbo_types]]: among these the DBOSelect as has been seen previously
+
* [[#DBOs|DBOs]]
 +
<div class="version_ge3.4">
 +
* [[XMLMerge]]: replace the old Merge element
 +
</div>
 +
 
 +
====DBOs====
 +
 
 +
The DBO elements represent the elementary operations of [[DataHandler]] that can be combined in a service. Those are:
 +
 
 +
* [[DBOSelect]]
 +
* [[DBOThreadSelect]]
 +
* [[DBOUpdate]]
 +
* [[DBOInsert]]
 +
* [[DBOInsertOrUpdate]]
 +
* [[DBOUpdateOrInsert]]
 +
* [[DBOCallSP]]
 +
* [[DBOFlatSelect]]
 +
* [[DBOMultiFlatSelect]]
 +
 
 +
Inside of it you can include SQL statements which may contain metadata that will be resolved prior to execution.
 +
 
 +
You can also add more DHVariable elements that define default values ​​for properties that may be missing in [[GVBuffer]].

Latest revision as of 13:07, 13 May 2014

Description

DBOBuilder with VulCon

The DBOBuilder element represents a DataHandler service.

Might contain more DBOs that represent all the elementary DataHandler operations that can be combined in a service. These DBOs will be executed in order of definition. By default returns the output as a result of the last DBO. The output of a DBO can be used as input of the next.

The statements used in the DBOs may contain metadata resolved at runtime that allows you to customize the actual command to be sent to the database.

The properties of the GVBuffer object can be referenced with the metadata @{{name}}. The body of the GVBuffer object, if any, is passed to the processing engine or data transformation engine, or it will be populated with the service output.

The following table shows the parameters included into the DBOBuilder output GVBuffer containing statistics about the operations done:

Parameter Description
REC_TOTAL number of founded records
REC_READ number of read records
REC_INSERT number of inserted records
REC_UPDATE number of updated records
REC_DISCARD number of discarded records
REC_DISCARD_CAUSE Report about discarded records

GreenVulcano® ESB configuration

The DBOBuilder element is used by dh-call and GVDataHandlerConfiguration.

The following table shows its attributes:

Attribute Type Description
type fixed This attribute must assume the value dbobuilder.
class fixed This attribute must assume the value it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder
name required Service name
jdbc-connection-name required DataSource JNDI name
transacted optional Defines if the services must be executed in transaction. Default true.
isXA optional If the service is transacted, this attributes indicates if it participates in a distributed transaction or not.
If false the DataHandler handle a local transaction. Default false
output-data optional The default is the value of @output-data of the last DBOxxx;
make-dump optional If set to none not perform the input/output data dump.
If set to text or hex then the dump is performed as text or hexadecimal string.
Default to text.

The following example shows who to configure DBOBuilder combined with the retrievers (see RetrieverConfig) and the use of metadata inside the statement:

<?xml version="1.0" encoding="UTF-8"?>
<dh-call class="it.greenvulcano.gvesb.virtual.datahandler.DataHandlerCallOperation"
         name="DataHandler" type="call">
    <RetrieverConfig>
       <GenericRetriever class="it.greenvulcano.gvesb.datahandling.utils.GenericRetriever" type="retriever">
         <DataRetriever cacheable="true" method="getCityID" signature="NAME">
              select ID from CITY where NAME='@{{NAME}}'
         </DataRetriever>
         <DataRetriever cacheable="true" method="getCityName" signature="ID">
              select NAME from CITY where ID=@{{ID}}
         </DataRetriever>
         <DataRetriever>...
         <DataRetriever>...
         <DataRetriever>...
       </GenericRetriever>
    </RetrieverConfig>
    <DBOBuilder class="it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder"
                jdbc-connection-name="ds.gv_test" name="SearchPerson"
                type="dbobuilder">
       <DHVariables>
          <DHVariable name="decimal-separator" value="."/>
          <DHVariable name="grouping-separator" value=","/>
          <DHVariable name="format" value="#0.00"/>
          <DHVariable name="NAME" value="NULL"/>
          <DHVariable name="CITY" value="NULL"/>
       </DHVariables>
       <DBOSelect class="it.greenvulcano.gvesb.datahandling.dbo.DBOSelect"
                  name="SearchPerson" transformation="SearchPerson" type="dbo">
          <statement id="1" keys="1,2,3" type="select">
              select p.NAME, p.BIRTHDATE, c.NAME, cc.CNUMBER, cc.CREDIT, cc.ENABLED
              from PERSON p, CITY c, CREDIT_CARD cc
              where p.ID_CITY = c.ID
              and p.ID = cc.ID_OWNER
              decode{{@{{NAME}}::NULL::::and p.NAME like '%@{{NAME}}%'}}
              decode{{@{{CITY}}::NULL::::and c.NAME like '%@{{CITY}}%'}}
              order by c.NAME, p.NAME</statement>
        </DBOSelect>
   </DBOBuilder>
   <DBOBuilder .../>
   <DBOBuilder .../>
</dh-call>

DBOBuilder has the following sub-element:

  • DHAliasList: List of aliases for a given DataHandler service. It contains
    • DHAlias: Alias for a DataHandler service with its Description
  • DHVariables: List of default values for DataHandler service's variables. It contains
    • DHVariable: Default value for DataHandler service's variable including the parameters
      • Description
      • name: variable name
      • value: variable value

DBOs

The DBO elements represent the elementary operations of DataHandler that can be combined in a service. Those are:

Inside of it you can include SQL statements which may contain metadata that will be resolved prior to execution.

You can also add more DHVariable elements that define default values ​​for properties that may be missing in GVBuffer.