All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class oracle.forms.demos.uploadclient.FileUploader

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----oracle.ewt.lwAWT.LWComponent
                           |
                           +----oracle.ewt.lwAWT.LWContainer
                                   |
                                   +----oracle.forms.ui.VBean
                                           |
                                           +----oracle.forms.demos.uploadclient.FileUploader

public class FileUploader
extends VBean

This component facilitates the sending of files from the Forms Java client to the Forms server. It allows the user to select a file to be sent to the server and then performs the necessary operations required to send the file over the Forms message connection to the server.

Since the Forms server is not able to handle byte data from it's PL/SQL environment the user selected file is first transformed into a textual representation, using the BASE64 encoding scheme for sending to the server.

To further aid in the sending of this textual data to the Forms server, the encoded file is broken into 4K chunks before sending and each chunk is dispatched individually. It is up to the Forms server to process these chunks and reassemble them into a useful data set.

To reduce the amount of data sent across the network the source file is compressed before encoding. This facility can be turned off if the files being transferred are already compressed e.g. ZIP files

Since the encoding, chunking and dispatching processes can take a significant amount of time on slower networks/large files, the FileUploader utilizes a ProgressBar to indicate to the end user that actions are being performed.

Version:
1.2
Author:
Steve Button, Duncan Mills

Constructor Index

 o FileUploader()
Creates a new instance of the FileUploader class.

Method Index

 o init(IHandler)
Method from the oracle.forms.ui.IView class and overriden from the VBean base class.
 o loadFile(Object, boolean)
Facilitates the sending of a user selected file back to the Forms Server encoded using the BASE64 encoding scheme.
Enables the user to make a file selection using the standard AWT file dialog.
Optionally Zips the file
Encodes the file using the sun.misc.BASE64Encoder class.
Sends the encoded data back in segments of size CHUNKSIZE.
 o log(String)
Writes debugging messages to the Java Console when the DEBUGMESSAGES property has been set on the bean.
 o main(String[])
 o setProperty(ID, Object)
Overriding method from the IView interface.

Constructors

 o FileUploader
 public FileUploader()
Creates a new instance of the FileUploader class.

Methods

 o init
 public void init(IHandler handler)
Method from the oracle.forms.ui.IView class and overriden from the VBean base class. This lifecycle method is called once when Forms creates an instance of the JavaBean.

Parameters:
handler - a reference to the Handler class for this JavaBean.
Overrides:
init in class VBean
 o setProperty
 public boolean setProperty(ID pid,
                            Object value)
Overriding method from the IView interface. Allows the values of properties to be retrieved when called from the Oracle Forms Server runtime. This method allows the Forms Server to get both standard and custom properties. The standard properties such as FOREGROUND, FONT, etc. all have type mappings performed by the Forms engine itself so these can simply be passed from their analog accessor methods on the JavaBean. For the custom properties, sometimes type translation is required since Forms will only allow a String type as a return value for a custom property.

Parameters:
pid - the property to be retrieved, identified by it's ID
Object - the value of the requested property
Returns:
The outcome of the operation.
Overrides:
setProperty in class VBean
 o loadFile
 protected boolean loadFile(Object value,
                            boolean namedFile)
Facilitates the sending of a user selected file back to the Forms Server encoded using the BASE64 encoding scheme.
Enables the user to make a file selection using the standard AWT file dialog.
Optionally Zips the file
Encodes the file using the sun.misc.BASE64Encoder class.
Sends the encoded data back in segments of size CHUNKSIZE.

Parameters:
value - sent with the LOADFILE or LOADNAMEDFILE property from the Forms Server, used to indicate the starting directory the filedialog should use if the second argument is false, or the name of the actual file to load (bypassing dialog) if the second argument is true
namedFile - indicates that the supplied value is for a specific file to upload.
Returns:
The outcome of the operation.
 o log
 public void log(String msg)
Writes debugging messages to the Java Console when the DEBUGMESSAGES property has been set on the bean.

Parameters:
msg - the console output
 o main
 public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index