Class AbstractDaemon



  • public abstract class AbstractDaemon
    extends Object
    The Class AbstractDaemon.
    • Field Detail

      • EXIT_CODE_ALREADY_STARTED

        protected static final int EXIT_CODE_ALREADY_STARTED
        See Also:
        Constant Field Values
      • EXIT_CODE_NOT_RUNNING

        protected static final int EXIT_CODE_NOT_RUNNING
        See Also:
        Constant Field Values
      • EXIT_CANNOT_OPEN_MANAGEMENT_SERVER

        protected static final int EXIT_CANNOT_OPEN_MANAGEMENT_SERVER
        See Also:
        Constant Field Values
      • EXIT_CANNOT_SAVE_RUNTIME_PROPERTIES

        protected static final int EXIT_CANNOT_SAVE_RUNTIME_PROPERTIES
        See Also:
        Constant Field Values
      • EXIT_CANNOT_LOAD_RUNTIME_PROPERTIES

        protected static final int EXIT_CANNOT_LOAD_RUNTIME_PROPERTIES
        See Also:
        Constant Field Values
      • EXIT_CODE_NOT_STARTED

        protected static final int EXIT_CODE_NOT_STARTED
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractDaemon

        public AbstractDaemon​()
    • Method Detail

      • doRestart

        protected static void doRestart​()
        Do restart.
      • doStartup

        protected static void doStartup​()
        Do startup.
      • doStartup

        protected static void doStartup​(String aConfigFileName)
        Do startup.
        Parameters:
        aConfigFileName - the config file name
      • doShutdown

        protected static void doShutdown​()
        Do shutdown.
      • doShutdown

        protected static void doShutdown​(org.refcodes.daemon.AbstractDaemon.ShutDownMode aShutDowenMode)
        Do shutdown.
        Parameters:
        aShutDowenMode - the shut dowen mode
      • toRuntimePropertiesFile

        protected static File toRuntimePropertiesFile​()
        To runtime properties file.
        Returns:
        the file
      • getBaseConfigFileName

        protected static String getBaseConfigFileName​()
        Determines the best fit for a base configuration file name.
        Returns:
        The fest fit file name.
      • toConfigurationProperties

        protected static org.refcodes.configuration.Properties toConfigurationProperties​(String aConfigFileName)
                                                                                  throws IOException,
                                                                                         ParseException
        To configuration properties.
        Parameters:
        aConfigFileName - the config file name
        Returns:
        the properties
        Throws:
        IOException - thrown in case accessing or processing the properties file failed.
        ParseException - Signals that an error has been reached unexpectedly while parsing the data to be loaded.
      • writeConfigFile

        protected static File writeConfigFile​(String aConfigFileName)
                                       throws FileAlreadyExistsException,
                                              IOException
        Writes out a sample configuration file located in the root of your resources folder.
        Parameters:
        aConfigFileName - The file name of the configuration file found in your resources folder.
        Returns:
        The File with the sample configuration.
        Throws:
        FileAlreadyExistsException - Thrown in case an according configuration file already exists.
        IOException - Thrown in case there were problems writing out the file.