Using Java Pluggable Components (JPC)in Oracle Forms

Java pluggable  components are java bean classes that can integrate to Oracle Forms environment and provide new functionality to the standard Forms build-in functionality.  They are used in web-centric application that are deployed through Oracle Internet Application Server.

The JPC are standard components that can be created you, or can be downloaded through the internet.

The following shows how to add JPC component to a form module and how to configure the application server accordingly.

The example explains how to add File Upload component (Note the same can be done using WebUtil)

 

Using Java Pluggable component

File upload example

 

This document assumes that the Oracle Developer is installed as the following directory

 

C:\oracle\product\10.1.0\DevSuite_10g      => $ORACLE_HOME

 

 

1)      Create the following file in directory at the  %ORACLE_HOME/forms/server and call it fileupload.env

 

ORACLE_HOME=C:\oracle\product\10.1.0\DevSuite_10g\

PATH=C:\oracle\product\10.1.0\DevSuite_10g\forms\jdk\jre\bin\classic;C:\oracle\product\10.1.0\DevSuite_10g\bin

CLASSPATH=C:\oracle\product\10.1.0\DevSuite_10g\forms\demos\jars\uploadserver.jar;C:\oracle\product\10.1.0\DevSuite_10g\jdk\jre\lib\rt.jar

FORMS_path=C:\oracle\product\10.1.0DevSuite_10g\forms\\demos\lib;C:\oracle\product\10.1.0\DevSuite_10g\forms\demos\fileupload\forms

 

Add the following to the end of the formsweb.cfg file

 

 [FileUpload]

pageTitle=OracleAS Forms Services - FileUpload Sample

IE=jinitiator

baseHTMLJInitiator=demobasejini.html

archive_jini=frmall_jinit.jar,/forms/formsdemo/jars/demo.jar,/forms/formsdemo/jars/icons.jar

archive=frmall.jar,/forms/formsdemo/jars/demo.jar,/forms/formsdemo/jars/icons.jar

width=675

height=480

separateFrame=false

splashScreen=no

lookAndFeel=oracle

colorScheme=blue

form=dubai_police.fmx

background=/formsdemo/images/blue.gif

envFile=fileupload.env

 

 

Important:  Please note that it is very important that you set the archive variable and the archive_jini variable correctly.

In our example, the java classes (components) are located inside the demo.jar  (which is incorrectly document in the oracle documentation for the upload demo). Also note that the /formsdemo/ is a virtual directory and the actual directory is /forms/demos.  This is configured when you deploy the application.  Therefore make sure that the file demo.jar exists and located as indicated above

 

The variable envFile points to a the file fileupload.env, which is the file defined in step 1 above

 

This file defines the CLASS PATH, the FORMS path and the Oracle path.

Make sure that the form (FMX) file is located within the FORMS PATH. Note that the actual file name to be executed is defined by the variable

           

                  Form =   Dubai.fmx  

 

 

=====================    CODING ======================================

 

You need to follow coding as document in the example and the demo

 

Adding the code to your Form

Reusing the FileUpload utility within your own applications requires the following steps.

  1. Attach the FileUpload.pll library (shipped in the FileUpload\forms directory) to the form that needs upload capability
  2. Create a new BeanArea on one of your canvases. The bean is invisible and so you can set the size to 1x1. The BeanArea should be placed into a block with the Single Record property set to Yes. This will ensure that the bean is instanciated as soon as the Form is started. You can create a brand new block to hold the bean if you wish.
  3. Set the Implementation Class property of the new BeanArea to oracle.forms.demos.uploadclient.FileUploader
  4. Create a WHEN-CUSTOM-ITEM-EVENT trigger on the BeanArea with the code:

begin
FileUploader.eventHandler(:system.custom_item_event,get_parameter_list(:system.custom_item_event_parameters));
end;

  1. Create a user named trigger e.g. FILEUPLOADER_CALLBACK which the upload utility will execute when the upload is complete or if the upload fails for some reason. We need this trigger because the upload is an asynchronous process, and the trigger that calls the FileUploader.UploadFile() function is not blocked until the upload is finished. A sample callback trigger might look like.

/*----------------------------------------------------*
* Sample Callback trigger for FileUploader
* You should always implement a check on the status
* to make sure that the upload has worked.
*
* This trigger will only be executed once the upload
* has finished or aborted
*---------------------------------------------------*/
Begin
 if FileUploader.getStatus = FileUploader.FINISHED then
  message(FileUploader.getSourceFile || 'was uploaded');
elsif FileUploader.getStatus = FileUploader.FAILED then
  message('Upload Failed because: '||FileUploader.getError);
 end if;
end;

  1. Register the Bean and the Callback trigger by calling FileUploader.init(<BeanArea>,<TriggerName>). This can be done in the startup code for the form, or just before invoking an upload. However, you must call Init() before uploading. A sampl       e call to Init might look like:

FileUploader.init('UPLOAD.FILE_UPLOAD_BEAN','FILEUPLOADER_CALLBACK');

  1. Finally write the code to call the upload. You can either call FileUploader.UploadFile() to display a selection dialog on the client, or FileUploader.UploadNamedFile() to upload a specific file.

FileUploader.UploadFile('d:\temp\uploaded');

Warning: If you intend to use the FileUpload utility in your own applications, We recommend that you re-sign the UploadClient PJC with your own x509 certificate.

 

 

Please follow the documents  

C:\oracle\product\10.1.0\DevSuite_10g\forms\demos\fileupload\doc\fileuploader.html

 

the entire document is downloaded from internet