Deeper Info about the Smooks Config Editor Process Page

Version 1

    Smooks Process

    This a extended concept for Smooks configuration file , The Smooks runtime can't understand it , it's only for the Smooks tools.

     

    Adding the "Process" concept is for improving the usability of the Smooks editor. In the old Smooks editor , there are less descriptions of the Smooks elements , so the editor usually made the user to be confused , specially for those user who are not familar with the Smooks --- They don't know how to start with it.

     

    "Process" can help the user to define the "Task" nodes to help them to work with the transformation.

     

    In the "Process" , you can define the several types "Task" nodes , for each "Process" , the beginning "Task" must be the "Input Task". Each Task node can add the Next Task for itself. Of course that , for different type Task , the Next Task for them are regular.

     

    Although in the Smooks configuration file we can find the Process and Task data fragment , in the fact , all of them are unreal , they can't affect the Smooks configuration file. In the other word , we can say, actually the Process and Task just are the "navigator" for configuring the Smooks configuration file.

     

    Fro example , We have added a "Input Task" , then select this task node in the Process page , the Task Configuration Section will notify user to go to the "Input Page" to configure the Input Reader.

     

    Expand this , if we detail the "Input Task" to provide the different input type Task : "CSV Input Task" , "EDI Input Task" , when we add those input task , the wizard page will be shown to help user to add the correct type input reader and the input file.

     

    This way can hide many details of configuring the Smooks configuration file.

     

    <Correct it or add more>

     

    JavaBean Mapping Process Example

    Let me see a example.

     

    I had a Smooks configuration file , now I open it and switch to the "Process tab" , it looks like this :

     

    empty_process.png

     

    The process graph is empty , because I didn't define any Task nodes here , but in the bottom of this page , there is a link can help me to analyse the Smooks config file to find out what Task nodes are in my configuration file.

     

    As we know , the Task is just a "navigator" in the Smooks configuration file, so it can mapping to some elements in the Smooks file.

     

    For example , if in the Smooks file , there are "bean" elements here, the "JavaBean Mapping" task will "link" with them; If there is any "reader" here , the "Input" task can relate to them.

     

    We define a list to show which Smooks elements can be related with the each type of  Task node:

     

    Smooks Element NameTask Type

    xsl (http://www.milyn.org/xsd/smooks/xsl-1.1.xsd)

    freemarker (http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd)

    Template Apply Task

    bean (http://www.milyn.org/xsd/smooks/javabean-1.2.xsd)

    bindings (http://www.milyn.org/xsd/smooks/javabean-1.1.xsd)

    JavaBean Mapping Task

    reader (http://www.milyn.org/xsd/smooks/csv-1.1.xsd)

    reader (http://www.milyn.org/xsd/smooks/csv-1.2.xsd)

    reader (http://www.milyn.org/xsd/smooks/json-1.1.xsd)

    reader (http://www.milyn.org/xsd/smooks/json-1.2.xsd)

    reader (http://www.milyn.org/xsd/smooks/edi-1.1.xsd)

    reader (http://www.milyn.org/xsd/smooks/edi-1.2.xsd)

    reader (http://www.milyn.org/xsd/smooks-1.1.xsd)

    Input Task
    <more><more>

     

    This is the Smooks configuration file :

     

    <?xml version="1.0" 
    encoding="UTF-8"?>
    <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
     xmlns:csv12="http://www.milyn.org/xsd/smooks/csv-1.2.xsd"
      xmlns:javabean="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd">
    
          <csv12:reader              
                 fields="TRANSDATE,TRANATIME,EXTSEQUENCENO,EXTPROVCODE,SUMPREMIUM"
                   
                 recordElementName="BIZ_LIST" rootElementName="BIZ_DATA" separator="|" 
           />
    
          <javabean:bean beanId="person" 
                             class="example.srcmodel.Person"
                             createOnElement="BIZ_DATA">
                <javabean:value 
                           data="/BIZ_DATA/BIZ_LIST/TRANSDATE"
                           property="age" />
                <javabean:value 
                           data="/BIZ_DATA/BIZ_LIST/SUMPREMIUM"
                           property="country" />
                <javabean:value 
                           data="/BIZ_DATA/BIZ_LIST/EXTPROVCODE"
                           property="firstName" />
                <javabean:value 
                           data="/BIZ_DATA/BIZ_LIST/EXTSEQUENCENO"
                           property="lastName" />
          </javabean:bean>
    
    </smooks-resource-list>
    

     

     

     

     

    When we click the "Analyse configuration file" link , the Smooks editor will add a "Input Type" task node and a "JavaBean Mapping" task node in the Process graphical panel , cause that in the Smooks configuration file , the editor finds out the "reader" element and the "bean" element here and it mapping those elements to the correct type task nodes..

     

    (My Quesion : How does the Smooks know the "JavaBean Mapping" node is the next task node of the "Input Type" task node ??)

    input_data_task.png

     

    Input Data Task Configuration

    The Input Task configuration need to switch to the "Input Page":

     

    myImage (2).png

     

    <add more description here>

     

    JavaBean Mapping Task

     

    Select the "JavaBean Mapping Task" node , the "Task Configuration" will change , a graphical panel will be put on it:

     

    process_graph_java_mapping.png

     

    In the JavaBean mapping graphical panel , we can see a "Input Model" figure here , it's the input data XML structure model.

     

    The "Input Model" comes from the "Input Task" , when finish adding the input file and configuring the "reader" in the "Input Page" , the editor will get a XML strucutred model by parsing the input file. (More details read the Input Data Task Configuration section)

     

    The another figure is the "bean" element , to provide a example can understand it easily :

     

    This is a "bean" element fragment in Smooks file :

     

    <javabean:bean beanId="person" class="example.srcmodel.Person" createOnElement="BIZ_DATA">
      <javabean:value data="/BIZ_DATA/BIZ_LIST/TRANSDATE"  property="age" />
      <javabean:value data="/BIZ_DATA/BIZ_LIST/SUMPREMIUM" property="country" />
      <javabean:value data="/BIZ_DATA/BIZ_LIST/EXTPROVCODE" property="firstName" />
      <javabean:value data="/BIZ_DATA/BIZ_LIST/EXTSEQUENCENO" property="lastName" />
    </javabean:bean>
    

     

    And the related "bean" figure in the graphical panel looks like this :

    person_bean_figure.jpg

     

    What does the connections mean ? There is a list can explain the each type connection.

     

    Source NodeTarget NodeSource Model AffectTarget Model AffectRefered Element AttributeValue Means
    Each Input Model node

    JavaBean figure

    (Root container)

    NONE

     

    bindings

    createOnElementselector text string
    Each Input Model node

    JavaBean figure

    (children figure)

    NONE

     

    value

    dataselector text string
    Each Input Model node

    JavaBean figure

    (children figure)

    NONE

     

    wiring

    wireOnElementselector text string
    Each Input Model node

    JavaBean figure

    (children figure)

    NONE

     

    expression

    execOnElementselector text string
    Each Input Model node

    JavaBean figure

    (Root Container)

    NONE

     

    bean

    (javabean 1.2)

    createOnElementselector text string
    Each Input Model node

    JavaBean figure

    (children figure)

    NONE

     

    value

    (javabean 1.2)

    dataselector text string
    Each Input Model node

    JavaBean figure

    (children figure)

    NONE

     

    wiring

    (javabean 1.2)

    wireOnElementselector text string
    Each Input Model node

    JavaBean figure

    (children figure)

    NONE

     

    expression (javabean 1.2)

    execOnElementselector text string

    JavaBean Figure

    (Wiring Type figure)

    JavaBean Figure

    (Root Container)

     

    wiring

     

    wiring

    (javabean 1.2)

    NONE

    beanIdRefBean ID value comes form the target node

    <more>

    <more>

    <more>

    <more>

    <more>

    <more>

     

    <more will come soon>