Package org.syncany.config
Class DaemonConfigHelper
- java.lang.Object
-
- org.syncany.config.DaemonConfigHelper
-
public class DaemonConfigHelper extends java.lang.Object
The daemon helper provides helper functions to read and/or write the daemon configuration file as defined byDaemonConfigTO.
-
-
Constructor Summary
Constructors Constructor Description DaemonConfigHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanaddFolder(java.io.File localDir)Adds the given folder to the user-specific daemon configuration (daemon.xml).static DaemonConfigTOcreateAndWriteDaemonConfig(java.io.File configFile, java.util.List<FolderTO> folders)static DaemonConfigTOcreateAndWriteDefaultDaemonConfig(java.io.File daemonConfigFile)static DaemonConfigTOcreateAndWriteExampleDaemonConfig(java.io.File daemonConfigFile)static UserTOgetFirstDaemonUser(DaemonConfigTO daemonConfig)static booleanremoveFolder(java.io.File localDir)static booleanremoveFolder(java.lang.String localDirIdentifier)
-
-
-
Constructor Detail
-
DaemonConfigHelper
public DaemonConfigHelper()
-
-
Method Detail
-
getFirstDaemonUser
public static UserTO getFirstDaemonUser(DaemonConfigTO daemonConfig)
-
addFolder
public static boolean addFolder(java.io.File localDir) throws ConfigException
Adds the given folder to the user-specific daemon configuration (daemon.xml).The method first reads the daemon configuration, checks if the folder is already present and adds it if it is not. If no daemon config file exists, a new default config file is created via
createAndWriteDefaultDaemonConfig(File). If the folder is already present in the current daemon config,falseis returned. If an error occurs (e.g. an I/O error or an invalid XML file), aConfigExceptionis thrown. If the folder was successfully added,trueis returned.- Parameters:
localDir- Absolute path of the local folder to add to the daemon config- Returns:
- Returns
trueif the folder was successfully added to the daemon config,falseotherwise - Throws:
ConfigException- If an error occurs, e.g. an I/O error or an invalid XML file
-
removeFolder
public static boolean removeFolder(java.io.File localDir) throws ConfigException
- Throws:
ConfigException
-
removeFolder
public static boolean removeFolder(java.lang.String localDirIdentifier) throws ConfigException
- Throws:
ConfigException
-
createAndWriteDefaultDaemonConfig
public static DaemonConfigTO createAndWriteDefaultDaemonConfig(java.io.File daemonConfigFile) throws ConfigException
- Throws:
ConfigException
-
createAndWriteExampleDaemonConfig
public static DaemonConfigTO createAndWriteExampleDaemonConfig(java.io.File daemonConfigFile) throws ConfigException
- Throws:
ConfigException
-
createAndWriteDaemonConfig
public static DaemonConfigTO createAndWriteDaemonConfig(java.io.File configFile, java.util.List<FolderTO> folders) throws ConfigException
- Throws:
ConfigException
-
-