Carapace

NtService Class

To provide an NT service using Carapace you need to define a class which incorporates the particular functionality you require. This class must be called NtService and have at least the following methods and properties etc.

    (class NtService

        (interface

            (properties
                
                (name String)
                (log Log)
            )

            (methods

                (NIL NtService ( (nm String) ) )
                (NIL run ( (args String) ) )
                (NIL stop ( (gracePeriod Integer) ) )
                (NIL shutdown ( (gracePeriod Integer) ) )
            )
        )
    )
To see a simple example of a Carapace service class, click here

Each property and method is defined below:

NtService Properties

An NtService class must supports the following properties:

property name property type description
name String the name of the NT Service
log Log a log file for the NT Service - since services do not have a user interface, the log provides a way to see what the service has been doing

NtService Methods

An NtService class must support the following methods:

method name description
NtService this is the initialisation function which sets up the object - it must store the supplied name in its name property, and make the log property hold a Log object
run this is the function which provides the service - NOTE: when this function finishes, the service has stopped
stop this function is called when the administrator or system wishes to stop the service - the argument is the time allowed to stop (seconds)
shutdown this function is called when the system wishes to shutdown the service - the argument is the time allowed to stop (seconds)


Contents Index Current topic: NT Services Related topics: objects