You are here: Home News & Events Development Update Development Update December 2007
Document Actions

Development Update December 2007

'Hydra4GL' 4.3 supports static and dynamic media resource files. Below is some information to clarify the differences and also offer explanations of some functions used to manage the dynamic resource contents.

File Resource Management

Different to classic text clients, graphical clients require additional resources such as images, documents and other files.

Examples could be  ‘.ico’ files for the graphical toolbar or button images, or an MS-Excel document which will be used for DDE (Dynamic Data Exchange) between the graphical client and the application server.

Storage location on the Application Server:

All media resource files must be located in the main application folder (or below). All file references within 4GL, script, forms etc., must include a relative path from the applications root/main folder.

The resource files can be categorized in two groups: Statically (constantly available for the client – files will not change during a session/process) and dynamically (available on request / JIT Download i.e. from a SQL query BLOB request).

Static resource files

Static resource files reside on the application server and are referenced in a script file. If you use 'HydraStudio', any resource files included in the project tree will be referenced in the master script file automatically by 'HydraStudio'. In this case, you should not modify the master script file. Any changes will be overwritten when the application is launched within 'HydraStudio'.

Should you not use 'HydraStudio', you have to create file references within the master script file yourself. The following script line would invoke the server to send the file pic.jpg to the clients cache folder at application start.

 %using "[file]pic.jpg"

Client static resource cache folder

When a GUI client runs an application, all referenced resource files will be downloaded from the server to the GUI client's ‘cache’ directory.

Phoenix: C:\Documents and Settings\<user name>\Local Settings\ Temp\Phoenix_cache

Chimera: C:\Documents and Settings\<user name>\Local Settings\ Temp\Chimera_cache

Cache version control for static recource files

The static resource files are controlled by a cache version controller and may even have a different physical file name (Phoenix). Within the 4GL/form code, you always use the original file name relative to the program/project root directory. Should it be required to pass on a file name from the GUI client cache folder to a different/external application, it is required to query the real physical file name by using the function:

 CALL fgl_getproperty("gui", "system.file.cachename", “<filename>”).

Large amounts of static media files also require some processing time for the cache version control at application start up. To overcome this, the cache control can be turned off.

 gui.lazy_cache = TRUE

With this fglprofile value set as TRUE the client resource, when loading Phoenix, will check the timestamp of the main script file as opposed to all the resource files. If this main script file is deemed to be the latest copy, all other resource files are assumed unchanged and the application loads in accordance with these files. Where the script file is not deemed to be the latest version, or this fglprofile setting is FALSE, the application will continue to check the timestamp of all resource files before loading the latest.

Dynamic Resource files

Dynamic resource files must also be located on the application server and can be downloaded (and uploaded from the client to the server) to the client on request by using the functions fgl_download() / fgl_upload(). Should you work with database blob data, you would still query the database for the blob which would create the blob file on the application server.

LOCATE my_blob IN FILE blob_file_path

During the GUI client deployment, a sub-folder called: Phoenix_temp / Chimera_temp is created. The correct & complete path can be queried at runtime by using the function:

CALL fgl_getproperty(“gui”, “system.file.client_temp”, “”)

The developer can use this folder to keep and manage files required by the GUI client or any other external application.

An example would be querying the database for a MS-Excel BLOB document, storing it temporary at the application server and downloading it to the GUI client's temporary directory, invoking MS-Exel with this document and transfering some dynamic data from the application to the Excel document, printing it, uploading this modified document and storing it in the database (document manager).