Class Win2kServiceFailureActions

  • All Implemented Interfaces:
    PropertyAccessible

    public class Win2kServiceFailureActions
    extends java.lang.Object
    implements PropertyAccessible
    This class is strictly a data class. It holds the service failure action data for a service. It includes an array of Win2kSCAction objects as well as a reboot message, command, and a resetPeriod. See the Win32 API documentation for the SERVICE_FAILURE_ACTIONS structure for more detail.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int INFINITE
      Can be used for the resetPeriod property.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAction​(Win2kSCAction action)
      Adds the specified action at the end of the actions already defined.
      Win2kSCAction getActionAt​(int index)
      Returns the Win2kSCAction object at the specified index or null if the index is invalid.
      int getActionCount()
      Returns the number of actions currently defined.
      Win2kSCAction[] getActions()
      Returns the actions that the Service Control Manager will execute when the service fails.
      java.lang.String getCommand()
      Returns the unresolved command assigned to this object.
      java.lang.String getRebootMsg()
      Returns the unresolved message to be broadcast to server users before the Service Control Manager reboots the machine.
      int getResetPeriod()
      Returns the resetPeriod for this object.
      void removeActionAt​(int index)
      Removes the action at the specified index.
      Win2kServiceFailureActions resolve​(StringResolver resolver)
      Resolves the rebootMsg and the command properties in this object using the services passed in.
      void setActions​(Win2kSCAction[] actions)
      Sets zero or more failure actions that the Service Control Manager should execute when this service fails.
      void setCommand​(java.lang.String command)
      Specifies the command to be executed by the Service Control Manager if the action specifies to run a command.
      void setRebootMsg​(java.lang.String rebootMsg)
      Sets the message that is broadcast to server users before the machine is rebooted (if a reboot failure action is added).
      void setResetPeriod​(int resetPeriod)
      Sets the resetPeriod for this object.
      java.lang.String toString()
      Returns an English string representation of this object which is displayed in the IDE.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • INFINITE

        public static final int INFINITE
        Can be used for the resetPeriod property.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Win2kServiceFailureActions

        public Win2kServiceFailureActions()
        Constructs a new instance of a Win2kServiceFailureActions object with properties set to default values.
      • Win2kServiceFailureActions

        public Win2kServiceFailureActions​(Win2kServiceFailureActions copyFrom)
        Makes a deep copy of an existing Win2kServiceFailureActions object.
        Parameters:
        copyFrom - The existing object to copy
    • Method Detail

      • toString

        public java.lang.String toString()
        Returns an English string representation of this object which is displayed in the IDE.
        Overrides:
        toString in class java.lang.Object
      • setResetPeriod

        public void setResetPeriod​(int resetPeriod)
        Sets the resetPeriod for this object. This is the length of time in seconds after the last time this service failed that the Service Control Manager will reset the failure count for the service.
        Parameters:
        resetPeriod - Number of seconds (or INFINITE if the SCM should never reset the count).
      • getResetPeriod

        public int getResetPeriod()
        Returns the resetPeriod for this object.
      • setRebootMsg

        public void setRebootMsg​(java.lang.String rebootMsg)
        Sets the message that is broadcast to server users before the machine is rebooted (if a reboot failure action is added). This message is resolved at install time.
        Parameters:
        The - reboot messgae or a blank string if no message should be broadcast
      • getRebootMsg

        public java.lang.String getRebootMsg()
        Returns the unresolved message to be broadcast to server users before the Service Control Manager reboots the machine.
      • setCommand

        public void setCommand​(java.lang.String command)
        Specifies the command to be executed by the Service Control Manager if the action specifies to run a command. The command is resolved at install time.
        Parameters:
        command - The command executed by the Service Control Manager
      • getCommand

        public java.lang.String getCommand()
        Returns the unresolved command assigned to this object.
      • setActions

        public void setActions​(Win2kSCAction[] actions)
        Sets zero or more failure actions that the Service Control Manager should execute when this service fails. The first time it fails, the SCM executes the first action. The second time it fails, it executes the second action, etc...

        Service failure is defined as anytime the service terminates without first reporting a SERVICE_STOPPED status to the SCM.

      • getActions

        public Win2kSCAction[] getActions()
        Returns the actions that the Service Control Manager will execute when the service fails.
      • getActionCount

        public int getActionCount()
        Returns the number of actions currently defined.
      • getActionAt

        public Win2kSCAction getActionAt​(int index)
        Returns the Win2kSCAction object at the specified index or null if the index is invalid.
      • removeActionAt

        public void removeActionAt​(int index)
        Removes the action at the specified index. It does nothing if the index is invalid.
      • addAction

        public void addAction​(Win2kSCAction action)
        Adds the specified action at the end of the actions already defined.
      • resolve

        public Win2kServiceFailureActions resolve​(StringResolver resolver)
        Resolves the rebootMsg and the command properties in this object using the services passed in.
        Parameters:
        services - Used to call resolveString to resolve the properties