Create new JBoss Tools Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

Smooks Dev Tools Reference Guide

Version: 1.1.0.M1

November 2008


1. Introduction
1.1. What is Smooks?
1.2. What is Smooks Tools?
1.3. How to install Smooks dev tools?
2. Quick Start
2.1. Download Smooks Java-to-Java Example
2.2. Smooks Configuration File Wizard
2.3. Smooks Editor
2.4. Choosing the transform data
2.5. Mapping
3. Smooks Configuration Editor Page
3.1. Smooks Parse Type
3.2. Import File
3.3. Date Decoder Detail Page
4. Smooks Source Editor Page
4.1. XML Source Editor
4.2. Error Messages GUI

This chapter give you a short introduction to Smooks, Smooks tools and its installation

The Smooks tools was included by the JBoss Tools since 3.0.0 Beta1 version. You can download the JBoss Tools from JBoss 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 contains many plug-ins ( GEF, EMF, etc. ) required by Smooks dev tools.

Now let's progress to more advanced topics.

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.

Visit here 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 project and paste them into the eclipse Java project.

How to map the java class just added?

First, you should know what to transform:

Make sense? You should right click Resource List , select Add Smooks Resource>Java Binding>Bindings

First of all, you should bind Order to LineOrder. To do this one Bindings Item should be added to the Resource List.


Click on it and you should see Bindings Section to the right of Message Filtering Resources.Write lineOrder 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:


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


Note:

Please, remember that the root nodes of the source data and target 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.

Now, you should save the file and the Smooks tools generate the correct configuration file content.

OK, let run the test class: example.Main. (Please, make sure that the Smooks engine loads the correct configuration file).

Success!

In this section you will explore the details of Smooks Configuration Editor usage

Smooks Configuration Editor is one tab of the Smooks Editor.


You can add/edit/remove the Date Decoder on the Configuration page of the Smooks Editor.

The configuration editor also edits the Smooks parse type and manages the Import Files.

This section provides information about Smooks Source Editor Page