By David Allan-Oracle on May 12, 2011
Here we will see how you can use the groovy interpreter to automate, automate, automate (with no compile,compile,compile). When you get into large enterprise configurations of software, automation is the name of the game. The ODI 11g SDK as I blogged here lets you interact with pretty much the entire ODI set of metadata. The example I posted was a interfaceAccelerator.java (or for post 220.127.116.11 here) is a java class that needs compiled and then executed. Rather than compiling and executing (and needing to understand much of the build side of java), let’s look at an alternative….
In OWB, there is an interpreter/interactive shell called OMBPlus and language that lets you automate the construction of artifacts and get smart with the tool. With ODI you can leverage the groovy interpreter for example, which lets you interact with java objects. You’ll need to download groovy and install. When groovy is installed you can then either execute the groovy process and process a groovy script as input or use the groovysh shell/interpreter. The groovy scripts can be scripts which use the ODI 11g SDK and interact with ODI.
For example the command below, takes the groovy script interfaceAccelerator.groovy or post 18.104.22.168 here (which is a groovy version of the java class file previously used) as input, and the tabs.txt is piped in the standard input stream.
groovy interfaceAccelerator.groovy < tabs.txt
The groovy script is a mixture of groovy commands and ODI SDK calls to generate the interfaces in ODI.
The CLASSPATH including all the ODI jars is one thing that needs set up prior to executing the groovy script above, I just included all jars in the oracledi.sdk\lib directory.There was a small change in the transaction handling APIs after production 11g ODI, hence the different versions of the groovy and java scripts.
Lots of possibilities as you can imagine! There are a few cool things we can extend the actual interfaceAceelerator to do...regardless of groovy or java, but just some more useful capabilities, more to come.