Writing 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().CpContext will have the request specific log and output file input methods. The class name with the runProgram() method will be registered as the java executable file name in the register executable form.
Follow the following generic format to write a Java Concurrent Program…
package oracle.apps.yourpackage.subpackage; import oracle.apps.fnd.common.Context; import oracle.apps.fnd.common.VersionInfo; import oracle.apps.fnd.cp.request.*; import oracle.apps.fnd.util.*; public class HelloWorldApp implements JavaConcurrentProgram{
public void runProgram(CpContext ctx){ //Obtain the reference to the Output file for Concurrent Prog OutFile out = ctx.getOutFile(); //Obtain the reference to the Log file for Concurrent Prog LogFile log = ctx.getLogFile(); try{ //To read parameters passed via Concurrent Program String myName = null; ParameterList lPara = ctx.getParameterList(); while (lPara.hasMoreElements()) { NameValueType aNVT = lPara.nextParameter(); if ( aNVT.getName().equalsIgnoreCase("My Name") ) myName = aNVT.getValue();); } //Write your logic here out.writeln("This will be printed to the Output File"); log.writeln("This will be printed to the Log File", 0); //Request the completion of this Concurrent Prog //This step will signal the end of execution of your Concurrent Prog ctx.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "Completed."); } //Handle any exceptional conditions catch(Exception e){ StackTraceElement ste[] = e.getStackTrace(); for(int i=0; i<ste.length; i++){ log.writeln(ste[i].toString(), 0); } } } }
Best Practice
As a best practice, use Oracle JDeveloper patched with the following patch number: 6012619. You can download it from Metalink. This patched release of JDeveloper includes all the FND packages and other requisite packages commonly used while writing Java Concurrent Programs. You may use Eclipse, but you will have to manually copy all the packages from Oracle Apps Server to your local machine and give its reference to the project.Porting Third-Party Libraries
Ask the DBA to place all the requisite third-party libraries under $JAVA_TOP. To make the third-party libraries available to your JCP, follow the steps outlined below to create your Concurrent Program Executable and to create the actual Concurrent Program.Create Concurrent Program Executable
Path: Concurrent -> Program -> ExecutableCreate the concurrent program executable, details of which are as follows:
Executable : HelloWorld Short Name : HelloWorld Application : Custom Applications Execution Method : Java Concurrent Program Execution File Name : HelloWorldApp This is your main class file Execution File Path : oracle.apps.yourpackage.subpackage
Create the Concurrent Program
Path: Concurrent -> Program -> DefineWe are having one concurrent program.
Program : HelloWorld Java Concurrent Program Short Name : HELLOWORLDJCP Application : Custom Applications Description : Hello World Program Executable Name : HelloWorld Executable Method : Java Concurrent Program Options : -classpath /dv00/oracle/product/DEV1110/java:/dv00/oracle/apps/DEV1110/11.5/au/11.5.0/java/appsborg.zip:/dv00/oracle/product/DEV1110/java/thirdParty1.jar:/dv00/oracle/product/DEV1110/java/thirdParty2.jarNote:- If your JCP does not make use of any Third-Party libraries, then please DO NOT put any entry in the Options.
The Options to be specified must be fully qualified. Use of environment variables will fail the execution of the Java Concurrent Program.
/dv00/oracle/product/DEV1110/java - This is the path to my $JAVA_TOP /dv00/oracle/apps/DEV1110/11.5/au/11.5.0/java/appsborg.zip - This is the path to my $AU_TOP/java/appsborg.zip /dv00/oracle/product/DEV1110/java/thirdParty1.jar - This is the JAR reference to my first Third Party Library dependency. /dv00/oracle/product/DEV1110/java/thirdParty2.jar - This is the JAR reference to my second Third Party Library dependency.The paths must be set for appropriate environment as specified above and must be separated using a colon “:” without any new-line characters.
Keywords: apps software,concurrent application,concurrent applications,concurrent tutorial,java application,java concurrent program,java concurrent programming,java example,java examples,
java programming,java sample,java sample code,java source code,java tutorial,java tutorial program,oracle resume