Invoking Java from the KMs
So far in this chapter we have used Java to alter the code that is generated by ODI when we use KMs. But there may be cases where you want to generate Java code and actually run that code as part of the execution of the ODI processes. In this example, we will use Java code to write additional information to a file as we run an interface. There are two technologies that can be used in ODI to write Java code, namely Jython and Groovy. We will use Groovy here as it is closer to true Java code, but the use of one technology versus the other is mostly a matter of personal preference.
Getting ready
For this recipe, we will modify the IKM SQL Control Append
KM, so make sure to import this KM into your project before getting started.
How to do it...
Rename the
IKM SQL Control Append
KM toIKM SQL Control Append
with Java Code
.Right-click on the
IKM SQL Control Append with Java Code
and add New option. Call this optionAudit File Name
. Set the type toValue
and the default...