DaemonApp unit
Daemon (service) application class.
The daemonapp unit implements a TApplication class
which encapsulates a daemon or service application. It handles installation
where this is necessary, and does instantiation of the various daemons where necessary.
The unit consists of 3 separate classes which cooperate tightly:
- TDaemon
- This is a class that implements the daemon's functionality. One or more descendents of this class can be implemented and instantiated in a single daemon application. For more information, see TDaemon.
- TDaemonApplication
- This is the actual daemon application class. A global instance of this class is instantiated. It handles the command-line arguments, and instantiates the various daemons. For more information, see TDaemonApplication.
- TDaemonDef
- This class defines the daemon in the operation system. The
TDaemonApplicationclass has a collection ofTDaemonDefinstances, which it uses to start the various daemons. For more information, see TDaemonDef.
As can be seen, a single application can implement one ore more daemons (services). Each daemon will be run in a separate thread which is controlled by the application class.
The classes take care of logging through the TEventLog class.
Many options are needed only to make the application behave as a windows service application on windows. These options are ignored in UNIX-like environment. The documentation will mention this.
Classes and records
EDaemon | class | Exception used in all daemon application code. |
TCustomDaemon | class | Base daemon application class. |
TCustomDaemonApplication | class | Custom daemon application class. |
TCustomDaemonMapper | class | Daemon mapper. |
TDaemon | class | Daemon class for visual development. |
TDaemonApplication | class | Default descendent of CustomDaemonApplication. |
TDaemonController | class | Internal daemon controller class. |
TDaemonDef | class | Daemon definition. |
TDaemonDefs | class | Collection of daemon definitions. |
TDaemonMapper | class | Daemon mapper for designing in IDE. |
TDaemonThread | class | Thread to run daemons in. |
TDependencies | class | Dependencies collection for a daemon. |
TDependency | class | Container to define dependencies on other services. |
TWinBindings | class | Windows Daemon bindings (windows only). |
Procedures and functions
Application | function | Application instance. |
DaemonError | procedure | Raise an EDaemon exception. |
RegisterDaemonApplicationClass | procedure | Register alternative TCustomDaemonApplication class. |
RegisterDaemonClass | procedure | Register daemon. |
RegisterDaemonMapper | procedure | Register a daemon mapper class. |
Types
TCurrentStatus | enumeration | Current daemon status. |
TCustomControlCodeEvent | procedure type | Prototype for event to handle a custom control code. |
TCustomControlCodeEvEvent | procedure type | |
TCustomDaemonApplicationClass | type | Class pointer for TCustomDaemonApplication. |
TCustomDaemonClass | type | Class type for TCustomDaemon. |
TCustomDaemonMapperClass | type | Class of TCustomDaemonMapper. |
TDaemonClass | type | Class type of TDaemon. |
TDaemonEvent | procedure type | Daemon event handler prototype. |
TDaemonOKEvent | procedure type | Daemon acknowledgement event handler. |
TDaemonOption | enumeration | Daemon options. |
TDaemonOptions | set | Set of options. |
TDaemonRunMode | enumeration | Daemon application run mode. |
TErrorSeverity | enumeration | Severity of a startup error (Windows only). |
TGuiLoopEvent | procedure type | GUI loop event mechanism. |
TServiceType | enumeration | Type of service (Windows only). |
TStartType | enumeration | When should the daemon be started (windows only). |
TWinControlCode | enumeration | |
TWinControlCodes | set |
Resource strings
SControlFailed | resource string | The control code was not handled correctly. |
SCustomCode | resource string | A custom code was received. |
SDaemonStatus | resource string | Daemon status report log message. |
SErrApplicationAlreadyCreated | resource string | A second application instance is created. |
SErrDaemonStartFailed | resource string | The application failed to start the daemon. |
SErrDuplicateName | resource string | Duplicate service name. |
SErrNoDaemonDefForStatus | resource string | Internal error: no daemon definition to report status for. |
SErrNoDaemonForStatus | resource string | Internal error: no daemon to report status for. |
SErrNoServiceMapper | resource string | No service mapper was found. |
SErrNothingToDo | resource string | No operation can be performed. |
SErrOnlyOneMapperAllowed | resource string | An attempt was made to install a second service mapper. |
SErrServiceManagerStartFailed | resource string | Unable to start or contact the service manager. |
SErrUnknownDaemonClass | resource string | Unknown daemon class requested. |
SErrWindowClass | resource string | Could not register window class. |
SHelpCommand | resource string | Options message displayed when writing help to the console. |
SHelpInstall | resource string | Install option message displayed when writing help to the console. |
SHelpRun | resource string | Run option message displayed when writing help to the console. |
SHelpUnInstall | resource string | Uninstall option message displayed when writing help to the console. |
SHelpUsage | resource string | Usage message displayed when writing help to the console. |
Variables
AppClass | variable | Default class used when creating the application instance. |
CurrentStatusNames | variable | Names for various service statuses. |
DefaultDaemonOptions | variable | Default daemon options. |
SStatus | variable | Status message. |
Uses
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
