io.bdeploy.common.cfg.MinionRootValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api Show documentation
Show all versions of api Show documentation
Public API including dependencies, ready to be used for integrations and plugins.
package io.bdeploy.common.cfg;
import java.nio.file.Files;
import java.nio.file.Path;
import io.bdeploy.common.cfg.Configuration.ValidationMessage;
/**
* Checks if the given {@link Path} exists and contains either the file etc/state.json
or
* etc/state.json.bak
.
*/
@ValidationMessage("Path is not an initialized BDeploy root directory, run 'bdeploy init': %s")
public class MinionRootValidator extends ExistingDirectoryValidator {
@Override
public boolean test(String value) {
return super.test(value) && (isRegularFile("etc/state.json") || isRegularFile("etc/state.json.bak"));
}
private boolean isRegularFile(String s) {
return Files.isRegularFile(p.resolve(s));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy