Package org.refcodes.daemon
Class AbstractDaemon
- java.lang.Object
-
- org.refcodes.daemon.AbstractDaemon
-
public abstract class AbstractDaemon extends Object
The Class AbstractDaemon.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
EXIT_CANNOT_LOAD_RUNTIME_PROPERTIES
protected static int
EXIT_CANNOT_OPEN_MANAGEMENT_SERVER
protected static int
EXIT_CANNOT_SAVE_RUNTIME_PROPERTIES
protected static int
EXIT_CODE_ALREADY_STARTED
protected static int
EXIT_CODE_NOT_RUNNING
protected static int
EXIT_CODE_NOT_STARTED
protected static int
EXIT_CODE_OK
-
Constructor Summary
Constructors Constructor Description AbstractDaemon()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static void
doRestart()
Do restart.protected static void
doShutdown()
Do shutdown.protected static void
doShutdown(org.refcodes.daemon.AbstractDaemon.ShutDownMode aShutDowenMode)
Do shutdown.protected static void
doStartup()
Do startup.protected static void
doStartup(String aConfigFileName)
Do startup.protected static String
getBaseConfigFileName()
Determines the best fit for a base configuration file name.protected static org.refcodes.configuration.Properties
toConfigurationProperties(String aConfigFileName)
To configuration properties.protected static File
toRuntimePropertiesFile()
To runtime properties file.protected static File
writeConfigFile(String aConfigFileName)
Writes out a sample configuration file located in the root of your resources folder.
-
-
-
Field Detail
-
EXIT_CODE_OK
protected static final int EXIT_CODE_OK
- See Also:
- Constant Field Values
-
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
-
-
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.
-
-