project BLF > class BBaseDaemon > method AdditionalUpdates

Description

This method is part of the SetPublicTables flow.
When executed, data in the input class tables (prefix t_s) is validated and found correct, and copied into the class tables (prefix t_o).
This method can be extended to do updates that do not require a validation or that involve running business methods of other business classes. These classes should be started with ADD-TO-TRANSACTION = 'true'. Also make sure to add these classes in method StopExternalInstances.


Parameters


oiReturnStatusoutputinteger


Internal usage


BLF
method BBaseDaemon.ApiValidateStatus
method BBaseDaemon.ControlDaemon
method BEventDaemon.ApiUpdate
method BReportDaemon.UpdateSocketInformation
method BScanDaemon.ApiUpdateDaemonConfiguration
method BXmlDaemon.ApiUpdate


program code (program/bbasedaemon.p)

<ANCESTOR-CODE>

/* ================================================================= */
/* Encode the password                                               */
/* ================================================================= */

for each tfcDaemon where
         tfcDaemon.tc_Status = "N":U on error undo, throw:
         
    if vhCrypthandle = ?
    then do:
        <M-9 run MainBlock  () in TCrypt>
        vhCrypthandle = vhFcComponent.
    end.
    
    vhFcComponent = vhCrypthandle.
    <M-90 run EncryptString
       (input  tfcDaemon.DaemonPassword (icInputString), 
        output tfcDaemon.DaemonPassword (ocOutputString), 
        output viFcReturnSuper (oiReturnStatus)) in TCrypt>   
    if viFcReturnSuper <> 0
    and oiReturnStatus >= 0
    then assign oiReturnStatus = viFcReturnSuper.
end.

for each tfcDaemon where
         tfcDaemon.tc_Status = "C":U,
    each t_ifcDaemon where
         t_ifcDaemon.tc_Rowid = tfcDaemon.tc_Rowid and
         t_ifcDaemon.DaemonPassword <> tfcDaemon.DaemonPassword on error undo, throw:
         
    if vhCrypthandle = ?
    then do:
        <M-21 run MainBlock  () in TCrypt>
        vhCrypthandle = vhFcComponent.
    end.
    
    vhFcComponent = vhCrypthandle.
    <M-89 run EncryptString
       (input  tfcDaemon.DaemonPassword (icInputString), 
        output tfcDaemon.DaemonPassword (ocOutputString), 
        output viFcReturnSuper (oiReturnStatus)) in TCrypt>   
    if viFcReturnSuper <> 0
    and oiReturnStatus >= 0
    then assign oiReturnStatus = viFcReturnSuper.
end.

/* ========================================================================== */
/* Only a single record should be available representing a certain daemon     */
/* ========================================================================== */
<Q-1 run DaemonPrim (all)  (Read)  (NoCache)  (input vcFcDaemonName, (DaemonName) 
                     input ?, (DaemonId)
                     output dataset tqDaemonPrim) in BBaseDaemon >
find first tqDaemonPrim where 
           tqDaemonPrim.tcDaemonName = vcFcDaemonName
           no-lock no-error.
if available tqDaemonPrim 
then do :
    find first tfcDaemon where 
               tfcDaemon.DaemonName  = vcFcDaemonName and 
               tfcDaemon.tc_Status  <> "D":U            and
               tfcDaemon.tc_Rowid   <> tqDaemonPrim.tc_rowid
               no-lock no-error.
    if available tfcDaemon
    then do :
        assign oiReturnStatus = -1
               vcDaemonMsg = trim(#T-3'Unable to store multiple definitions for the '$1' daemon. Only 1 record should keep the settings for this daemon.':255(65)T-3#).
        <M-2 run SetMessage
          (input  vcDaemonMsg (icMessage), 
           input  vcFcDaemonName (icArguments), 
           input  'tfcDaemon.DaemonName':U (icFieldName), 
           input  tfcDaemon.DaemonName (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  tfcDaemon.tc_Rowid (icRowid), 
           input  'BLF-3':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BBaseDaemon>
        Return. 
    end. /* if available tfcDaemon */
end. /* if available tqDaemonPrim and */

finally:
    if vhCrypthandle <> ?
    then do:
        run gipr_DeleteProcedure in vhCrypthandle.
        delete procedure vhCrypthandle.
    end.
end finally.