10 replies Latest Post - ‏2014-02-27T22:26:36Z by bernard H
bernard H
bernard H
5 Posts

Pinned topic TX Rule Formatter - enhancing map rule readability

‏2013-05-12T21:23:57Z |

Some TX map rules way readily become complex. A typical example is that of an extraction of a piece of an input data item that is in turn passed through validation tests in order to invoke variant functional maps, themselves often featuring a bunch of arguments. We get a sequence of commas and brackets () that isquite difficult to track visually in order to know which argument goes with which function, especially if the data item references become also quite long as it happens with XML documents.

I was quite disappointed not to find in the Transformation Extender perspective a utility like the auto-indent or formatting facility (ctrl-shft-F) in Eclipse that format nicely your java code or C code or XML document, etc... 

That has driven me to develop piece of java code to format a map rule. Then, I wrapped the formatter into an Eclipse plug in. At this stage, this is still a fairly brute plugin (it does not disappear when moving out from the Transformation Extender perspective, of better from a map editor tab), but it is already quite useful, and at a stage that calls for feedback in order to evolve.

Here are the details:


This Eclipse plug-in works both in Websphere Message Broker Toolkit and TX StudioThe plugin displays an an extra icon iconin the Eclipse menu bar. The plug-in uses indentation and argument counts to enhance the readability of map rules.

Tested with WTX and Message Broker Toolkit


Within theTransformation Extender perspective, edit a map and select a mapping rule in an output card, then click on the icon to format the rule. The format is best viewed by choosing a fixed spacing font for the rule editor (as set via Window > Preferences > Transformation Extender > Map > fonts > Rule Bar View ).


Simply copy the attached jar in the Eclipse plugin directory at stake.

  • In the broker Toolkit, the directory is like: \Program Files\IBM\Websphere Broker\plugins
  • in TX Studio, the directory is like: \Program Files\IBM\Websphere TX\DesignStudio\wtx_eclipse\eclipse\plugins


Your feedback is solicited.

Was I stupid and missing some readily available facility in TX that can format map rules?

Updated on 2013-05-12T21:27:33Z at 2013-05-12T21:27:33Z by bernard H
  • thorstenhirsch
    84 Posts

    Re: TX Rule Formatter - enhancing map rule readability

    ‏2013-05-15T16:35:15Z  in response to bernard H

    Hi Bernard, I installed your plugin, the icon appears, but it doesn't work. An unhandled event loop exception in the error log of eclipse appears every time I click the icon:

    java.fullversion=JRE 1.6.0 IBM J9 2.4 Windows XP x86-32 jvmwi3260sr9-20110624_85526 (JIT enabled, AOT enabled)
    J9VM - 20110624_085526
    JIT  - r9_20101028_17488ifx17
    GC   - 20101027_AA
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
    Framework arguments:  -user=C:\Program Files\wtx84
    Command-line arguments:  -os win32 -ws win32 -arch x86 -clean -user=C:\Program Files\wtx84

    Wed May 15 18:34:22 CEST 2013
    Unhandled event loop exception

    java.lang.LinkageError: Übertretung der Ladeeinschränkung: Ladeprogramm "org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@46a246a2" hat zuvor das Laden für einen anderen Typ mit dem Namen "com/ibm/websphere/dtx/ui/me/editors/editparts/BaseEditPart", der durch Ladeprogramm "org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@7b5f7b5f" definiert ist, eingeleitet.
        at java.lang.ClassLoader.defineClassImpl(Native Method)
        at java.lang.ClassLoader.defineClass(
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        at com.reverseXSL.TXextend.handlers.RuleFormatter.execute(
        at org.eclipse.ui.internal.handlers.HandlerProxy.execute(
        at org.eclipse.core.commands.Command.executeWithChecks(
        at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(
        at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(
        at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(
        at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(
        at org.eclipse.ui.menus.CommandContributionItem.access$19(
        at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(
        at org.eclipse.swt.widgets.EventTable.sendEvent(
        at org.eclipse.swt.widgets.Widget.sendEvent(
        at org.eclipse.swt.widgets.Display.runDeferredEvents(
        at org.eclipse.swt.widgets.Display.readAndDispatch(
        at org.eclipse.ui.internal.Workbench.runEventLoop(
        at org.eclipse.ui.internal.Workbench.runUI(
        at org.eclipse.ui.internal.Workbench.access$4(
        at org.eclipse.ui.internal.Workbench$
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.eclipse.equinox.launcher.Main.invokeFramework(
        at org.eclipse.equinox.launcher.Main.basicRun(
        at org.eclipse.equinox.launcher.Main.main(

    Starting WTX with CleanExtenderStudio.bat did not fix this issue.

    Updated on 2013-05-15T16:35:50Z at 2013-05-15T16:35:50Z by thorstenhirsch
    • 5UXU_Bernard_Hauzeur
      1 Post

      Re: TX Rule Formatter - enhancing map rule readability

      ‏2013-05-22T20:49:34Z  in response to thorstenhirsch

      Thanks for this feedback and also for serving as early tester. Effectively, colleagues encountered the exact same problem when installing it in TX Studio, whereas the Broker Toolkit with TX for IS extension did work OK.

      I found the cause and fixed it. You'll find the updated version attached. Even a smaller file size as explained below.

      Technical explanation: the MapEditor plugin  that handles map rule editing does not formally export the Class interfaces used by my Rule Formatter plugin. IBM did not foresee such extensibility (and did not document it). MapEditor and associated classes were needed to run the plugin, and the Eclipse workbench in the Broker toolkit allowed loading a copy of these along with the rule formatter plugin. This is not the case of TX studio which apparently has more strict class loading policy, and therefore refuses loading a "duplicate" class instance. The true solution would be to expose the necessary plugin extension, but this does require hacking the Eclipse OSGI  settings... which I do not want to : I want the users to be able to add/remove the Rule Formatter plugin by just adding/removing the plugin jar. So the trick was to refactor the plugin code to use introspection on the MapEditor object family, which I tested successfully in both WMBT and TX STudio

      Keep me posted and thank you in advance to all candidate users.

      PS: do not forget to remove the previous plugin file (different name / serial number!) and replace by the attached.

      oooups: 5UXU_Bernard_Hauzeur (working at NMBS in BE) and Bernard H (self employed) is the same person...may reply to either

      Updated on 2013-05-22T21:00:17Z at 2013-05-22T21:00:17Z by 5UXU_Bernard_Hauzeur
  • vijji_WTX
    124 Posts

    Re: TX Rule Formatter - enhancing map rule readability

    ‏2013-06-06T06:55:13Z  in response to bernard H

    Hi , Good to know about this feature and thanks a ton and appreciate for your effort and share. 

    I installed this .jar in my and could not see the icon. searched in preferrences but no luck. Any clue to fix?




    • bernard H
      bernard H
      5 Posts

      Re: TX Rule Formatter - enhancing map rule readability

      ‏2013-06-06T21:54:05Z  in response to vijji_WTX

      Looks like there are subtleties linked to the visibility of plugins deposited under program files in some Windows 7 installations. I'm actively searching a solution with a colleague in trouble. I will keep you posted of course.

    • bernard H
      bernard H
      5 Posts

      Re: TX Rule Formatter - enhancing map rule readability (Windows 7 note)

      ‏2013-06-23T17:06:52Z  in response to vijji_WTX

      Here is a progress note on the visibility of the plugin in Windows7 installations.

      With an Installation that was NOT made under Program files(x86), I noted the following (based on latest plugin, cfr above May 22 version).

      For TX studio: If the plugin is copied into C:\IBM\WebSphere Studio IES V3.3\eclipse\plugins, then it is NOT visible. But instead, if copied within C:\IBM\WebSphere Transformation Extender 8.4\DesignStudio\wtx_eclipse\eclipse\plugins the plugin is visible and works well.

      Possibly important: the account under which this was checked is a local administrator of the system.

      For the Message Broker toolkit with TX for Integration servers extension, when copied into C:\IBM\WebsphereMBToolkitV8001\plugins then the plugin is visible and works.... still indeed under local administrator of the machine.

      When installed In Program files (x86) (i.e. 32bit), I noted the problem on a colleague PC with  Windows 7 and the UAC active and notably the virtual directories that completely fool up applications. There are various tips described in forums that could solve the issue, but so far I was unable to test them. I think that just taking ownership of the IBM installation location (and recursively everything under) and setting full access control for the user at stake would solve the issue without having to ressort to the brute force de-activation of all security protections...


      • Zamir_Juma
        2 Posts

        Re: TX Rule Formatter - enhancing map rule readability (Windows 7 note)

        ‏2014-01-16T21:46:49Z  in response to bernard H

        This type of tool would be great.. disappointed that something like this isn't built in.  I didn't have any luck getting it to run on WTX, I assume there must be some changes that prevent it from working.  Anyone have any alternatives?

      • thorstenhirsch
        84 Posts

        Re: TX Rule Formatter - enhancing map rule readability (Windows 7 note)

        ‏2014-02-12T10:05:55Z  in response to bernard H

        The new version (com.reverseXSL.TXextend_1.0.0.201305220000.jar) works for me in WTX But I decided not to distribute it to the other developers here in my company, yet. I'd like to change some preferences concerning indentation and white space characters before/after brackets. But I guess it's a bunch of work to make all this stuff editable in the eclipse preferences...

        Bernard, what do you think about open-sourcing your software? We achieved to bring up a policy in my company that allows developers to contribute to open-source projects at work, even to GPL'ed projects.

  • jvanboga
    416 Posts

    Re: TX Rule Formatter - enhancing map rule readability

    ‏2014-01-22T20:32:46Z  in response to bernard H

    Nice to have a tool for this for those preferring the java formatting. 

    My experience is that if a rule is so complex its challenging to read if should probably be broken into multiple functional or called maps depending on the needs.  The way the tool works is that poorly formated functions will cause the logic to fail.  Functions that can cause issues if formated poorly include 'extract', 'lookup', 'searchup'/down and sometimes substitute.  Too many, used inconsistently, in a single rule will compile but cause potential problems.

  • Ravi2014
    4 Posts

    Re: TX Rule Formatter - enhancing map rule readability

    ‏2014-02-27T10:43:40Z  in response to bernard H

    Is it works for WTX 8.2?


    • bernard H
      bernard H
      5 Posts

      Re: TX Rule Formatter - enhancing map rule readability

      ‏2014-02-27T22:26:36Z  in response to Ravi2014

      I haven't tried and have no clue. All the installations we made were 8.4.0.x. It's harmless to try as it consists of an Eclipse Plug-in, which can then be removed as easily as it is installed.

      Note that the most important is to have an installation of the Broker toolkit + TX for IS, and/or TX studio installed outside of the "program files" folder hierarchy as the Windows7 protection rules and 'roaming' virtual folders applied to the Program files folder do prevent a proper execution of the plugin for a reason I have not fully understood, even if we play with the ACL's. You may see the plug-in listed under /program files(x86)/IBM/...., but actually the file sits physically under C:\Users\<yourLogin>\AppData\Local\VirtualStore\... and the Eclipse application will never see it. cfr