Visual cues to indicate errors in WSO2 Integration Studio
By: Prabushi Samarakoon
Tags: Wso2 Ei, Developer Studio, Esb, Integration, Wso2

WSO2 Integration Studio comes with the source view, which displays the xml representation of the Synapse mediation flow depicted in the design view. The source view is embedded with an XML editor, allowing users to manually edit the Synapse configuration. However, there was no additional support provided in terms of content assist nor validation, for the users who wished to work in this XML editor. Therefore, it was required to enhance the capabilities, and provide the end user with an efficient and intuitive way to develop their Synapse configuration, via the source view.

Prior versions of WSO2 Developer Studio did not allow switching between source and design views if there are any errors in the Synapse configuration, as it had no way to provide an informative description of that error, or to persist the error within an artifact. We have introduced a new validation layer in the forthcoming WSO2 Integration Studio release in order to overcome these usability gaps, and to cater these validation requirements.

Two main scenarios identified with the source view are as follows.

XML validation

If the content on source view fails basic xml validation, user will not be able to save the content, or switch to the design view. However, a descriptive detail of the error will be notified to the user so that the user can correct it and continue with the development.

2. Synapse validation

If the xml content on the source view fails to adhere to the Synapse schema, user will be allowed to save the erroneous content and continue with the development while the error will be notified in detail.

Any erroneous artifact which can be caused by the aforementioned scenarios will not be listed under the Composite Application project to be included in the composite archive.

Implementation

Diagram 1 : Previous implementation of conversion from source to design

The above diagram depicts how WSO2 Integration Studio utilizes the means of WSO2 Synapse [1] to construct the mediation flow. Whenever it is being switched to the design view, WSO2 Integration Studio converts the string content on the source view to an xml representation in correspondence with the Synapse definition, using Apache OMElements [2]. WSO2 Synapse, descendant of Apache Synapse [3], has been constructed using predefined mediators such as Log mediator, Enrich mediator, etc., and artifacts such as Proxy service, API, etc. OMElement representation of each mediator is processed using the respective mediator Factory implementation in WSO2 Synapse layer to retrieve it’s correspondent Synapse object.

As per previous underline architecture of Developer Studio, content on the source view was sent to the WSO2 Synapse side at once, making it impossible to identify as to which part of the configuration has caused an error. In order to overcome this limitation, a new layer capable of addressing validation per one block of mediation was incorporated into the new Tooling architecture.

Diagram 2 : New implementation of conversion from source to design

The introduced validation handler comes in between the WSO2 Synapse layer and the controller of Integration Studio, which has been developed upholding to the MVC architecture. Upon the switch or save event on the source view, controller verifies the xml content against the xml validation feature with Apache SAXParser [4]. If there are no xml invalidations, it calls the respective mediator Factory implementation, and it can retrieve the details of the first error it encountered. Any asserted error is indicated using an IMarker [5], which is the general mechanism in Eclipse to bind notes or meta-data with resources. Upon an error, an IMarker will be generated associating with the respective IFile of the Synapse artifact. The generated customized marker underlines the complementary portion within the Synapse configuration highlighting the erroneous mediator, while an adequate description of the error will be shown in the Eclipse ‘Markers’ view. User will also be able to see the informative description on the mouse hover event over the error marker.

Diagram 3 : IMarker Implementation

In addition to the error indication on the source view, new mediator factory approach was introduced to allow the user with the capability of saving an incomplete Synapse configuration even though it does not adhere to the Synapse schema. These factory classes were implemented in a manner which the Synapse objects representations will be generated irrespective of the inconsistencies within the Synapse configuration. Eclipse Decorators, which are used to annotate resources with useful information, were used along with the IMarkers to display these erroneous states of the saved artifacts. According to the new implementation, IDecorator implementation acts as a listener and continuously verifies the validity of resources within the workspace. An error will be marked with an overlay image on the resource in the Eclipse ‘Project Explorer’ view. Furthermore, WSO2 Integration Studio facilitates auto recovery, where the artifact will be assigned with default values, ignoring the faulty input values for the possible cases in which the mentioned decorators will not be added to convey the erroneous state.

Diagram 4 : Decorator implementation

Upcoming WOS2 Integration Studio 6.5.0 release will be presented with the aforementioned visual cues to perceive and persist the erroneous states, with the intention of providing the end user with a more user friendly experience while developing the Synapse integration flow.

Checkout WSO2 Integration Studio 6.5.0 to explore more features.

** Now, you can try out the latest Integration Studio from our website. **

References