Technical Blog Post
Abstract
Custom User Exit in IBM Sterling Integrator
Body
Mapping is the core component in the B2B integration environment. There are limitations on features provided at map level since Sterling Integrator supports only some of the Java classes such as java.lang.String, java.util.date etc. The custom Java classes can be created and accessed in the map with the help of user exit. This blog aims to provide detailed explanation regarding creation of custom user exit, configuration required and example which shows implementation into the map.
For detailed documentation of user exits in the map, see the link http://www.ibm.com/support/knowledgecenter/SS3JSW_5.2.0/com.ibm.help.stds802_map_editor.doc/c_STDS_ME_AboutUserExits.html
Steps Involved:
1) Create Java classes in order to implement a specific functionality.
2) Compile Java classes with the help of Sterling Integrator Java.
For e.g.
C:\temp>SI_Install_Folder/jdk/bin\javac -cp <java_file_path>
3) Package the compiled class files into jar file so that it can be used for custom user exit implementation.
i) Place the class files in the package folder i.e. how it is specified in the Java code (for e.g. com\map\number)
ii) Run the below command to create jar file,
SI_Install_Folder/install/jdk/bin>jar cvf <jar_file_path> com
4) Install newly created jar file on Sterling Integrator with the help of install3rdParty.sh/cmd script.
SI_Install_Folder \bin>install3rdParty.cmd CustomUserExit 1_0 -j <jar_file_path>
Once jar(s) been deployed onto the server then it will create jar entries into the dynamicclasspath.cfg file (SI_Install_Folder/properties folder).Restart the server so that newly added user exit can be used in the map.
Example of User Exit:
The sample custom user exit performs the number to words conversion into the English. This logic can be achieved in the map with the help of user exit. The sample Java code for number to words conversion and packaged jar file can be found on GitHub repository: https://github.com/IBM-Commerce-B2Bi/CustomUserExit
The user exit was implemented on IBM Sterling Integrator v5.2.4.
The sample extended rule code which makes use of user exit packages is given below,
//Variable Declaration
Object number_obj;
Integer number;
String [256] numberInWords;
//Number to words conversion
number_obj = new ("com.map.number.NumberToWords");
NumberInWords=number_obj.convert (number);
Input/Output:
Input text:
12345
Output text:
12345 in words (English) - twelve thousand three hundred and forty five
Uninstall/Remove newly added user exit:
- Remove <jar_file> from SI_Install_Folder/jar/ CustomUserExit /1_0, or remove the whole CustomUserExit folder if it’s not needed in future.
- Remove the latest jar entries from dynamicclasspath.cfg file that reference to these packages, mentioned in the previous steps.
UID
ibm11121241