Friday, August 15, 2014

Editing the Switchyard Configuration Files

Thanks to Ben Long who handles the Red Hat JBoss Fuse Service Works Documentation, for adding this to the product documentation.  The product documentation can be found at The JBoss Integration and SOA Development plugin from the Integration Stack for JBoss Developer Studio provides a graphical editor for working with the Switchyard Configuration file, switchyard.xml.  The SOA Development Plugin contains tools related to the development of Integration and SOA applications - includes support for BPEL, BPMN2, Drools, ESB, Fuse, Guvnor, jBPM, Savara and Switchyard.  When the plugin is installed and you open the switchyard.xml file, it will be open with the Switchyard Visual Multipage Editor by default.

You will notice the three tabs: Design, Domain, Source.

This is the primary graphical interface for building your SwitchYard application. From here you can interact with and configure each of the application's entities, and add new entities from the Palette. The visual design is automatically converted into XML which you can view from the Source tab.

In this tab you can set additional configuration such as Domain Properties and Security configurations. You can also enable message tracing from here.

From the Source tab you can see the source XML which is generated automatically from the entities configured in the Design tab

Benefits of using the graphical Editor:

1.  The editor automatically manages dependencies for a project. For example, when you add a new binding or implementation to a composite, the editor will add the necessary info to switchyard.xml and the necessary Maven dependencies to the pom.xml. If you forget to update the pom.xml, the project will not build (validate).

2.  The editor automatically manages namespaces based on the features being used and the configuration level of the project.

3.  The editor provides syntax and semantic validation, such as missing transformations and unused references.

Modifying the switchyard.xml file directly from JBoss Developer Studio:

WARNING: Red Hat recommends using the graphical editor to prevent corruption of the switchyard.xml file.  If the editor does not suit your needs then please consider submitting a request for enhancement.

1. Navigate to the src/main/resources/META-INF/switchyard.xml file in the Project Explorer window.

2. Right-click on the file and select Open with, XML Editor

Two Notes on this:

1. The default editor for this file will now be the XML Editor.  To change it back to the graphical editor, right-click on the file and select Open With, Switchyard Visual Multipage Editor.

2.  Close the switchyard.xml file (as presented by the Switchyard Visual Multipage Editor) before opening it with the XML Editor to avoid synchronization issues.  After completing your source edits, close the file and synchronize the model for the visual editor: right-click on the project in the Project Explorer, then select Mave, Update Project.