[java api f90jdapi]How to change locationnames of attached libs in PLL's?

10-11  Source: Network gathering  Views:0 

I have a couple of PLL files which have some attached libraries. The problem is that the cases of the locationnames of these attached libraries are not exactly the same as the physical files: for example, the physical file 'ofgmes.pll' is attached as 'Ofgmes.pll', or 'OFGMES.PLL'. In Linux this will cause problems during compilation, because Linux is case sensitive.
We have two solutions to change the locationnames manually:
1. load PLL in Oracle Forms Builder, remove and reattach the attached libraries.
2. Convert PLL to PLD, change the .attach LIBRARY property, and convert the PLD to PLL
As you can imagine, it takes a lot of time to do this manually. So I'm looking for a solution with the java api 'f90jdapi'. I've tried to load de PLL's in a PlsqlObject object, but it's impossible to edit these objects.
Now I'm looking for a manner to convert a PLL to PLD and vice versa. Can anyone help me with that? If there is another solution to change the locationnames of the attached libraries, please tell me :)
Hi Jeroen,
You have two options to work around your lib's problem. Perhaps the easiest way is to set your FORMS90_PATH to include the missing library modules. This requires no coding, but I can imaging that hard-coded paths are unwanted in the future and you want to remove them (I know I would).
The second option involves some Java coding (using JDAPI) but than the paths are removed automatically. In essense
you have to rewrite the whole library as a pld and then parse the pld into a pll and eventually compile it into a plx.
The code below shows this. It is extracted from a utility I use to reattach libraries to forms, menus and pl/sql-
libraries. I tried to strip the code from details as much as I could. You can include this method into a new class or into your exsisting class.
It does:
1) loop over all modules loaded into the JDAPI session and check if a library module is passing.
2) For each found library, it loops over the attached libraries and writes a line to a StringBuffer. This StringBuffer is going to be your pld.
3) Loop over all Program Units and write the code to the StringBuffer.
4) Construct a proper file name and save the pld module to disk.
The save method uses a java.io.FileWriter to save the pld to disk and calls the runtime method I posted earlier to parse and compile the file.
* Reattach libraries to Libraries (PlsqlModules). Handling libraries is different
* than handling forms and menus, therefore, this method does not depend on
* the reAttach(JdapiModule, List) method.
* Libraries are handled via a .pld script file and parsing that file to a .pll file.
private void reAttachLibs2Libs() {
for (JdapiIterator modules = Jdapi.getModules() ; modules.hasNext() ; ) {
JdapiModule jmod = (JdapiModule)modules.next();
if (jmod.getTypeId() == JdapiTypes.LIBRARY_MODULE_OTID) {
StringBuffer pldModule = new StringBuffer(4800);
// loop over all attached libraries and remove hard-coded paths
for (JdapiIterator attachedLibs = ((PlsqlModule)jmod).getAttachedLibraries() ; attachedLibs.hasNext() ; ) {
AttachedLibrary attachedLib = (AttachedLibrary)attachedLibs.next();
String lib = attachedLib.getName();
if (!dettachOrSwap.containsKey(lib)) {
pldModule.append(".attach LIBRARY ").append(lib).append(" END NOCONFIRM\n");
} // end for loop attached libraries
// loop over all PU's and append it (unchanged) to pldModule
for (JdapiIterator pUnits = ((PlsqlModule)jmod).getProgramUnits() ; pUnits.hasNext() ; ) {
ProgramUnit pUnit = (ProgramUnit)pUnits.next();
// only if libraries are changed, save pld to file system, to the outdirectory
// entered in jdapi.properties and change file extension from pll to pld.
String fileName = jmod.getAbsolutePath().substring(
jmod.getAbsolutePath().lastIndexOf(File.separator) +1
, jmod.getAbsolutePath().length()-3) + "pld";
fileName = outDir + File.separator + fileName;
save(pldModule, fileName);
} // end if JdapiTypes.LIBRARY_MODULE_OTID
Related articles