After working some weeks with JDAPI strange features are emerging.
JDAPI seems to be unable to save PLL modules! Trying this results in This module type does not currently support saving to filesystem exception. Compiling PLL modules seems also sort of “not supported” by the jdapi. An exception This module type does not currently support compilation is thrown. Actually, decompiling the f90jdapi.jar and checking the PlsqlModule class confirms this. The only thing the save() and compile() methods are doing is throwing an exception. But why is this difference in behaviour between libraries and forms and menus?
So I got curious how the Migration Assistant does the trick. After decompiling the f90upgrade.jar to find out how Oracle fixes this problem in their Migration Assistant, I found out that they have also difficulties compiling and saving PLL modules. The work around is to execute the forms compiler (ifcmp90.exe or f90genm) from within Java. This is also backed up by a post on OTN replied by Frank Nimphius, one of the builders of the Migration Assistant.
Finding attached libraries can only be done in context of a parent FormModule or MenuModule (static method AttachedLibraries.find), but not in context of PlsqlModules. I might be wrong, but I think this is strange, because in real life a library (PlsqlModule) is very able to have other PlsqlModules attached. For example open ofgtel.pll and see the ofgmes.pll attached. So why isn’t jdapi letting me find them in the same way an attached library can be found on a form or menu?
The javadoc is hard to find, but it can be downloaded here: JDAPI javadoc and here: XML Tools javadoc.
Can you tell me how to save it to a pld file?
That is exactly how the Migration Assistant works. Make a pld; write it to file; compile with ifcmp90 (from within Java). Et voila.
I use a quick (but not so elegant) workaround:
1) open the PLL for manipulation
2) instead of save() i wrote a different method in which:
– a .pld file is written
– ifcmp90.exe is called to convert the pld into a pll
– the .pld is deleted
I know, but does it say anything about why there is difference in behaviour between the module types?
See the Oracle documentation on the the JDAPI: Managing PL/SQL Modules
Like the C API, there is only nominal support in Jdapi for PL/SQL modules. It is possible to load them and inspect the contents, but not to save or modify them. It is also not possible to compile them programmatically.