DBOBuilder

From GreenVulcano Wiki
Revision as of 10:21, 2 April 2012 by Anonymous (talk) ({{GVESB}} configuration)
Jump to: navigation, search

Description

The DBOBuilder element represents a DataHandler service.

GreenVulcano® ESB configuration

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

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 output GVBuffer returned by DBOBuilder containing parameters with 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


DBOBuilder has the following 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 method="getPersonID" signature="NAME,CITY">
              select ID from PERSON 
              where NAME='@{{NAME}}'
              and ID_CITY=(select ID from CITY where NAME='@{{CITY}}')
         </DataRetriever>
         <DataRetriever cacheable="true" method="getCardID" signature="NUMBER,ID_OWNER">
              select ID from CREDIT_CARD             
              where CNUMBER='@{{NUMBER}}'
              and ID_OWNER=@{{ID_OWNER}}
         </DataRetriever>
         <DataRetriever method="getSeqVal">select SEQ_PERSON_ID.nextval from dual</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

DBO

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.