Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide



Similar documents
JBoss Developer Studio 4.1

Smooks Dev Tools Reference Guide. Version: GA

JBoss Developer Studio 6.0

Red Hat Enterprise Linux OpenStack Platform 7 OpenStack Data Processing

Red Hat JBoss Core Services Apache HTTP Server 2.4 Apache HTTP Server Installation Guide

Red Hat Subscription Management All Subscription Docs Quick Registration for RHEL

JBoss Developer Studio 3.0

JBoss Developer Studio 3.0

Red Hat Directory Server 8.2 Using the Directory Server Console

Talend Open Studio for MDM. Getting Started Guide 6.0.0

Red Hat JBoss Developer Studio 7.0 JBoss SOAP Web Services User Guide

JBoss Enterprise SOA Platform 5 ESB Tools Reference Guide. This guide is for developers Edition 5.3.1

Red Hat Customer Portal 1 Managing User Access to the Red Hat Customer Portal and the Red Hat Network Application

JBoss Developer Studio 3.0

Red Hat JBoss Developer Studio 7.0 User Guide

TIBCO ActiveMatrix Service Bus Getting Started. Software Release 2.3 February 2010

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

Getting Started using the SQuirreL SQL Client

Red Hat Customer Portal Current Customer Portal Subscription Management

Installing Java 5.0 and Eclipse on Mac OS X

Red Hat Enterprise Virtualization 3.0 User Portal Guide. Accessing and Using Virtual Machines from the User Portal Edition 1

Avaya Network Configuration Manager User Guide

T320 E-business technologies: foundations and practice

Novell ZENworks Asset Management 7.5

Composite.Community.Newsletter - User Guide

JBoss Operations Network 3.1 Deploying Applications and Content

Red Hat Cloud Infrastructure 5 Release Notes

Copyright EPiServer AB

Hypercosm. Studio.

Business Insight Report Authoring Getting Started Guide

Eclipse installation, configuration and operation

Business Process Management IBM Business Process Manager V7.5

Oracle SOA Suite 11g Oracle SOA Suite 11g HL7 Inbound Example

JBoss SOAP Web Services User Guide. Version: M5

ServerView Inventory Manager

Building and Using Web Services With JDeveloper 11g

Content Management System User Guide

WatchDox Administrator's Guide. Application Version 3.7.5

Metadata Import Plugin User manual

Attix5 Pro Server Edition

Chapter 15: Forms. User Guide. 1 P a g e

Copyright 2012 Trend Micro Incorporated. All rights reserved.

-lead Grabber Business 2010 User Guide

Kony MobileFabric. Sync Windows Installation Manual - WebSphere. On-Premises. Release 6.5. Document Relevance and Accuracy

Crystal Reports Installation Guide

Data Tool Platform SQL Development Tools

McAfee Endpoint Encryption Reporting Tool

SDK Code Examples Version 2.4.2

Tutorial: BlackBerry Application Development. Sybase Unwired Platform 2.0

Table of Contents. Welcome Login Password Assistance Self Registration Secure Mail Compose Drafts...

TIBCO Hawk SNMP Adapter Installation

Red Hat CloudForms 3.2 NetApp Storage Integration Guide

PLESK 7 NEW FEATURES HOW-TO RESOURCES

Site Administrator Guide

Attix5 Pro Server Edition

Qlik REST Connector Installation and User Guide

Developing Rich Web Applications with Oracle ADF and Oracle WebCenter Portal

Counter-Strike Game Server Management Module

Xcode Project Management Guide. (Legacy)

IBM Configuring Rational Insight and later for Rational Asset Manager

Fedora 19. Fedora Documentation Project

Learn About Analysis, Interactive Reports, and Dashboards

SAS Marketing Automation 5.1. User s Guide

Amazon WorkMail. User Guide Version 1.0

User's Guide. ControlPoint. Change Manager (Advanced Copy) SharePoint Migration. v. 4.0

Red Hat Enterprise Linux 7 High Availability Add-On Administration. Configuring and Managing the High Availability Add-On

Parallels Panel. Parallels Small Business Panel 10.2: User's Guide. Revision 1.0

ICP Data Entry Module Training document. HHC Data Entry Module Training Document

DocuPrint C3290 FS Features Setup Guide

Auditing manual. Archive Manager. Publication Date: November, 2015

Bitrix Site Manager 4.1. User Guide

Data Crow Creating Reports

Before you can use the Duke Ambient environment to start working on your projects or

Oracle Fusion Middleware

Context-sensitive Help Guide

Download and Installation Instructions. Android SDK and Android Development Tools (ADT)

What's New In DITA CMS 4.0

Application. 1.1 About This Tutorial Tutorial Requirements Provided Files

Spambrella SaaS Encryption Enablement for Customers, Domains and Users Quick Start Guide

Kaspersky Security Center Web-Console

Microsoft Access 2010 handout

Work with the MiniBase App

Designing and Implementing Forms 34

Cloud Server powered by Mac OS X. Getting Started Guide. Cloud Server. powered by Mac OS X. AKJZNAzsqknsxxkjnsjx Getting Started Guide Page 1

ORACLE BUSINESS INTELLIGENCE WORKSHOP

Creating Reports with Microsoft Dynamics AX SQL Reporting Services

Archiving - Outlook 2003

tools that make every developer a quality expert

CONTACTS SYNCHRONIZER FOR IPAD USER GUIDE

Legal Notes. Regarding Trademarks KYOCERA Document Solutions Inc.

JBoss AS Administration Console User Guide. by Shelly McGowan and Ian Springer

Installing the Android SDK

Embarcadero Rapid SQL Developer 2.0 User Guide

Liferay Portal User Guide. Joseph Shum Alexander Chow

DEPLOYMENT GUIDE Version 2.1. Deploying F5 with Microsoft SharePoint 2010

PTC Integrity Eclipse and IBM Rational Development Platform Guide

INFOPATH FORMS FOR OUTLOOK, SHAREPOINT, OR THE WEB

Community Edition. Master Data Management 3.X. Administrator Guide

All other trademarks are property of their respective owners.

Transcription:

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Provides information relating to the Smooks Tools module. Edition 4.1.0 Xue(Dart) Peng

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Provides information relating to the Smooks Tools module. Edition 4.1.0 Xue(Dart) Peng

Legal Notice Copyright 2011 Red Hat. T his document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux is the registered trademark of Linus Torvalds in the United States and other countries. Java is a registered trademark of Oracle and/or its affiliates. XFS is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL is a registered trademark of MySQL AB in the United States, the European Union and other countries. Node.js is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project. T he OpenStack Word Mark and OpenStack Logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community. All other trademarks are the property of their respective owners. Abstract The Smooks Developer Tools Reference Guide explains how to use Smooks Tools to graphically edit Smooks configuration files.

Table of Contents Table of Contents. Preface........................................................................................... 3........... Chapter......... 1... Introduction................................................................................ 4.......... 1.1. Key Features of Smooks Tools 4 1.2. What is Smooks? 4 1.3. What is Smooks Tools? 5 1.4. Adding Smooks jars 5. Chapter......... 2... Tasks................................................................................ 6.......... 2.1. New Smooks Configuration File Creation 6 2.2. Input T ask Configuring 7 2.3. Mapping processes 9 2.3.1. Direct source to target mapping 9 2.3.2. Java Mapping T ask 10 2.3.3. Apply Template Task 12 2.4. Smooks Configuration testing using Smooks Run Configuration 14. Chapter......... 3... Reference............................................................................... 16........... 3.1. Process tab 16 3.1.1. Processing T ask section 16 3.1.2. Selected T ask Details Section 17 3.1.2.1. Selected T ask Details Section for Input T ask. 17 3.1.2.2. Selected T ask Details section for Java Mapping T ask. 22 3.1.2.3. Selected Task Details section for Template Task. 24 3.2. Options Tab 25 3.2.1. Smooks Configuration section 25 3.2.2. Filter Settings Filter section 26 3.3. Source Tab 27 3.3.1. XML Source Editor 27 3.3.2. Error underlining in Graphical Editor 27 3.3.3. Smooks Configuration File Validator 28 3.4. Properties View 30 3.4.1. Decode Configuration 31 3.4.2. Apply T emplate Wizard 32. Chapter......... 4.. Summary............................................................................... 38........... 4.1. Other relevant resources on the topic 38. Getting........ Help..... and..... Giving....... Feedback................................................................. 39........... A.1. Do You Need Help? 39 A.2. Give us Feedback 39. Revision......... History................................................................................ 4.. 0.......... 1

2 Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide

Preface Preface T his manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information. T o get more information on these conventions please refer to the Docum ent Conventions manual, which can be found on the Red Hat Documentation website under the JBoss Developer Studio section. 3

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Chapter 1. Introduction T his chapter gives you a short introduction to Smooks, Smooks tools and its installation. First, have a look at the key features of Smooks tools: 1.1. Key Features of Smooks Tools The table below provides you with a list of the key features integrated in Smooks tools. Table 1.1. Key Functionality for Smooks Tools Feature Benefit Chapter Smooks Configuration File Wizard Smooks Editor Smooks tools allows you to create and edit the Smooks configuration file for Java2Java data transformation. Smooks Editor helps configure the created Smooks configuration file. Section 2.1, New Smooks Configuration File Creation Section 3.1, Process tab 1.2. What is Smooks? Smooks is a Java Framework/Engine for processing XML and non XML data (CSV, EDI, Java, JSON etc). It provides: I. T ransformation: Perform a wide range of Data T ransforms. Supports many different Source and Result types -XML/CSV/EDI/Java/JSON to XML/CSV/EDI/Java/JSON. II. Java Binding: Bind into a Java Object Model from any data source (CSV, EDI, XML, Java, JSON etc). III. Huge Message Processing: Process huge messages (GBs) - Split, T ransform and Route message fragments to JMS, File, Database etc destinations. Route multiple message formats to multiple destinations in a single pass over a message. IV. Message Enrichment: Enrich a message with data from a Database, or other Datasources. V. Combine: Combine the above features in different ways e.g. add Message Enrichment as part of a Splitting and Routing process. Figure 1.1. Smooks For more informations about Smooks, please visit the Smooks official site. 4

Chapter 1. Introduction 1.3. What is Smooks Tools? Smooks tools is a set of graphical tools, based on Eclipse, for editing Smooks configuration files. Figure 1.2. Smooks Form editor 1.4. Adding Smooks jars During your development, you probably will be required to include additional Smooks jars to your project. This can be achieved with the following steps: If it doesn't yet exist, create the folder named "lib" inside your project. Copy all the Smooks jars you need to include into the lib directory. Right-click (or Control-click on Mac OS) on the project and select Properties. Select the Java Build Path item in the Properties list, then the Libraries tab, and click the Add JARs button. In the Jar Selection dialog, select all the jars in the "lib" directory you want to include and click the OK button. Now you should see all the jars included to your project hierarchy. 5

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Chapter 2. Tasks This chapter describes the main tasks that can be performed with Smooks tools. In this chapter we use the example that can be downloaded from here. 2.1. New Smooks Configuration File Creation Select the project where you want to create the new Smooks Configuration File and right-click on it. Select New Other Smooks Smooks Configuration File. Then click the Next button. Figure 2.1. Selecting Smooks Configuration File Wizard Select the src folder to be the files container, and type the name smooks-config.xml. Click the Next button. 6

Chapter 2. Tasks Figure 2.2. Choosing the configuration file container and the file name 2.2. Input Task Configuring Configuring an Input task is mandatory step when creating a smooks project. You can configure it on the Process page of the editor: look for the "Input Task" in the Process Map at the top of the page. 7

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Figure 2.3. Input T ask Configuring Select it and you will see all the properties to set for the Input reader of your Smooks configuration. "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 such as the encoding, quote character, separator character, and the list of incoming fields. T he EDI reader requires the encoding and the path to the Mapping Model describing the incoming data. In the Input data section, you can specify some sample data that conforms to your reader configuration. Once you've specified your reader configuration and sample data, you can see the input model rendered in a tree form in the Input model section. In the picture below you can see the correct configuration of an XML input task where input-message.xml is set as an input data file. 8

Chapter 2. Tasks Figure 2.4. Input Task Configuring 2.3. Mapping processes In previous versions of the Smooks tooling you were required to manually create a java mapping task before applying a transformation template to the data. A new method is now available called Direct source to target mapping. This allows you to skip the manual creation of Java mapping and apply a template directly to your data. 2.3.1. Direct source to target mapping A new simplified mapping process is supported within the Smooks Editor called Direct source to target mapping. This allows for you to skip the intermediate Java mapping step when applying a template to your data. An example of the new editor performing a transformation (EDI to XML): Figure 2.5. Java Mapping configuration 9

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide 2.3.2. Java Mapping Task If you decide to do Java Mapping, you need to make sure that your 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, connected to Input Task. T hen select Java Mapping task. Figure 2.6. Java Mapping configuration Another method of adding a Java Mapping element to the canvas in the Processing Tasks section is to right click on the Input Task element and select Java Mapping in the popup menu. Figure 2.7. Java Mapping configuration Right-click on the canvas in an empty space and select Add Java Class. 10

Chapter 2. Tasks Figure 2.8. Java Mapping configuration This will display the Java Bean Creation wizard. Specify a unique identifier for the new class and the class path. If the Java class is specified, you'll see a list of the properties in the box below. Click the Finish button when you're done. Now, with the input and output models on the canvas, you can click and drag from the various input elements to corresponding output elements. Make sure to connect collection elements to corresponding collection elements. Finally your mapping should look something like the one on the picture below. 11

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Figure 2.9. Final Mapping schema The movie "XML to Java" has more information on this process. If you are interested in transforming EDI to Java you can find more information here. 2.3.3. Apply Template Task The "Apply Template" task works very similarly to the section Section 2.3.2, Java Mapping Task, where you define a mapping between an input model and an output model. Select the Java Mapping task you want to use as the input model in the Process Map pane and click the plus (+) sign to the right of the icon. Figure 2.10. Apply T emplate configuration 12

Chapter 2. Tasks This will display the Message Type Selection wizard. In our example we will transfer our data to csv output format, so you should select CSV and click the Next button. Figure 2.11. Message T ype Selection On the next wizard page put the following string into the Fields, select Output Fields Names and click the Finish button. Figure 2.12. CSV output message configuration After these steps the "Apply Template" task will appear to the right, connected to the task you created it from. T o continue the configuration processyou should click on it and find the CSV Template item with entered fields on the canvas. Now you can click and drag from various input elements to corresponding output elements in the template. Make sure to connect collection elements to the corresponding csvrecord. In our example output only the elements of orderitems collection to the CSV format (see the picture below): 13

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Figure 2.13. Relations between input and output models 2.4. Smooks Configuration testing using Smooks Run Configuration This option is used to view the results of Smooks transforming procedure. To do the testing you should select your Smooks Configuration file you want to transfer in the Project Navigator or open it in the Smooks Configuration Editor and then select "Run As..." from the Run toolbar button or select the Run- >Smooks Run Configuration option in the top menu bar. The Smooks Configuration file will then be run automatically. Figure 2.14. Smooks Configuration testing 14

Chapter 2. Tasks Any errors or warnings will appear in a pop up dialog. The output of the test will appear in the Console view. In our case the following streaming output will appear: [Stream Templating Result...] -- "productid","quantity","price" "111","2","8.9" "222","7","5.2" -- [Java Mapping Results...] -- > order (beanid = "order") > header (beanid = "header") > date = "2006-11-15 20:45:28.0 EET" > customernumber = 123123L > customername = "Joe" > orderitems (beanid = "orderitems") > example.model.orderitem (beanid = "orderitem") > productid = 111L > quantity = 2I > price = 8.9D > example.model.orderitem (beanid = "orderitem") > productid = 222L > quantity = 7I > price = 5.2D -- If the test runs but doesn't generate any streaming output the Console output will be the following: Nothing to Display: - No Java Mappings. - No Templates Applied. 15

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Chapter 3. Reference T his chapter includes detailed reference information on all tabs in the Smooks Configuration Editor. 3.1. Process tab T he Process tab of the Smooks Configuration Editor provides a way to configure different types of transformations. By default the smooks configuration file is opened in this editor. If you have set another editor to open the file by default, you should right click on the smooks configuration file and select Open With Smooks Configuration Editor. The Process tab has two sections: Section 3.1.1, Processing T ask section Section 3.1.2, Selected T ask Details Section You can see them on the picture below. Figure 3.1. Two Sections of the Process tab. 3.1.1. Processing Task section Using the popup menu in the Processing Task section you can select which types of technologies (templating or mapping ones) you will use for transformation: The descriptions of the popup menu options are in the following table. 16

Chapter 3. Reference Table 3.1. Process Tab. Processing Task section. Option Description Default Add T ask Select one of the following tasks according to the required Source and Result file types: Input - this task is required and appears automatically when Smooks config file is created. You should just configure it properly. Java Mapping Apply Template Delete Input Methods Click this option if you want to delete some task from the section. Note:you can't delete input task because it's required. Choose one of the following methods: System Simple IBus (Inteligent Input Bus) Amharic(EZ +) Cedilla Cyrillic Inuktitut IPA Multipress SCIM Bridge Input Method SCIM Input Method Thai-Lio T igrigna-eritrean(ez +) T igrigna-ethiopian(ez +) Vietnamese X input Method None System 3.1.2. Selected Task Details Section The options available in this section depends on the selected task in the 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. 3.1.2.1. Selected T ask Details Section for Input T ask. On the picture below you can find an example of the Selected Task Details Section view if XML is selected as input type. 17

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Figure 3.2. Selected Task Details Section for Input XML Task. As you can see on the picture above the Input Configuration section is empty for XML input file. However, this section has special configuration options for CSV,EDI,JSON,Custom input files. Here are the screens of these configuration options: CSV: Figure 3.3. Selected Task Details Section for Input CSV Task. EDI: 18

Chapter 3. Reference Figure 3.4. Selected Task Details Section for Input EDI Task. JSON: Figure 3.5. Selected Task Details Section for Input JSON Task. Custom: 19

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Figure 3.6. Selected T ask Details Section for Input Custom T ask. All the input task configuration positions can be found in the table below: 20

Chapter 3. Reference Table 3.2. Selected Task Details Section. Options for Input Task. Option Description Default Input type Select your type of input file. If you don't find your type in the list, you should use Custom type: No Input XML Java XSD/WSDL CSV EDI JSON Custom XML Input configuration No Input - no info required XML - no info required Java - no info required XSD/WSDL - no info required CSV Fields - Comma separated list of CSV record field names Separator Character - Field separator character. Quote Character - Quote character. Record Name - Name of csv record element. Root Name - Name of csv root element. indent - Add indentation character data to the generated event stream. T his simply makes the generated event stream easier to read in its serialized form. Useful for testing etc. Skip Lines - Number of lines to skip before processing starts. EDI Target Profile - Defines the output transformation profile Encoding - T he character encoding. Mapping Model - Defines the EDI Mapping Model configuration for processing the EDI message stream to a stream of SAX events that can be processed by Smooks. Validate - T his attribute turns on/off datatype validation in the EDI Parser. Validation is on by default. It makes sense to turn datatype validation off on the EDI Reader if the EDI data is being bound into a Java Object model. JSON Target Profile - Defines the output transformation profile Array Element Name - The element name of an array element. Encoding - encoding: T he default encoding of any JSON message InputStream processed by this CSV not defined ',' '"' csv-record csv-set true 0 EDI not defined UTF-8 not defined true JSON not defined element UTF-8 not defined false not defined not defined ""(an empty string) 'json' not defined Custom no defaults 21

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Reader. Illegal Element Name Char Replacement - If illegal characters are encountered in a JSON element name then they are replaced with this value. By default this is not defined, so that the reader doesn't doesn't search for illegal characters. Indent - Add indentation character data to the generated event stream. T his simply makes the generated event stream easier to read in its serialized form. Useful for testing etc. Key Prefix on Numeric - The prefix character to add if the JSON node name starts with a number. By default this is not defined, so that the reader doesn't search for element names that start with a number. Key Whitespace Replacement - T he replacement character for whitespaces in a JSON map key. By default this not defined, so that the reader doesn't search for whitespaces. Null Value Replacement - T he replacement string for JSON NULL values. Root Name - The element name of the document root. Key Maps - Defines a JSON element name mapping The "from" key will be replaced with the "to" key or the contents of the element. Custom Target Profile - Defines the output transformation profile Class - Custom reader class. Handlers - Set a handler on the reader instance e.g. an EntityResolver, ErrorHandler etc. Features - Reader Features List Parameters - Resource Parameters Input Data Input Model View You should select a data file using the Add and Delete buttons Using this view you can see the structure of your input file.if the file has been changed, to see the changes click the Refreshlink. 3.1.2.2. Selected T ask Details section for Java Mapping T ask. Selected Task Details section for this task is presented by the graph, which eases the process of java mapping. 22

Chapter 3. Reference Figure 3.7. Selected T ask Details Section for Mapping T ask. T his graphical editor allows you to perform drag&drop operations with the nodes of transformed data to map the source data to target data. When you save the changes in the graphical editor the correct Smooks configuration file content will be generated. Using the popup menu in the Selected Task Details section you can manage the diagram elements on the canvas. The descriptions of the popup menu options are in the following table. 23

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide T able 3.3. Popup menu. Selected T ask Details section. Option Description Default Add Select one of the following tasks: Java Class - adds a bean context item to the config file. T his option is available when no elements are selected and a user right clicks on the canvas. Expression Binding - adds expression based binding to selected java binding element. Value Binding - adds Value binding (<jb:value>) to the selected java binding element. Bean Binding - adds Wiring binding (<jb:wiring>) to the selected java binding element. Undo Redo Delete Auto Layout Properties Input Methods This option allows you to revert any changes made in the previous step. This option allows you to redo the changes made at the previous step. This option is available only if you select an element on the canvas. Click this option if you want to delete the element from it. Sets the default layout of the elements on the canvas. Click this option if you want to add the Properties view to the current perspective. T he Properties view will automatically display the properties of the selected diagram element. Choose one of the following methods: System Simple Amharic(EZ +) Cedilla Cyrillic Inuktitut IPA Multipress SCIM Bridge Input Method SCIM Input Method Thai-Lio T igrigna-eritrean(ez +) T igrigna-ethiopian(ez +) Vietnamese X input Method System 3.1.2.3. Selected Task Details section for Template Task. Selected Task Details section for this task is presented by the graph, which is similar to what is described in the section Section 3.1.2.2, Selected T ask Details section for Java Mapping T ask.. 24

Chapter 3. Reference Figure 3.8. Selected Task Details Section for Template Task. Popup menu similar to T able 3.3, Popup menu. Selected T ask Details section.. 3.2. Options Tab T his section describes Options tab of the Smooks Configuration File editor, and gives short recommendations how this tab can be used during the project configuring. Figure 3.9. Options tab of the Smooks Configuration File editor 3.2.1. Smooks Configuration section 25

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide T he Smooks Configuration section in the Options T ab displays only the Smooks Platform Version value. Figure 3.10. Smooks Configuration section of Options tab This value can not be modified, and is set according to the version of the Smooks libraries that are added to the project. 3.2.2. Filter Settings Filter section In Filter Settings section you can set the following global options responsible for the Smooks filtering configuration: Figure 3.11. Filter Settings section of Options tab This behavior can be turned off using this global configuration parameter and can be overridden on a per fragment basis by targeting a Visitor implementation at that fragment that takes ownership of the Result writer (in the case of SAX filtering), or simply modifies the DOM (in the case of DOM filtering). As an example of this, see the FreeMarkerT emplateprocessor. 26

Chapter 3. Reference Table 3.4. Options Tab. Filter Settings section. Option Description Default Stream Filter T ype Determines the type of processing model that will be used. Please refer to the Filtering Process Selection section of the official Smooks User Guide for more information about these models: SAX DOM SAX Default Serialization is On Defines whether the default serialization should be switched on. Default serialization being enabled leads to locating StreamResult/DOMResult to the Result objects provided to the Smooks.filterSource method and to serialization all the events to that Result. false 3.3. Source Tab T his section provides information about the Smooks Source Editor Page. 3.3.1. XML Source Editor You can use this editor to edit the Smooks Configuration file directly. Figure 3.12. Graphical Editor 3.3.2. Error underlining in Graphical Editor If the Smooks tools can't understand the configuration file or the configuration file is illegal (e.g. XML structure isn't valid for a Smooks Configuration file), the error is underlined. 27

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Figure 3.13. Graphical Editor 3.3.3. Smooks Configuration File Validator T he Smooks configuration file validator will validate your Smooks configuration file. Just right-click on the file and then click on the Validate button. T he validator can be enabled/disabled by selecting Window Preferences Validation, as you can see in the image below: 28

Chapter 3. Reference Figure 3.14. Validation: Smooks Configuration File Validator You can set up your Smooks validator to include and exclude groups to validate, and specify rules for validation. Just click on the Settings button and use the options provided, which you can see in the image below: 29

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Figure 3.15. Smooks Configuration File Validator Settings 3.4. Properties View Properties View is available for some elements on the canvas of Java Mapping and Apply Template T asks, like: Java mapping:java class members,its fields, links between input values and the class members; Apply Template:output template. To add Properties View to the opened perspective the user can either open Window Show View Preferences in the toolbar or right click the element which properties he wants to inspect and select Properties in the popup menu. On the picture below you can see how this view looks like when some csv template is selected. Figure 3.16. Properties View This view is fully synchronized with the canvas of the Smooks Configuration Editor. This means that 30

Chapter 3. Reference when you change the selected element by clicking on it, the properties of a new element are immediately displayed in it. Using Properties View you can then edit all the properties of the selected item. Figure 3.17. Synchronization between Properties View and the canvas 3.4.1. Decode Configuration Smooks tools support decode parameter configuration through the Decode tab in Properties View activated by clicking the connection between input model and bean items. On the picture below you can see an example of decode configurations for mapping an Input Model Item to a Date format: Figure 3.18. Decode Configuration tab in Properties View T he descriptions of the Decode Configuration tab options are listed in the following table: 31

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide T able 3.5. Decode Configuration tab in Properties View Option Description Decoder Select from the dropdown list the type of decoder you need. Decoder Parameters For most of decoders the Decoder Parameters table is empty. But some of the decoders require additional configuration (like Date decoder on the picture above), so you should configure them by editing the corresponding line in the Value row. For example, for the Date Decoder: format - Date format string. locale country - ISO Country Code. Upper case two-letter code defined by ISO-3166. locale language - ISO Language Code. Lower case twoletter code defined by ISO-639. T he Decoder Parameters section for EnumDecoder quite differs from other types of decoders. See the picture below: Figure 3.19. EnumDecoder in Properties View T he Decoder Parameters section for EnumDecoder in Properties View consists of 2 rows: From Data Value - The lines in this row are editable. You can change them according to the names of enum types you used in input file. To Enum Value - The lines in this row are not editable. Here a set of all constants declared in mapped Enum type is listed. T he user is responsible for correspondence between the values in these two rows. For more information about different decoder parameters read the Smooks T echnology Documentation. 3.4.2. Apply Template Wizard The Apply Template Wizard helps you to add a new Apply Template Task to the Smooks configuration file. You can call it from the popup menu when the Java Mapping item in the Processing Task section is selected by following Add T ask Apply T emplate (see Figure 2.10, Apply T emplate configuration 32

Chapter 3. Reference picture). T he wizard consists of several pages: 1. The first one includes only one option to adjust.the user should select in which of the two formats(xml or CSV) he prefers to create an output message: Figure 3.20. The first page of Apply Template Wizard 2. The second page is specific for each of the output message formats: If the CSV output message type was selected in the previous step the second wizard page will be the following : Figure 3.21. CSV:The second page of Apply Template Wizard The wizard page includes the next options to adjust: 33

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Table 3.6. Apply Template Wizard. Second Page Options if CSV output format is selected. Option Description Default Fields Comma separated list of CSV record field names. Empty Separator Character Field separator character in the output message., Quote Character Quote character in the output message. " Output Field name Click the checkbox if you want the output CSV message to also include field names. The following second wizard page will appear if the XML output message type was selected in the previous step: Figure 3.22. Apply T emplate Wizard. Second Page Options if XML output format is selected. Here you should first select the XSD or Sample XML output template format and then click the Browse File System or the Browse Workspace button depending on what browse type you want to use. For example, if you click Browse Workspace the following view will appear: 34

Chapter 3. Reference Figure 3.23. Browse Workspace In the workspace you should select the template you want to use and click the OK button. If you selected XSD format after adjusting the template path you should click the Load button: Figure 3.24. Load Button 35

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide After that it is necessary to select the root node for the template in the Select Root Element. T hen click the Finish button. Figure 3.25. Load Button If you have chosen Sample XML option after selecting the template XML file destination you should only click the Finish button: Figure 3.26. Load Button 36

Chapter 3. Reference 37

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Chapter 4. Summary T he document summarizes the capabilities of Smooks T ools, and provides some instructions on how to use them. The chapters above also walked you through the steps on creating and configuring a XML to JAVA mapping project. If you have questions or suggestions concerned both the documentation and tools behavior, you are welcome to JBoss Tools Users forum. Please, use Jira to report bugs and requests on documentation. 4.1. Other relevant resources on the topic All JBoss Developer Studio/JBoss T ools release documentation can be found at http://docs.jboss.org/tools in the corresponding release directory. T he latest documentation builds are available at http://download.jboss.org/jbosstools/nightly-docs. For more information about Smooks technology please visit the Smooks T echnology Home Page You can find a collection of screencasts covering the Smooks tools technology here. 38

Getting Help and Giving Feedback Getting Help and Giving Feedback A.1. Do You Need Help? If you experience difficulty with a procedure described in this documentation, visit the Red Hat Customer Portal at http://access.redhat.com. T hrough the customer portal, you can: search or browse through a knowledgebase of technical support articles about Red Hat products. submit a support case to Red Hat Global Support Services (GSS). access other product documentation. Red Hat also hosts a large number of electronic mailing lists for discussion of Red Hat software and technology. You can find a list of publicly available mailing lists at https://www.redhat.com/mailman/listinfo. Click on the name of any mailing list to subscribe to that list or to access the list archives. A.2. Give us Feedback If you find a typographical error, or know how this guide can be improved, we would love to hear from you. Submit a report in Bugzilla against the product JBoss Developer Studio and the component Sm ooks Developer T ools Reference Guide. T he following link will take you to a pre-filled bug report for this product: http://bugzilla.redhat.com/. Fill out the following template in Bugzilla's Description field. Be as specific as possible when describing the issue; this will help ensure that we can fix it quickly. Document URL: Section Number and Name: Describe the issue: Suggestions for improvement: Additional information: Be sure to give us your name so that you can receive full credit for reporting the issue. 39

Red Hat JBoss Developer Studio 4.1 Smooks Developer Tools Reference Guide Revision History Revision 4.1.0-2.1.4 06 T ue Jan 7 2014 Rüdiger Landmann Rebuild with Publican 4.0.0 Revision 4.1.0-2.1 2013-06-10 Misty Stanley-Jones Rebuild for updated legal template Revision 4.1.0-2 2012-07-18 Anthony T owns Rebuild for Publican 3.0 Revision 1-0 Wed Jun 09 2010 JBoss T ools Documentation Team Restructured and general updates Revision 0-0 Fri Nov 20 2009 Isaac Rooskov Initial creation of book by publican 4 0