By David Allan-Oracle on Jan 12, 2015
The 12c ODI release offers a full SDK which allows great opportunities for automation. You can reduce development times and work smarter. Here I will show how to use Eclipse to configure and setup the the SDK to start working smarter. In this example I will use an updated version of Mapping Builder which is a sample SDK illustration I blogged about previously. The builder has been updated to include auto mapping of attributes, multiple targets, loading modes and more. The updated OdiMappingBuilder.java code used in this example is here.
There is a viewlet illustrating the using Eclipse and the ODI SDK here. The viewlet walks through the entire configuration of an Eclipse project using the 12.1.3 release of ODI.
The important areas are with respect to the libraries you need to define for the project, below you can see the libraries used from the ODI installation, I have installed my software in C:\Oracle\ODI_1213 in these examples.
Once the libraries are configured you can import the mapping builder java source code...
Then you must define how the code is executed, you specify the parameters as arguments. This is of course an example for illustration, you can define how you would like this to be done in whatever way you like. You specify all of the mapping builder parameters here. I also pass the control file as a parameter rather than via stdin (which is what I did in previous blog posts).
I mentioned the mapping builder code now supports auto mapping, multiple targets and loading mode, you can see an example driver file below. The line starting with >mapping has 2 qualifiers, below I have used EQUALS and IGNORECASE. The first parameter supports the following values;
- EQUALS - supports matching EMPNO with EMPNO (or empno with EMPNO when IGNORECASE used for example)
- SRCENDSWITH - supports matching source XEMPNO with EMPNO (plus case option as above)
- TGTENDSWITH - supports matching source EMPNO with XEMPNO (plus case option as above)
The second parameter supports;
- MATCH - exact match, matches EMPNO with EMPNO or empno with empno
- IGNORECASE - supports mismatched case matching EMPNO matches empno
As well as auto mapping you can also specify specific column level mapping explicitly as was previously supported, the viewlet has an example.
You can also see the control file has a target_load directive which can be given a condition or else in the final field, this let's you load multiple conditional based targets. This is a new addition to the existing target directive. So the example has 3 directives now;
- target - load via insert/append the data
- targetinc - incremental update / merge the data
- target_load - insert multiple targets
In the example above, the following mapping is created, you can see the multiple conditional based targets and data is mapped all from a simple driver file;
Using Eclipse you can quickly build and debug your utilities and applications using the SDK and get the benefits of using an IDE such as code insight and auto completion.
Check out the viewlet and the mapping builder example plus the blogs on the SDK such as the recent one on the SDK overview and work smarter. Also, the updated OdiMappingBuilder.java code used in this example is here - get an overview of the mapping builder here.