project BLF > class TApplication > method CallDaemon
Description
Call daemon methods ApiStart, ApiStop and ApiUnconditionalStop in a generic way. The daemon name is sent as input together with the method that needs to be executed.
Parameters
icDaemonBCName | input | character | BC name of the daemon |
icMethod | input | character | Name of the method to be executed |
ocMessage | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/tapplication.p)
&scoped-define INS-PROCEDURE-BBASEDAEMON "ins/ins__" + lc(icDaemonBCName) + ".p"
/* generic start of the daemon instance */
SOblock: do:
<I-1 {tFcStartAndOpenInstance
&CLASS = "BBaseDaemon"
&ERROR-STATEMENT = "vlStartError = yes. leave SOblock."
&SESSIONID = "0"}>
end.
if vlStartError
then do:
assign ocMessage = substitute(trim(#T-3'Unable to start component &1.':255(5151)T-3#),icDaemonBCName)
oiReturnStatus = -1.
return.
end.
case icMethod :
when "ApiStart"
then do :
<M-5 run APIStart (output viFcReturnSuper (oiReturnStatus)) in BBaseDaemon>
if viFcReturnSuper < 0
then do :
assign ocMessage = substitute(trim(#T-6'You do not have write permissions for this log file.':100(5198)t-6#),icDaemonBCName)
oiReturnStatus = viFcReturnSuper.
end.
end.
when "ApiStop"
then do :
<M-9 run APIStop (output viFcReturnSuper (oiReturnStatus)) in BBaseDaemon>
if viFcReturnSuper < 0
then do :
assign ocMessage = substitute(trim(#T-8'The directory for the log file is not valid.':255(5199)t-8#),icDaemonBCName)
oiReturnStatus = viFcReturnSuper.
end.
end.
when "ApiUnconditionalStop"
then do :
<M-12 run ApiUnconditionalStop (output viFcReturnSuper (oiReturnStatus)) in BBaseDaemon>
if viFcReturnSuper < 0
then do :
assign ocMessage = substitute(trim(#T-11'Error reading the information for ENVAPPSERVERURL from server.xml':255(5200)t-11#),icDaemonBCName)
oiReturnStatus = viFcReturnSuper.
end.
end.
end case.
<I-4 {tFcCloseAndStopInstance
&CLASS = "BBaseDaemon"}>