DBOBuilder

From GreenVulcano Wiki
Revision as of 10:05, 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 plugin.

Might contain more DBOs, which 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.

DBOBuilder returns the following statistics about the operations done:

  • REC_TOTAL  : founded records
  • REC_READ  : read records
  • REC_INSERT  : inserted records
  • REC_UPDATE  : updated records
  • REC_DISCARD  : discarded records
  • REC_DISCARD_CAUSE  : Report about discarded records


It 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.