In this Document
Goal |
Solution |
Overview |
Steps in writing Java Concurrent Program |
Template Program: |
Program Logic |
Program Parameters |
Database Operations |
Setting request Completion Status |
Register executable |
Register Concurrent Program |
Test Program from OS Prompt |
Sample Program |
Note: |
How to create a Java Concurrent Program?
Concurrent Processing provides an interface ‘JavaConcurrentProgram’ with abstract method runProgram() which passes the concurrent processing context ‘CpContext’. The concurrent program developer will implement all of their business logic for a concurrent program in runProgram(). The main() method, implemented by AOL, will call runProgram() after performing all of the required initialization for the concurrent program, including establishing a database connection, initializing the required contexts, and setting up the log and output files. CpContext will have the request specific log and output file input methods. The class name with the main method will be registered as the java executable file name in the register executable form or by using pl/sql API.
Developer has to register the full package path for the class in register executable form. For example, if wip product creates a class in $WIP_TOP/java/shopfloor/server/BackgroundProgram.class, then this class goes to apps.zip file with package location ‘oracle/apps/wip/shopfloor/server/BackgroundProgram.class’. Developer will register ‘BackgroundProgram’ as the executable file name and ‘oracle.apps.wip.shopfloor.server’ as the package path in the register executable form. Developer has to follow the java notation to register the package path location, ‘.’ to denote the directory instead of ‘/’ in UNIX.
Java Concurrent Program parameters must register with token names in the parameter screen of the register concurrent programs form. Developer can get the value of the parameter for a given token name in the java concurrent program. These token names will be used in passing the parameter values as parameter string to the concurrent program from the command line for testing the java concurrent program.
Developer should set the status and completion text for the java program by using the setCompletion() method provided by AOL. The runProgram() method should call setCompletion() method to report the program completion status to the Concurrent Manager. The program may set its completion status to Normal, Warning or Error. Completion text is optional.
You need to create the directory under $FND_TOP" manually first,
e.g. $FND_TOP/java/cp/request
then copy the Template.java from the coding block below.
Copy the template Java Concurrent Program to $FND_TOP/java/cp/request/Template.java and start coding according to your requirement. Change file name and class name to your required name as Java Concurrent Program name.
Implement the runProgram with your Java Concurrent Program business logic. runProgram() gets the CpContext . CpContext is a subclass of AOL/J AppsContext which provides the request specific member classes LogFile to write to request log file, OutFile to write to request output file and ReqCompletion to set the completion status of the request.
CpContext uses the AOL/J utility Parameter List to pass the parameters to the Java Concurrent Program.
Please refer AOL/J Parameter list to get the Parameter List name, value pairs. You will be referring parameter list name as the parameter name and corresponding value as the parameter value in the Java Concurrent Program. You have to register the parameter names as token name in the register concurrent program form Parameter screen.
Use getJDBCConnection method to get the connection object for any JDBC operations within program and release the connection to the AppsContext connection pool. Use CpContext's commit(), rollback() methods to commit or rollback the transactions in the database. These methods will set the program proffered rollback segments after commit or rollback segments for the rest of the database transaction in the Java Concurrent Program.
Call setCompletion() method of the ReqCompletion object which is a member of CpContext before returning from your Java Concurrent Program to set the completion status for the program and optional completion text.
Register your Java Concurrent Program class name as execution_file_name and package name in execution_file_path in register concurrent executables form.
Register you Java Concurrent Program as concurrent program in the register concurrent program form. Register all the parameters that you want to pass to the program in the parameter screen of this form. Register the Parameter List names referred in the program as the token names in the parameter screen.
You can test your Java Concurrent Program from OS prompt by using the following syntax:
Example:
If you don't specify the 'request.logfile' with -D option then the all the log file information will be printed to the standard output. Specify the 'request.requestid' to rerun already completed request. You can specify the all the application user specific context values with -D to get the specific user context to the program when run from the OS prompt. Pass all the parameters if any by using the AOL/J Parameter list syntax.
This is an example. Oracle does not support this Sample in any way.
Customizations are not supported neither.
If you need additional assistance, please contact Oracle Consulting.