project BLF > class TDaemonUtility > method GetFileType


Parameters


icDaemonNameinputcharacter
icFileNameinputcharacterName of the file that needs to be checked.
icDaemonAppserverUrlinputcharacterAppserver connection URL for the daemon. This parameter is ONLY filled in when the call to this method is done before the AppServer URL can be retrieved from the daemon query. Typical case is the validation of the daemon configuration.If this parameter is not supplied, then the appserver connection is taken from the internal record that contains the daemon configuration (fcDaemon).
ocFileTypeoutputcharacterFile type of the file specified in icFileName. This is the value returned by file-info:file-type.
ocMessageoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BBaseDaemon.ValidateDirectories
method BEventDestination.ValidateComponent
method BScanDaemon.ValidateDirectoriesLocation
method BXmlDaemon.ValidateDirectories


program code (program1/tdaemonutility.p)

assign oiReturnStatus = -98.

<M-12 run GetAppserverConnection
   (input  icDaemonName (icDaemonName), 
    input  icDaemonAppserverUrl (icDaemonAppserverURL), 
    output vhAppserver (ohDaemonAppserver), 
    output vcMessage (ocMessage), 
    output viFcReturnSuper (oiReturnStatus)) in TDaemonUtility>

if viFcReturnSuper < 0
then do:
    assign oiReturnStatus = viFcReturnSuper
           ocMessage = vcMessage.
    return.
end.
    
if valid-handle(vhAppserver) and vhAppserver:connected()
then do:
    /* ================================================================= */
    /* run daemon on appserver                                           */
    /* ================================================================= */
    run program/tdaemonutility.p persistent set vhFcComponent on vhAppserver (input viSessionID).
    run GetFileTypeInternal in vhFcComponent
       (input icFileName,
        output ocFileType,
        output oiReturnStatus).
    run gipr_DeleteProcedure in vhFcComponent.
    delete procedure vhFcComponent.
    vhAppserver:disconnect().
    delete object vhAppserver.
end.
else do:
    /* ================================================================= */
    /* call method locally                                               */
    /* ================================================================= */
    <M-11 run GetFileTypeInternal
       (input  icFileName (icFileName), 
        output ocFileType (ocFileType), 
        output oiReturnStatus (oiReturnStatus)) in TDaemonUtility>
end.

assign ocMessage = vcMessage.

if oiReturnStatus = -98
then assign oiReturnStatus = 0.