1. The document describes how a custom Java applet integrates with Oracle Forms to provide recipe/formula/routing design functionality. It discusses communication between the applet and Forms, the structure of the applet code, debugging techniques, and setup instructions.
2. The applet code is divided into common, client, and server packages. The client code runs in a browser and communicates with server code via data managers. Server code interacts with the database through JDBC and PL/SQL packages.
3. Debugging involves using print statements in the client code and log files in the server code. The applet is set up by configuring the JDeveloper IDE and importing required Forms
GMD Designer Code Analysis and Debugging Techniques
1. GMD Designer --for Recipe/Formula/Routing
1, Forms and Designer Communication
2, Designer Code Analysis
3, Debugging
4, Setup
5, Testing
1, Forms and Designer Communication
1.1), From Forms to Designer:
In design phase, create a Bean Area type item in forms and set its class as oracle.apps.fnd.formsClient.AppletAdapter,
it behaves as a middle man between applet and forms. For example GMDRCDSG.fmb, GMDRTDSG.fmb
Use package FNDAPLT to init applet, in the following way for example:
FNDAPLT.Applet_Init(
'DESIGNER.BEANAREA',
'GMDREDSG01',
'oracle.apps.gmd.recipeDesigner.javaui.RecipeDesigner',
l_paramlist);
During runtime, forms communicates with applet by the following way:
SET_CUSTOM_ITEM_PROPERTY('DESIGNER.BEANAREA', '%', 'GMDREDSG01:OPEN_RECIPE:'
||':'||:PARAMETER.CUR_RECIPE_ID);
Note: In the following, RecipeDesigner.setProperty method will be called.
1.2), From Designer to Forms
Designer communicates with Forms by using java class UserAreaSender to send messages, sample code:
private void callFormRefreshRecipeId(String recipeId) {
if (m_uaSender != null) {
m_uaSender.removeAll();
m_uaSender.add(recipeId);
m_uaSender.send("CALL_REFRESH_RECIPE_ID");
}
}
2. There is a trigger WHEN-CUSTOM-ITEM-EVENT on Bean Area, for example:
And trigger code:
DESIGNER.Handle_Applet_Events;
It’s a plsql procedure in this forms file, and it will handle events from java code, for example, corresponding code for
above event “CALL_REFRESH_RECIPE_ID”:
ELSIF (:system.custom_item_event = 'CALL_REFRESH_RECIPE_ID') THEN
………
ELSE
This is all how forms communicates with custom applets.
2, Designer Code Analysis
Designer uses a C/S implementation, client side runs in browser’s java applet while server runs as a part of EBS’s tcf
service.
2.1), Overall code
There are three packages:
oracle.apps.gmd.recipeDesigner.common $GMD_TOP/ java/recipeDesigner/common
oracle.apps.gmd.recipeDesigner.javaui $GMD_TOP/ java/recipeDesigner/javaui
oracle.apps.gmd.recipeDesigner.server $GMD_TOP/ java/recipeDesigner/server
common package, as it states, is shared by javaui/server packages.
Note: code is shared by recipe/formula/routing designers.
2.2), client code
2.2.1), RecipeDesigner.java
actionPerformed
This method is called when you operates in the designer. For example, when you click File -> save, a
command “SAVE” is passed to this method.
setProperty
When forms calls SET_CUSTOM_ITEM_PROPERTY, this method will be called. For example,
if ((command.toUpperCase()).equals("OPEN_RECIPE")) {
// we are opening the given recipe
Constants.RECIPE_ID = Integer.valueOf(paramTokens.nextToken()). intValue();
m_isNewRecipe = false;
refresh(false, true, true, true, true);
3. }
2.2.2), MaterialDataManager/FormulaDataManager
This class is used by RecipeDesigner to exchange data with data servers on server side, for example,
MaterialDataServer.
2.3), server code
2.3.1), MaterialDataServer
It routes requests from client’s DataManager to server’s TreeServer. It uses Item.java as the medium of data
exchange. The data format is like:
T01:V1:6,T00:V170:2460460................................
2.3.2), MaterialTreeServer
It receives requests from DataServer, actually interacts with Database through JDBC API.
Note: call sequence
RecipeDesigner -> MaterialDataManager(client) -> MaterialDataServer(server) -> MaterialTreeServer(server)
2.3.3), PLSQL packages
GMD_RECIPE_DESIGNER_PKG
3, Debugging
3.1, Client debug
Client debug focuses on RecipeDesigner.java, imply use System.out.println to do client debug, or use below method
to print call information.
private void printCall(String mtd, String[] na, String[] va) {
StringBuffer buf = new StringBuffer("Method: " + mtd +"t Params: ");
for(int i = 0; i < na.length; i++) {
buf.append(na[i]).append("=").append(va[i]).append(";");
}
System.out.println(buf.toString());
}
or use the following not-so-elegant code to get call trace:
try {
throw new Exception("for call trace");
} catch(Exception ex) {
ex.printStackTrace(System.out);
}
3.2, Server debug
For server debug, you can choose to write debug info in log files or database. I prefer the files choice. By adding
debug methods to CommonDataServer/CommonTreeServer, you can call them in their implementations. This is an
example for debug method:
4. private String file="/home/applmgr/rcpdsg.log";
protected void log(String msg, boolean trace) {
PrintWriter out = null;
try {
out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file,true))); // append
if(trace) {
try {
throw new Exception("for call trace");
} catch(Exception ex) {
ex.printStackTrace(out);
}
}
out.println(msg);
}catch(Exception ex) {
}finally
if(out !=null) {
try {
out.close();
} catch(Exception ex) {}
}
}
}
Make sure that you have write permission on the file you specify.
4, Setup
4.1), jdev setup
In dev desktop, use the following path:
For 121 branch, select 1213x5dbg
5. Note: you have to choose corresponding jdev version for your code version, or there will be some unexpected errors.
Or setup a jdev env on your testing box:
1), download patch p9879989_R12_GENERIC.zip, and unzip
2), under your home folder, edit .jdev_jdk, input jdk5’s path, for example: /usr/java/jdk1.5.0_22
3), start jdev
4.2), project setup
First copy code from arcs, take branch121 as an example,
chenv gmd GMD121 gmddev
cp -R $gmd/java/recipeDesigner/common $yourfolder
cp -R $gmd/java/recipeDesigner/server $yourfolder
cp -R $gmd/java/recipeDesigner/javaui $yourfolder
copy following fnd jars from your EBS instance:
fndaol.jar fndctx.jar fndforms.jar fndjewtall.jar fndsec.jar
fndaolj.jar fndewt.jar fndgantt.jar fndjewt.jar fndtcf.jar
fndbalishare.jar fndewtpv.jar fndhier.jar fndjle.jar
In jdev, create a user library to include all these jars, take my example as fnd-ext.
Set project libraries like:
4.3), deploy
First, create a new jar deploy profile, File -> New,
6. Deploy,
Should be fine like,
5, Testing
Server side
replace class file under $OA_JAVA/oracle/apps/gmd/recipeDesigner/server/, restart applications;
Client side
replace jar file under $OA_JAVA/oracle/apps/gmd/jar, clear all browser java cache(through java control panel ->
settings -> delete all files), better restart browser;
--EOF--