From jbosstools-commits at lists.jboss.org Thu Feb 18 06:09:19 2010 Content-Type: multipart/mixed; boundary="===============7995941704466850830==" MIME-Version: 1.0 From: jbosstools-commits at lists.jboss.org To: jbosstools-commits at lists.jboss.org Subject: [jbosstools-commits] JBoss Tools SVN: r20355 - trunk/smooks/docs/reference/en. Date: Thu, 18 Feb 2010 06:09:19 -0500 Message-ID: <201002181109.o1IB9J43026772@svn01.web.mwc.hst.phx2.redhat.com> --===============7995941704466850830== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ochikvina Date: 2010-02-18 06:09:18 -0500 (Thu, 18 Feb 2010) New Revision: 20355 Modified: trunk/smooks/docs/reference/en/master.xml trunk/smooks/docs/reference/en/master_output.xml Log:

https://jira.jboss.org/jira/browse/JBDS-1104 - Updated versions,correcte= d master_output file

Modified: trunk/smooks/docs/reference/en/master.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/smooks/docs/reference/en/master.xml 2010-02-18 10:35:18 UTC (rev = 20354) +++ trunk/smooks/docs/reference/en/master.xml 2010-02-18 11:09:18 UTC (rev = 20355) @@ -32,11 +32,11 @@ JBoss by Red Hat - Version: 1.1.0.M2 = + Version: 1.1.0.CR2 = = - + <title/> <para> <ulink url=3D"http://download.jboss.org/jbosstools/nightly-docs/en/smooks/pd= f/Smooks_Reference_Guide.pdf">PDF version</ulink> Modified: trunk/smooks/docs/reference/en/master_output.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/smooks/docs/reference/en/master_output.xml 2010-02-18 10:35:18 UT= C (rev 20354) +++ trunk/smooks/docs/reference/en/master_output.xml 2010-02-18 11:09:18 UT= C (rev 20355) @@ -3,1130 +3,933 @@ "http://www.docbook.org/xml/4.3/docbookx.dtd" = [ -<!ENTITY introduction SYSTEM "modules/introduction.xml"> = -<!ENTITY quickstart SYSTEM "modules/quick_start.xml"> -<!ENTITY smooksformeditor_graphicaltab SYSTEM "modules/smooksformeditor_gr= aphicalpage.xml"> = -<!ENTITY smooksformeditor_configurationtab SYSTEM "modules/smooksformedito= r_configurationpage.xml"> = -<!ENTITY smooksformeditor_sourcetab SYSTEM "modules/smooksformeditor_sourc= epage.xml"> = -]><book xmlns:diffmk=3D"http://diffmk.sf.net/ns/diff"> - - <bookinfo> - - <title>Smooks Dev Tools Reference Guide - - - - - = - - - = - = - - - Xue(Dart) - Peng - - - November 2008 - - 2009 - JBoss by Red Hat - - - Version: 1.1.0.CR1 - - - - - - PDF version - - - - - - - = - - - - - JBoss Tools - Smooks - JBDS - - - Introduction - This chapter gives you a short introduction to Smooks, Smooks tools= and its installation. - First, have a look at the key features of Smooks tools: -
- Key Features of Smooks Tools - Here, we provide you with a key functionality which is integrated = in Smooks tools. - - = - Key Functionality for Smooks Tools - - = - - - - = - - - Feature - Benefit - Chapter - - - = - - = - - Smooks Configuration File Wizard - Smooks tools allows to create/edit the Smooks configura= tion file for Java2Java data transformation. - - Smooks Configuration File Wiz= ard - - - = - - Smooks Editor - Smooks Editor helps configure the created Smooks config= uration file. - - Smooks Editor - - - = - - = - -
- = - = - = -
- = - = - = -
- What is Smooks? - - Smooks is a Java Framework/= Engine for processing XML and non XML - data (CSV, EDI, Java, JSON etc). - - - - - Transformation: Perform a wi= de range of - Data Transforms. Supports many different Source and Result types - -XML/CSV/EDI/Java/JSON to XML/CSV/EDI/Java/JSON. - - - Java Binding: Bind into a Ja= va Object - Model from any data source (CSV, EDI, XML, Java, JSON etc). - - - - Huge Message Processing: Pro= cess huge - messages (GBs) - Split, Transform and Route message fragments to JMS= , File, - Database etc destinations. Route multiple message formats to multiple - destinations in a single pass over a message. - - - - Message Enrichment: Enrich a= message with - data from a Database, or other Datasources. - - - - Combine: Combine the above f= eatures in - different ways e.g. add Message Enrichment as part of a Splitting and - Routing process. - - - -
- Smooks - - - - - -
- For More informations about Smooks, please visit Smooks official= site. -
-
- What is Smooks Tools? - - Smooks tools is a set of graphical tools for editing Smooks config= uration file - based on Eclipse. -
- Smooks Form editor - - - - - -
-
-
- How to install Smooks dev tools? - - The Smooks tools was included by the = JBoss Tools since 3.0.0 - Beta1 version. You can download the JBoss T= ools from JB= oss download site. - Smooks tools (JBoss Tools)= run with the latest Eclipse and - other required plug-ins (GEF, EMF, etc.). - You should download the latest IDE for Java EE developers from Eclipse site. It co= ntains many plug-ins ( - GEF, EMF, etc. ) required by Smooks dev tools. - = - Now let's progress to more advanced topics. -
- -
- - = - - - - - JBoss Tools - Smooks - JBDS - java - - - Quick Start - This "Quick Start" will show how to use the Smooks tools to create/edit the Smooks - configuration file for Java2Java data transformation. - This chapter gives you a brief understanding of the Smooks tools. -
- Download Smooks Java-to-Java Example - Visit smooks examples page to download the "java-to-java"= example project. - - Tip: - - The example project is based on Maven, we suggest you to create = a new eclipse - Java project, copy the example code and .jar files from the example pr= oject and paste - them into the eclipse Java project. - -
-
- Mapping rules - At the begining of working with Smooks tools, - we need to understand the Java-to-Java mapping rules of this example. - The transform input Java class is example.sourcemodel.Order , its structure looks like= this : - -
- Order class - - - = - - -
- Let's describe the structure of example.sourcemodel.Order in short: - - Order class contains a Head= er class and a List class= . - The Header clas= s has customerName,customerNumber,priority as properties. - In Order class the objects of the OrderItem class are s= tored in the List. - OrderItem has price,productId,quantity as its properties. - - Let's look at the transform target Java class : LineOrder. - On the screen below you can see its structure: -
- LineOrder class - - - = - - -
- - LineOrder class = contains 3 properties:customerId,customerName,priority and an array of lineItems. - The Header class= has customerName,customerNumber,priority as its properties. - OrderItem objects are stored in a List. - - Now it's the time to define the mapping rules to transform the inp= ut source java class to the target java class: - - Each instance of the Order class should be mapped with = an instance of the LineOrder class. - The value of customerName of the Header class should be assigned to the customerName property of a LineOrder instance.<= /listitem> - The value of customerNumber= of the Header class should be assigned to the customerId property of a LineOrder instance. - The value of priority of the Header class should be assigned to the priority property of LineOrder instance. - For the orderitems List of the Order instance, it's necessary to map a new lineItems array = instance of LineOrder , - and each OrderItem instance in the orderItems List should be transforme= d to a LineItem instance, - those instances will be put into the lineItems array. - The value of productId of the OrderItem instance should be assigned to the 'productCode' of= LineItem. - The value of price of OrderItem should be assigned to the unit= Price of LineItem. - = - -
- = -
- Smooks Configuration File Wizard - Select the Smooks Java-to-Java example project that you created an= d right-click, - select the menu New > Other, then find - Smooks > Smooks Configuratio= n File. - Click the - Next - button. -
- Selecting Smooks Configuration File Wizard - - - - - -
- The first wizard page is a file path creation page. Select the - src - folder to be the files container, and input the name - smooks-config.xml. Click - Next. -
- Choosing the configuration file container and the file name</tit= le> - <mediaobject> - <imageobject> - <imagedata fileref=3D"images/quick_start/quick_start2.png" scale=3D"9= 0"></imagedata> - </imageobject> - </mediaobject> - </figure> - <para><diffmk:wrapper diffmk:change=3D"changed">The second wizard page i= s allows you to select Smooks configuration file version. Select the appro= priate one and click </diffmk:wrapper><emphasis><property moreinfo=3D"none"= >Finish</property></emphasis><diffmk:wrapper diffmk:change=3D"changed"> to = complete the wizard.</diffmk:wrapper></para> - = - = - = - <!--<para> As the quick start introduces how to create/edit the Java-to-= Java Smooks - configuration file, let's select the<emphasis> - <property>Java-to-Java</property> - </emphasis> type as the source/target transform data type. </para> - - <figure> - <title>Selecting Data Type - - - - - -
- - On the next page you are prompted to choose the source data for tr= ansformation. - Let's select the Order class from the example= project as - the source JavaBean class. - -
- Selecting the Source Data - - - - - -
- - Then the wizard page asks you to choose the target data for transf= ormation. We select - the ListOrder class as the target JavaBean class.<= /para> -
- Selecting the Target Data - - - - - -
- - - - - Tip: - You can omit two these steps and just press - Finish. This will open the = empty - Smooks Configuration file. It's possible to select source/target data= afterwards - in the Smooks Graph editor. - --> -
-
- Smooks Editor - - When all the wizard steps are passed, a new Smooks Configuration f= ile is created and - the Smooks Configuration Editor= will be opened automatically: -
- Smooks Editor - - - - - -
- On the bottom of this editor there are 5 tabs, they are : - = - Overview, Reader, Message Filter, Graph, Source. -
- Adding the input data - At first, we need to add the Order class as the input data. - To do this, click the Reader tab, swich to the Reader/Input editor pag= e - = - - = - - To choose the transform data you should open - Reader tab and click = - Add button in the Inp= ut Data section. -
- Input Data section - - - - - -
- After clicking the button the Data Typ= e Selection wizard is - opened, and there are many data types in the list: Java, XML etc. - - Note - There will become more and more data types on the list as the de= velopment goes on. - - - -
- Data Type Wizard - - - - - -
- - Select the - Java - data type and click N= ext, you will - see the JavaBean class selection page: - -
- JavaBean Data Selection - - - - - -
- - Let's select the Order class from the example project as the sour= ce JavaBean class.After that click - Finish - and you should see the just added java class, being displa= yed in the Input Data Section. - -
- Displaying the Structure of the Transformed Data - - - - - -
-
-
- Adding the target Bean - After adding the input data, let's switch to the Message Filter p= age: -
- Displaying the Structure of the Transformed Data - - - - - -
- Click the Add button, the = Add Child wizard page will be shown,= let's select the Java Binding v1.2 -> Bean = v1.2 and click OK to add the Bean : - -
- Add Child wizard - - - - - -
- Then we can find on the Message Filter page the Bean v1.2 item added, click on it ,a Bean v1.2 secti= on should appear to the right of the page. - The section represents a GUI for editing B= ean v1.2 properties: -
- Bean v1.2 section - - - - - -
- You should input - lineOrder as the Bean's id in the "Bean Id" field.Then you = should click Browse button - near the Class textfield and se= lect LineOrder as the Bean's class. - - - When you enter a value for the Class text field, - you can type 'Alt + /' and the content assist pop dialog will be show= n, - so it's will increase the efficiency. If 'Alt + /' doesn't work, - try to use the 'Ctrl + space'('Key Assist' of Eclipse). - - - Let's click the Add Binding link at the bottom of this page, - it will show a dialog to ask the binding of what Bean properties you w= ill prefer to add. - Select all and click OK, you will see a list of Binding elements added= under the Bean item. - Then you should add an array of beans called lineItems and a Bean LineItem.These two classes and Id= values are: - Array Bean: - - BeanId : lineItems; - Class : example.trgmodel.LineItem[] - - LineItem Bean : - - BeanId : lineItem; - Class : example.trgmodel.LineItem - - - - In Smooks , to be an array of Beans , the class value should end with = '[]'. This means that this bean is an array type. - = - - - To finish this work, use the Add Bind= ing link to add all the bindings for the Bean. -
- = - = -
-
- Mapping - - - How to map the java class just added? - = - First, you should know what to transform: - - - - Bind the - "customerName" - property of the Order#header<= /property> to the - "customerName" - property of LineOrder. - - - Bind the - "customerNumber" - property of the Order#header<= /property> to the - "customerId" - property of LineOrder. - - - Bind the - "price" - property of the OrderItem to the - "unitPrice" - property of LineItem. - - - Bind the - "productId" - property of the OrderItem to the - "productCode" - property of LineItem. - - - Bind the - "quantity" - property of the OrderItem to the - "unitQuantity" - property of LineItem. - - - - Make sense? - You should open Design tab and click Add button. In opened Add Child Wi= zard,please, select - Add Smooks Resource>Java Binding>Bin= dings. = - - First of all, you should bind - Order to - LineOrder. To do thi= s one - Bindings Item shoul= d be added to the Resource List. -
- Mapping - - - - - -
Click on it and you should see - Bindings Section to = the right of - Message Filtering Resources.Write lineOrder<= /emphasis> in the - Bean id field. - Select - example.trgmodel.LineOrder in the - Class field and - example.srcmodel.Order in the - Name field.Your Smooks Configuration Editor= should look like this: -
- Mapping - - - - - -
- = - Now you should bind two values "customerNumber" - property of the Order#header to the - "customerId" - property of LineOrder= .To do this right click your just created - Bindings Item >Add Smooks Resource>Va= lue - . - = -
- Mapping Editor - - - - - -
- Note: - Please, remember that the root nodes of the source data and targe= t data *MUST* be - connected. - This rule is not only for Java-to-Java, but also is relevant for - XML-to-Java - - Do the same operation with the = - other properties in this and other classes. - It's also necessary to bind - orderItems property o= f the - Order to - lineItems property = of - LineOrder.The diff= erence from the previous steps is that the - orderItems is pre= sented by the list of - Order and - lineItems
is th= e massive of - LineItem .To d= o the binding,you should use - Wiring Item.Fi= rst you should create a new Binding item. This is a configuration that al= lows you to construct an object graph .Select - example.trgmodel.LineItem[] in the Class field and orderItems in the Name field,in bean= Id write lineItems. - Your Smooks Configuration Editor should look like this: = -
-
- Creating Wiring Item - - - - - -
- Then you should right click - lineOrder binding ite= m - >Add Smooks Resource>Wiring.Select - lineItem in - Bean id Ref. - - The final step is to add new Wiring item to lineOrder Binding.In the Bean = id Ref select - lineItems and in - Property select - lineItems. - - Now, you should save the file and the = Smooks tools generate the correct - configuration file content. - OK, let run the test class: example.Ma= in. (Please, make sure that the Smooks engine - loads the correct configuration file). - Success! -
-
- - - = - - - - - JBoss Tools - Smooks - JBDS - - - Smooks Design Page - In this section you will explore the details of Smooks Design Page = usage. - Smooks Design Page is one ta= b of the Smooks Editor. -
- Design Page - - - - - -
- This page consists of 3 sections: Message Filtering Resources, Inpu= t Data and the section devoted to the configurations of a selected in a Mes= sage Filtering Resources section Item. - You can bind classes using Bi= ndings item - on the Design page of the Smooks Ed= itor. - - Resource list item in = - Message Filtering Resources corresponds to the root element of the - smooks-config.xml fi= le.You can configurate the next four properties using corresponding field= s: - - - default-selector:Defi= nes the selector that will be applied to all resource-config elements in th= e - smooks-config.xml, w= here a selector is not defined. - - default-selector-namespace:Defines the default selector namespace. - - default-target-profile: Defines the default target profile that will be applied to all resources= in the smooks-config.xml. - - default-condition-ref= :The condition is applied to resources where an empty "condition" element (= i.e. <condition/>)is defined.The condition element does = not reference a globally defined condition. - - The configuration editor also edits the Smooks parse - type and manages the Import - Files. -
- Selector generate dialog - Using - Selector generate dialog you can allow the user to select a node for generation "selector" for smooks-config file. - To open the dialog you should left click Br= owse button in - Default Selector sec= tion. - -
- Selector generate dialog - - - - - -
- When the dialog is opened you should click "Click to add input data"to set the selector. - In the opened - Data Type Selection = Wizard you should choose the type of the file and the file itself you want = to load to the - Selector generate dialog.After that your dialog should look nearly like that: -
- Selector generate dialog after adding Input Data - - - - - -
- The final step is to choose the node you want to make a selector f= or - smooks-config.xml. = -
= -
- - Smooks Parse Type - If your config file doesn't contain - Global Parametres ite= m yet, you should add it by right click - Resource List>Add Smooks Resource>Gl= obal Parametres.After this step you should add - Param to just creat= ed - Global Parametres.= -
- Adding Param to created Global Parametres - - - - - -
- Then left click - Param - and in the Param section, you will see a set of text fields:= - Name, - Type and - Text. - Name value is requ= ired. To set a parse type you should write SAX/DOM to the = - - Text field. - -
- Filling Param section field Name and Text Value for set a Parse = Type - - - - - -
- To apply changes to the - smooks-config.xml cli= ck - Save button ( - Ctrl+S). -
-
- - Import Smooks Configuration page - Right click - Resource List>Add Smooks Resource>Imp= ort Smooks Configuration - , then you should see a new - Import Smooks Configuration - item in the list (see the figure below). - = -
- Import Data - - - - - -
- Left click the added item and to the left of - Message Filtering Resources Import Smooks = Configuration section should appear. Click the - Browse - button and select the file you want to import(see File selection section). - Click - Save and the &l= t;import> tag with the corresponding file path as a - file property will b= e added to the - smooks-config.xml.<= /para> -
-
- File selection - Some attributes in Smooks elements should store path to a file as = a value - (e.g. attribute "mappingModel" of the element "e= di:reader"). - You can see a Browse button near the fields, that set such a value to = the attribute - (e.g. "Mapping Model"<= /emphasis> field set a value to the "= mappingModel" attribute). - -
- EDI:Reader element - - - - - -
- = - When you click Browse, the dialog prompts you click one of two buttons: - Browse File System and Browse WorkSpace. = - -
- Browse dialog - - - - - -
- Using the buttons you can locate the file you need. If you click = - Browse File System bu= tton you specify the path of, or browse to, a file system directory. - -
- Browse file system - - - - - -
- - If you click Browse WorkSpace button, you specify the path of, or browse to, a workspa= ce relative working directory. - -
- Browse Workspace - - - - - -
-
- -
- - = - - - - - JBoss Tools - Smooks - JBDS - - - Smooks Source Editor Page - This section provides information about Smooks Source Editor Page.<= /para> -
- XML Source Editor - You can use this editor to edit the Smooks Configuration file dire= ctly. -
- Graphical Editor - - - - - -
-
-
- Error underlining in Graphical Editor - If the Smooks tools can't u= nderstand the configuration - file or the configuration file is illegal (XML structure isn't right fo= r Smooks - Configuration file, etc.), the error is underlined. -
- Graphical Editor - - - - - -
- - = - = - = -
- = -
- Smooks Configuration File Validator - Smooks configuration file validator will validate your Smooks conf= iguration file. Just right-click on the file and then click on the Validate button. The validator can be enabl= ed/disabled in Window -> Preferenc= es -> Validation: - = -
- Validation: Smooks Configuration File Validator - - - - - -
- - You can set up your Smooks validator to include, exclude groups to = validate and specify rules for validation. Just click on the Settings button and use the options provided: - = -
- Smooks Configuration File Validator Settings - - - - - -
- = - = - We hope, our guide will help you to get started with JBoss Smooks = Tools. Besides, for additional information you are welcome on JBoss forum. - = -
- = - = - = - = -
- - + = + + + +]> + + + + Smooks Dev Tools Reference Guide + + + + + = + + + = + = + + + Xue(Dart) + Peng + + + 2009,2010 + JBoss by Red Hat + + + Version: 1.1.0.CR2 = + + + + + + PDF version + + + + + + + = + + + + + JBoss Tools + Smooks + JBDS + + + Introduction + This chapter gives you a short introduction to Smooks, Smooks tools= and its installation. + First, have a look at the key features of Smooks tools: +
+ Key Features of Smooks Tools + Here, we provide you with a key functionality which is integrated = in Smooks tools. + + = + Key Functionality for Smooks Tools + + = + + + + = + + + Feature + Benefit + Chapter + + + = + + = + + Smooks Configuration File Wizard + Smooks tools allows to create/edit the Smooks configura= tion file for Java2Java data transformation. + + Smooks Configuration File Wiz= ard + + + = + + Smooks Editor + Smooks Editor helps configure the created Smooks config= uration file. + + Smooks Editor + + + = + + = + +
+ = + = + = +
+ = + = + = +
+ What is Smooks? + + Smooks is a Java Framework/= Engine for processing XML and non XML + data (CSV, EDI, Java, JSON etc). + + + + + Transformation: Perform a wi= de range of + Data Transforms. Supports many different Source and Result types + -XML/CSV/EDI/Java/JSON to XML/CSV/EDI/Java/JSON. + + + Java Binding: Bind into a Ja= va Object + Model from any data source (CSV, EDI, XML, Java, JSON etc). + + + + Huge Message Processing: Pro= cess huge + messages (GBs) - Split, Transform and Route message fragments to JMS= , File, + Database etc destinations. Route multiple message formats to multiple + destinations in a single pass over a message. + + + + Message Enrichment: Enrich a= message with + data from a Database, or other Datasources. + + + + Combine: Combine the above f= eatures in + different ways e.g. add Message Enrichment as part of a Splitting and + Routing process. + + + +
+ Smooks + + + + + +
+ For more informations a= bout Smooks, please= visit Smooks official site. +
+
+ What is Smooks Tools? + + Smooks tools is a set of graphical tools for editing Smooks config= uration file + based on Eclipse. +
+ Smooks Form editor + + + + + +
+ Th= e easiest way to use the Smooks Configuration Editor is to create a project + (Java project, an ESB project, etc.), right-click on it and select New -> Other + to open the New wizard. Drill into Sm= ooks -> Smooks Configuration File + and continue through the wizard. We recommend using a minimum Smooks le= vel of 1.1 or 1.2, but if you're using it in a deployed service, it depends= on what version your runtime supports. + Once the file is created, it will open in the Smooks Configuration Edit= or. +
+
+ How to install Smooks dev tools? + + The Smooks tools was included by the = JBoss Tools since 3.0.0 + Beta1 version. You can download the JBoss T= ools from JB= oss download site. + Smooks tools (JBoss Tools)= run with the latest Eclipse and + other required plug-ins (GEF, EMF, etc.). + You should download the latest IDE for Java EE developers from Eclipse site. It co= ntains many plug-ins ( + GEF, EMF, etc. ) required by Smooks dev tools. + The Smooks Configuration d= epends on having all of the appropriate Smooks runtime jars in the path of = the Eclipse Plug-in or Java Project in the Eclipse workspace. + = + The easiest solution is to do the following: + + 1) Download th= e Smooks distribution from here: http://www.smooks.org/mediawiki/index.php?= title=3DDownloads . + Grab the latest "ALL" distribution (as of today, it is the Smooks v.1= .2.2 "ALL" distribution) and it will include binaries, examples, etc. + 2) Extract f= iles from the archive somewhere on your machine. + 3) In your E= clipse workspace, copy the Smooks jars into a directory of your Eclipse plu= g-in or Java project named "lib". + 4) For your Ec= lipse Plug-in or Java Project, right-click on the project and select Proper= ties. + 5) Select the = "Java Build Path" item in the Properties list, select the Libraries tab, an= d click "Add JARs" + + 6) In the Ja= r Selection dialog, select all the jars in the "lib" directory mentioned in= step 3 and click OK. + + 7) Click OK to close the Properties dialog. Now you should see a "Referenced Lib= raries" node that appeared in your project hierarchy in Eclipse. + + + = + + Now let's progress to more= advanced topics. +
+ +
+ + = + + + + + JBoss Tools + Smooks + JBDS + + + <diffmk:wrapper diffmk:change=3D"added"= >Tasks</diffmk:wrapper> + = This chapter describes the main tasks a user can be faced during Smooks too= ls usage. +
+ <diffmk:wrapper diffmk:change=3D"changed">New Smooks Config= uration File Creation</diffmk:wrapper> + Select the projec= t where you want to create new Smooks Configuration File and right-click o= n it, + select in the menu New > Other, then find + Smooks = > Smooks Configuration File. + Click the + Next + button. +
+ Selecting Smooks Configuration File Wizard + + + + + +
+ The first wizard page is a file path creation page. Select t= he + src + folder to be= the files container, and input the name + smooks-= config.xml.= Click + Next. +
+ Choosing the configuration file container and the file = name + + + + + +
+ The second wizard = page allow you to select Smooks configuration file version. Select the appr= opriate one and click Finish to complete the wizard. +
+
+ <diffmk:wrapper diffmk:change=3D"changed">Input Task Config= uring</diffmk:wrapper> + = + Input task configuring is an obligatory step for your smooks project cre= ation. + You can configure it on the Process page of the editor: look f= or the "Input Task" in the Process Map at the top of the page. + +
+ <diffmk:wrapper diffmk:change=3D"changed">Input Task Co= nfiguring</diffmk:wrapper> + + + = + + +
+ Select it and you wi= ll see all the properties to set for the Input reader of your Smooks config= uration. + "Input type" corresponds to the type of data that you will be = working with. = + For example, to work with incoming CSV (Comma-separated Values= ) data, you would specify "CSV" in the drop-down list. + Each reader type has slightly different configuration details = that must be set in the "Input configuration" area. + For instance, the CSV reader requires you to specify details s= uch as the encoding, quote character, separator character, and the list of = incoming fields. = + The EDI reader requires the encoding and the path to the Mappi= ng Model describing the incoming data. = + In the Input data section, you specify some sample data that conforms to your= reader configuration. = + + = + + Once you've specified your reader configuration and sample dat= a, you can see the input model rendered in a tree form in the Input model section. + On the picture below you can see the correct configuration of = some XML input task. + +
+ <diffmk:wrapper diffmk:change=3D"changed">Input Task Co= nfiguring</diffmk:wrapper> + + + + + +
+
+
+ <diffmk:wrapper diffmk:change=3D"ad= ded">"Java Mapping" or "Apply Template"?</diffmk:wrapper> + = + Though there are man= y options in Smooks as far as what you can do with input = + data such as transformation, routing, and persistence, this ve= rsion = + of the Smooks Configuration Editor focuses only on these areas= : = + mapping to java and applying templates to create different out= put formats. = + If you have a set of Java classes you want to use the incoming= data for, = + you can use the "Java Mapping" task to specify those classes a= nd use drag and + drop to map between the input model generated by the reader an= d elements in the output model. + Or if you simply want to transform your output to one or more = formats, you can use the "Apply Template" = + task to map it to a CSV file, XML or XSD file (and other forma= ts in the future). + Note + Now you ca= n't transform your output directly, + using only Input and Template tasks. + You should use Mapping as an interagent between these = tasks. + + +
+
+ <diffmk:wrapper diffmk:change=3D"changed">Java Mapping Task= </diffmk:wrapper> + = + + If you decide to do Java Mapping, you need to make sure that y= our Input reader has been set up and you have some sample data specified. + Then you should select Input Task in the Process tab and click the plus (+)= sign to the right of the icon. + Select Java Mapping from the popup menu and it will appear to the right, conn= ected to Input Task. Then select Java Mapping task. + +
+ <diffmk:wrapper diffmk:change=3D"changed">Java Mapping = configuration</diffmk:wrapper> + + + + + +
+ Another method of = adding J= ava Mapping element = + to the canvas in the Processing Tasks section is to right clic= k Input Task + element and select Java Mapping in the popup menu <= /diffmk:wrapper> +
+ <diffmk:wrapper diffmk:change=3D"changed">Java Mapping = configuration</diffmk:wrapper> + + + + + +
= + + Right-click on the canvas in an empty space and select "Add -&= gt;Java Class". + +
+ <diffmk:wrapper diffmk:change=3D"changed">Java Mapping = configuration</diffmk:wrapper> + + + = + + +
+ + Java Bean Cr= eation = wizard appears. + Specify a unique identifier for the new class, the class path, = + whether it's an array or not, and if it is a collection, also = specify the collection class. + If the Java class is specified, you'll see a list of the prope= rties in the box below. + Click Finish when you're done. + Now with the input and output models on the canvas, you can cl= ick and drag = + from the various input elements to corresponding output elemen= ts. = + Make sure to connect collection elements to corresponding coll= ection elements. + Finally your mapping should look nearly like the one on the pi= cture below. + +
+ <diffmk:wrapper diffmk:change=3D"changed">Final Mapping= schema</diffmk:wrapper> + + + + + +
+
+
+ <diffmk:wrapper diffmk:change=3D"ad= ded">Apply Template Task</diffmk:wrapper> + = + The "Apply Template"= task works very similarly to the "Java Map= ping" task,= where you map between an input model and an output model. + Select the = Java Mapping task you want to use as the i= nput model in the Process Map pane and click the plus (+) sign to the right= of the icon. + +
+ <diffmk:wrapper diffmk:change=3D"changed">Apply Templat= e configuration</diffmk:wrapper> + + + = + + +
+ + Select "Apply Template" from the popup menu and it will appear= to the right, connected to the task you created it from. Then select the "= Apply Template" task. + Once you've defined your template model, you can click and dra= g from the various input elements to corresponding output elements in the t= emplate. Make sure to connect collection elements to corresponding collecti= on elements + +
+
+ <diffmk:wrapper diffmk:change=3D"ad= ded">Smooks Configuration testing using Smooks Run Configuration</diffmk:wr= apper> + = + This option is inten= ded to view the results of Smooks transforming procedure. + For more detailed information about this option please go here. +
+
+ + + + + JBoss Tools + Smooks + JBDS + + + Reference + This chapter includes detailed reference information about Smook= s Tools. +
+ Smooks Configuration Editor + This chapter describes the following tabs of the Smooks Configur= ation Editor: + + + Process tab + Options tab + Sourc= e tab + +
+ Process tab + The Process tab of the Smooks Configuration Editor helps to c= onfigure different types of transformations. + By default smooks configuration file is opened in this editor.I= f you have another default settings for editor opening + you should left click smooks configuration file and select:Open With->Smooks Configuration Editor. + The Process tab has two sections: + + Proce= ssing Task section + Selecte= d Task Details section + + You can see them on the picture below. +
+ Two Sections of the Process tab. + + + + + +
+
+ Processing Task section + Using the popup menu in the Processing Task section you + can select which types of technologies(templating or mapping on= es) you will use for transofmation: + The descriptions of the popup menu options are in the fol= lowing table. + + Process Tab. Processing Task section. = + + + + + = + + + Option = + Description + Default + + + + + Add Task + Select one of the following tasks accord= ing to the necessary type of Source and Result types of the files: + + Input -this task is required and + appears automatically when Smooks c= onfig file is created. + You should just configure it proper= ly. + Java Mapping<= /emphasis> + Apply Templat= e + + + + = + = + + Delete + Click this option if you want to delete = some task from the section. + Note:you can't delete input task because it's r= equired. + + = + = + = + + Input Methods + Choose one of the following methods: + + System + Simple + Amharic(EZ+) + Cedilla + Cyrillic + Inuktitut + IPA + Multipress + SCIM Bridge Input Metho= d + SCIM Input Method + Thai-Lio + Tigrigna-Eritrean(EZ+)<= /para> + Tigrigna-Ethiopian(EZ+)= + Vietnamese + X input Method + + + System + = + + +
+
+
+ Selected Task Details Section + The options of this section depends on the selected task in th= e Processing Task section. + Because there are 3 types of tasks there are 3 different sets of= its options in the Selected Task Details Section. + They will be described one by one. +
+ Selected Task Details Section for Input Task. + On the picture below you can find an example of Select= ed Task Details Section view + if XML is selected as input type. + = +
+ Selected Task Details Section for Input XML Task.= + + + + + +
+ As you can see on the picture above Input Configuratio= n section is empty for XML input file. + But this section has special configuration options for C= SV,EDI,JSON,Custom input files. + = + Here are the screens of these configuration options: + + CSV: +
+ Selected Task Details Section for Input C= SV Task. + + + + + +
+
+ EDI: +
+ Selected Task Details Section for Input E= DI Task. + + + + + +
+
+ JSON: +
+ Selected Task Details Section for Input J= SON Task. + + + + + +
+
+ Custom: +
+ Selected Task Details Section for Input C= ustom Task. + + + + + +
+
+
+ All the input task configuration positions can be found i= n the table below: = + + Selected Task Details Section. Options for Input Task.</t= itle> = + <tgroup cols=3D"3"> + <colspec colnum=3D"1" align=3D"left" colwidth=3D"1*"/> + <colspec colnum=3D"2" align=3D"left" colwidth=3D"3*"/> + <colspec colnum=3D"3" align=3D"left" colwidth=3D"1*"/> = = + <thead> + <row> + <entry>Option</entry> = + <entry>Description</entry> + <entry>Default</entry> + </row> + </thead> + <tbody> + <row> + <entry>Input type</entry> + <entry>Select your type of input file. + If don't find your type in the list,you should u= se Custom type: + <itemizedlist> + <listitem><para>No Input</para></listitem> + <listitem><para>XML</para></listitem> + <listitem><para>Java</para></listitem> + <listitem><para>XSD/WSDL</para></listitem> + <listitem><para>CSV</para></listitem> + <listitem><para>EDI</para></listitem> + <listitem><para>JSON</para></listitem> + <listitem><para>Custom</para></listitem> + </itemizedlist> + </entry> + <entry>XML</entry> + </row> = + = + <row> + <entry>Input configuration + + </entry> + <entry> + <itemizedlist> + <listitem><para><emphasis>No Input</emphasis> -n= o info required</para></listitem> + <listitem><para><emphasis>XML</emphasis> -no inf= o required</para></listitem> + <listitem><para><emphasis>Java</emphasis> -no in= fo required</para></listitem> + <listitem><para><emphasis>XSD/WSDL</emphasis> -n= o info required</para></listitem> + <listitem><para><emphasis>CSV</emphasis></para><= itemizedlist> + <listitem><para><emphasis>Fields</emphasis> = -Comma separated list of CSV record field names + </para></listitem> + <listitem><para><emphasis>Separator Characte= r</emphasis> -Field separator character. Default of ','. + </para></listitem> + <listitem><para><emphasis>Quote Character</e= mphasis> -Quote character. Default of '"'. + </para></listitem> + <listitem><para><emphasis>Record Name</empha= sis> -Name of csv record element.Default:csv-record</para></listitem> + <listitem><para><emphasis>Root Name</emphasi= s> -Name of csv root element.Default:csv-set</para></listitem> + <listitem><para><emphasis>indent</emphasis> = -Add indentation character data to the generated event stream. This simply= makes + the generated event stream easier to rea= d in its serialized form. Useful for + testing etc.Default:true + </para></listitem> + <listitem><para><emphasis>Skip Lines</emphas= is> -Number of lines to skip before processing starts. Default of 0. + = + </para></listitem> + </itemizedlist> + </listitem> + <listitem><para><emphasis>EDI</emphasis></para> + <itemizedlist> + <listitem><para><emphasis>Target Profile</e= mphasis> -Defines the target profile + </para></listitem> + <listitem><para><emphasis>Encoding</emphasi= s> -The character encoding. Default "UTF-8"</para></listitem> + <listitem><para><emphasis>Mapping Model</em= phasis> -Defines the EDI Mapping Model configuration for processing the = + EDI message stream to a stream of SAX e= vents that can be processed by Smooks.</para></listitem> + <listitem><para><emphasis>Validate</emphasi= s> -This attribute turns on/off datatype validation in the EDI Parser. + Validation is on by default. + It makes sense to turn datatype validat= ion off on the EDI Reader = + if the EDI data is being bound into a J= ava Object model. + </para></listitem> + </itemizedlist> + </listitem> + <listitem><para><emphasis>JSON</emphasis></para> + <itemizedlist> + <listitem><para><emphasis>Target Profile= </emphasis> -Defines the target profile</para></listitem> + <listitem><para><emphasis>Array Element = Name</emphasis> -The element name of a array element. Default of 'element'. + </para></listitem> + <listitem><para><emphasis>Encoding</emph= asis> -encoding: The default encoding of any JSON message = + InputStream processed by this Reader= . Default of 'UTF-8'.</para></listitem> + <listitem><para><emphasis>Illegal Elemen= t Name Char Replacement</emphasis> -If illegal characters are encountered i= n a JSON element name then they are replaced with this value. + By default this is not defined, so t= hat the reader doesn't doesn't search for illegal characters. + </para></listitem> + <listitem><para><emphasis>Indent</emphas= is> -Add indentation character data to the generated event stream. This si= mply makes + the generated event stream easier to= read in its serialized form. Useful for + testing etc.Default:false. + </para></listitem> + <listitem><para><emphasis>Key Prefix on = Numeric</emphasis> -The prefix character to add if the JSON node name start= s with a number. + By default this is not defined, so t= hat the reader doesn't search for element names that start with a number. + </para></listitem> + <listitem><para><emphasis>Key Whitespace= Replacement</emphasis> -The replacement character for whitespaces in a JSO= N map key. + By default this not defined, so that= the reader doesn't search for whitespaces. + </para></listitem> + <listitem><para><emphasis>Null Value Rep= lacement</emphasis> -The replacement string for JSON NULL values. Default i= s ""(an empty string). </para></listitem> + <listitem><para><emphasis>Root Name</emp= hasis> -The element name of the document root. Default of 'json'. + </para></listitem> + <listitem><para><emphasis>Key Maps</emph= asis> -Defines a JSON element name mapping + The "from" key will be replaced with= the "to" key or the contents of the element. + </para></listitem> = = + </itemizedlist> + </listitem> + <listitem><para><emphasis>Custom</emphasis></par= a> + <itemizedlist> + <listitem><para><emphasis>Target Profile= </emphasis> -</para></listitem> + <listitem><para><emphasis>Class</emphasi= s> -Custom reader class.</para></listitem> + <listitem><para><emphasis>Handlers</emph= asis> -Set a handler on the reader instance e.g. an EntityResolver, ErrorHa= ndler etc. + </para></listitem> + <listitem><para><emphasis>Features</emph= asis> -Reader Features List</para></listitem> + <listitem><para><emphasis>Parametres</em= phasis> -Resource Parameters</para></listitem> + = + </itemizedlist> + </listitem> + </itemizedlist></entry> + <entry><itemizedlist> + <listitem><para><emphasis>CSV</emphasis></para><= itemizedlist> + <listitem><para>not defined</para></listitem> + <listitem><para>','</para></listitem> + <listitem><para>'"'</para></listitem> + <listitem><para>csv-record</para></listitem> + <listitem><para>csv-set</para></listitem> + <listitem><para>true</para></listitem> + <listitem><para>0</para></listitem> + </itemizedlist> + </listitem> + <listitem><para><emphasis>EDI</emphasis></para> + <itemizedlist> + <listitem><para>not defined</para></list= item> + <listitem><para>UTF-8</para></listitem> + <listitem><para>not defined</para></list= item> + <listitem><para>true</para></listitem> + </itemizedlist> + </listitem> + <listitem><para><emphasis>JSON</emphasis></para> + <itemizedlist> + <listitem><para>not defined</para></list= item> + <listitem><para>element</para></listitem> + <listitem><para>UTF-8</para></listitem> + <listitem><para>not defined</para></list= item> + <listitem><para>false</para></listitem> + <listitem><para>not defined</para></list= item> + <listitem><para>not defined</para></list= item> + <listitem><para>""(an empty string)</par= a></listitem> + <listitem><para>'json'</para></listitem> + <listitem><para>not defined</para></list= item> = + </itemizedlist> + </listitem> + <listitem><para><emphasis>Custom</emphasis></par= a> + <itemizedlist> + <listitem><para>no defaults</para></list= item> + = + </itemizedlist> + </listitem> + </itemizedlist></entry> + </row> = + <row> + <entry>Input Data</entry> + <entry>You should select a data file using <emphasis= >Add</emphasis> and <emphasis>Delete</emphasis> buttons</entry> + <entry></entry> + </row> + <row> + <entry>Input Model View</entry> + <entry>Using this view you can see the structure of = your input file.If the file has been changed, to see the changes + click <emphasis>Refresh</emphasis>link.</entry> + <entry></entry> + </row> + </tbody> + </tgroup> + </table> + </section> + <section id=3D"mapping_task"><title>Selected Task Details secti= on for Java Mapping Task. + Selected Task Details section for this task is present= ed by the graf, + that lighten the process of java mapping. +
+ Selected Task Details Section for Mapping Task.</= title> + <mediaobject> + <imageobject> + <imagedata fileref=3D"images/reference/reference= _7.png" scale=3D"90"/> + </imageobject> + </mediaobject> + </figure> + <para> This graphical editor allow you to perform drug/drop = operations with the nodes of transform data to map the source data to targe= t data. + When you save the changes in the graphical editor the correc= t Smooks configuration file content will be generated. </para> + = + </section> + <section><title>Selected Task Details section for Template Task.</ti= tle> + <para>Selected Task Details section for this task is presented b= y the graf, + that is similar to the one in the <link linkend=3D"mapping_t= ask">previous section</link>. + </para> + <figure> + <title>Selected Task Details Section for Template Task.</tit= le> + <mediaobject> + <imageobject> + <imagedata fileref=3D"images/reference/reference_7a.= png" scale=3D"90"/> + </imageobject> + </mediaobject> + </figure> + </section> + </section> + + </section> + <section id=3D"options_tab"> + <title>Options Tab + This section describes Options tab of the Smooks Configu= ration File editor, gives short recommendations how this tab can be used du= ring the project configuring. +
+ Options tab of the Smooks Configuration File edito= r + + + + + +
= +
+ Smooks Configuration section + = + In the Smooks Configuration secti= on of Options Tab + only one element is availible:Smooks Platform Version + +
+ Smooks Configuration section of Options tab</ti= tle> + <mediaobject> + <imageobject> + <imagedata fileref=3D"images/reference/referen= ce_9.png" scale=3D"90"/> + </imageobject> + </mediaobject> + </figure> + <para>This parameter is not rechangable, + and is set according to the vesion of the Smooks libra= ries that are added to the project. + </para> + </section> + = + <section> + <title>Filter Settings Filter section + = + In Filter Settings section you can set + the following global options responsible for Smooks filter= ing configuring: +
+ Filter Settings section of Options tab + + + + + +
+ This behavior can be turned off using this global config= uration parameter and can be overriden on a per fragment basis by targettin= g a Visitor implementation at that fragment that takes ownership of the Res= ult writer (in the case of SAX filtering), or simply modifies the DOM (in t= he case of DOM filtering). As an example of this, see the FreeMarkerTemplat= eProcessor. = + +
+ Options Tab. Filter Settings section. = + + + + + = + + + Option = + Description + Default + + + + + Stream Filter Type + Determines the type of processing model= that will be used. + Please refer to + Filtering Process Selection section + of the official Smooks User Guide for more= information about these models: + + SAX + DOM + + + DOM + = + = + + Default Serialization is On + Defines whether default serialization s= hould be switched on. + Default serialization being turned on lead= s to locating StreamResult/DOMResult + to the Result objects provided to the Smoo= ks.filterSource method and to + serialization all the events to that Resul= t. + true + = + + + +
+
= +
+
+ + Source Tab + This section provides information about Smooks Source Ed= itor Page. +
+ XML Source Editor + You can use this editor to edit the Smooks Configura= tion file directly. +
+ Graphical Editor + + + + + +
+
+
+ Error underlining in Graphical Editor + If the Smooks tools can't = understand the configuration + file or the configuration file is illegal (XML structu= re isn't right for Smooks + Configuration file, etc.), the error is underlined. +
+ Graphical Editor + + + + + +
+ +
+ = +
+ Smooks Configuration File Validator + Smooks configuration file validator will validate yo= ur Smooks configuration file. Just right-click on the file and then click = on the Validate button. The validator can be enabled/d= isabled in Window -> Preferences -> Validation: + = +
+ Validation: Smooks Configuration File Validator= + + + + + +
+ = + You can set up your Smooks validator to include, exc= lude groups to validate and specify rules for validation. Just click on the= Settings button and use the options provided: + = +
+ Smooks Configuration File Validator Settings</t= itle> + <mediaobject> + <imageobject> + <imagedata fileref=3D"images/source_editor/smo= oks_conf_validator_settings.png" scale=3D"90"/> + </imageobject> + </mediaobject> + </figure> + + = + </section> + </section> + </section> +</chapter> + +<chapter diffmk:change=3D"added" xml:base=3D"file:///home/vchukhutsina/rep= os/ochik_jboss/smooks/docs/reference/en/modules/summary.xml"> + <?dbhtml filename=3D"summary.html"?> + <title diffmk:change=3D"added"><diffmk:wrapper diffmk:change=3D"added"= >Summary</diffmk:wrapper> + In conclusion, with this= document you know all the capabilities of Smooks Tools and could easily st= art with them. + The chapters above walked you through the steps on how to create a= nd configure some XML to JAVA mapping project. = + If you have questions or suggestions concerned both the documentat= ion and tools behavior, + you are welcome to JBoss Tools Users forum. + Please, use Jira to report bugs and requests on documentation. + = +
+ <diffmk:wrapper diffmk:change=3D"ad= ded">Other relevant resources on the topic</diffmk:wrapper> + All JBoss Developer Studio/JBoss Tools release documentation you can fi= nd at + http://docs.j= boss.org/tools in the corresponding release directory. + = + The latest documentation builds are available at http://download.jboss.org/= jbosstools/nightly-docs. +For = more information about Smooks technology please visit + + Smooks Technology Home Page + = +
+ + + --===============7995941704466850830==--