IBM Cúram Message File Overview

 


Introduction


This post helps explain how message catalog files are used in the Cúram application. Message files are used to represent human readable messages to end-users when unexpected events/exceptions occur. Suppose, user while entering participant information forgets to enter Date of Birth and hits the return key. Then the user can be presented with a validation message like “Date of Birth not available, Please enter!”.

Message text files are located in the /message directory of a component.

Traditionally message files or catalogs are binary files used for holding text messages associated with an application. Each message catalog had a one-to-one association with a symbol definition file. The symbol definition file was examined at compile time and the message catalog at run-time. Using this form of indirection allows an application to be localized without a re-compilation being necessary.

In keeping with this approach, Cúram message catalogs are generated from message.xml files using a command-line build utility called msggen. Generating from a message.xml file produces two outputs:

  1. A message catalog file (one Java .properties file is generated for each locale specified)
  2. A symbol definition file (a standard Java class file)

The symbol definition file is a Java file containing constants with attribute final and static.

The msggen build target performs the merge of message files and then translates the resultant message file (which are stored in /build/svr/message/scp) into symbol definition (Java code) and message catalog (property) files.

 

<?xml version="1.0" encoding="UTF-8"?>  <messages package="curam.message">
  <message name="ERR_DATE_OF_BIRTH_NOT_AVAILABLE">  
         <locale country="US" language="en">  Date Of Birth Not Available!  </locale>  
</message>  <message name="ERR_CREATION_DATE_EMPTY">  
<locale country="US" language="en">  You must enter a creation date  </locale>  
</message>  </messages>

 


Message File Customization


We can customize already existing OOTB files, but before updating OOTB file we need carefully perform proper impact analysis. Impact analysis provides all references from where this message file is called.

This override process involves merging all message files of the same name according to a precedence order. The order is based on the SERVER_ COMPONENT_ORDER environment variable. A <message> will be merged into a new message file if the <message> is not already present in the new file. Duplicate messages will always be overwritten by the message file in the component with the highest precedence order.

To change an existing message, create a new message file with the same name as an existing message file in the message folder of the custom component. Insert a new message with the same name attribute as the message being modified and set the text as required. The generators will merge the generated output from the custom\message folder with the output from the core\message folder. Note that if you change a message with place holders, ensure that you do not change the number of place holders in the message, unless you also change the source code. It is worth noting that all infrastructure message files are shipped as part of the base application.

Steps to Follow:

  • Copy Paste Message file from OOTB to Custom and it merge based on component order.
  • Messages are merged based on component order

          SERVER_COMPONENT_ORDER=custom,core

2016-08-07 23_40_53-9D32G – Part Two.pdf - Adobe Acrobat Reader DC

  • Once message file copied or created new file in custom folder then execute msggen ant target to generate artifacts.

 

 

One thought on “IBM Cúram Message File Overview”

Leave a Reply

Your email address will not be published. Required fields are marked *