KB Article #178364
How to use a Java custom-function in Integrator (through Composer)
Problem
-- How can we use a Java custom-function in Integrator ?
Resolution
Here is a simple (basic) way of using Custom Functions in Integrator, through Composer. Further indications and scenarios can be found in the Integrator Enabler help guide (Composer GUI -> Help menu), section "Creating Custom Functions"
Starting with: a java source-code (in this example: testolaf.java, which can be found attached)
Step 1: Compile the Java source-code to obtain the .jar file which will be used later in Composer
Prerequisites:
- A JDK is needed
- the JAVA_HOME environment variable must be set to the bin directory of the Java installation, for example: C:\Program Files\Java\jdk1.8.0_66\bin
- the JAVA_HOME environment variable must be added to the PATH environment variable
- from $CORE_ROOT/java/lib, the latest dml-mapper-java-api-3.7.3_R******.jar file will be used (this depends on the SP installed on Integrator Server)
For this exemple, the jar used is dml-mapper-java-api-3.7.3_R146726.jar (for Integrator 3.7.3 SP6)
In a command-line, execute the 3 following commands (the two MANIFEST files are attached):
javac -g:none -classpath $CORE_ROOT/java/lib/dml-mapper-java-api-3.7.3_R146726.jar [full_path_to_the_file]/testolaf.java<---- this will produce testolaf.class
jar cvmf MANIFEST.Test Test_dmlfunc.jar
jar cvmf MANIFEST.MF_test Test_Lib.jar testolaf.class
From this two jar files will be obtained (in the JAVA_HOME directory): Test_dmlfunc.jar and Test_Lib.jar , which comprises the compiled testolaf.class
Step 2: Passing the jar files to Integrator
- Copy Test_Lib.jar in CORE_LOCAL\java\lib
- Copy Test_dmlfunc.jar in CORE_LOCAL\java\dml-extensions
- Restart the Integrator server
Step 3: Create the custom-function in Composer
- Create the DML Customer Function in the Integration tab -> Mapping manager -> Custom Functions
- Configure the CF (printscreen attached):
- Name: for this example, "Test" was used
- Cathegory: Java,
- Class name: name of the class we compiled (for this example, testolaf)
- Method name: name of the (main) method used in the class (for this example, test)
- Save and Check the object
Step 4: Call the custom-function in another DML object
- For example, in this case the CF was called in a field of a Mapping Rule, using the command: %sTempStr := Test() , where Test is the name of the custom-function defined at Step3 and sTempStr is a String DML variable already existing in Composer (printscreen attached)
- Save and check the object, commit an IT which uses this object and use it as per its design.