public Halconfig getConfig() { return halconfigParser.getHalconfig(); }
public Halconfig getConfig() { return halconfigParser.getHalconfig(); }
/** * Given a node filter and a node type, find all nodes that match both the filter and the type of the Node. * @param filter is the filter to lookup by. * @param clazz is the class of the node type we want to find. * @return the nodes matching the filter and clazz. */ public <T extends Node> List<T> getMatchingNodesOfType(NodeFilter filter, Class<T> clazz) { Halconfig halconfig = parser.getHalconfig(); return getMatchingNodes(halconfig, filter) .stream() .filter(clazz::isInstance) .map(n -> (T) n) .collect(Collectors.toList()); }
/** * Given a node filter and a node type, find all nodes that match both the filter and the type of the Node. * @param filter is the filter to lookup by. * @param clazz is the class of the node type we want to find. * @return the nodes matching the filter and clazz. */ public <T extends Node> List<T> getMatchingNodesOfType(NodeFilter filter, Class<T> clazz) { Halconfig halconfig = parser.getHalconfig(); return getMatchingNodes(halconfig, filter) .stream() .filter(clazz::isInstance) .map(n -> (T) n) .collect(Collectors.toList()); }
public void backupConfig() { // It's possible we are asked to backup the halconfig without having loaded it first. boolean backup = useBackup; useBackup = false; getHalconfig(); useBackup = backup; saveConfigTo(halconfigDirectoryStructure.getBackupConfigPath()); }
public void backupConfig() { // It's possible we are asked to backup the halconfig without having loaded it first. boolean backup = useBackup; useBackup = false; getHalconfig(); useBackup = backup; saveConfigTo(halconfigDirectoryStructure.getBackupConfigPath()); }
public void setDeploymentConfiguration(String deploymentName, DeploymentConfiguration deploymentConfiguration) { Halconfig halconfig = halconfigParser.getHalconfig(); List<DeploymentConfiguration> deploymentConfigurations = halconfig.getDeploymentConfigurations(); int matchingIndex = -1; for (int i = 0; i < deploymentConfigurations.size(); i++) { DeploymentConfiguration test = deploymentConfigurations.get(i); if (test.getName().equals(deploymentName)) { matchingIndex = i; break; } } if (matchingIndex < 0) { throw new HalException(Severity.FATAL, "Could not find a deployment with name " + deploymentName); } else { deploymentConfigurations.set(matchingIndex, deploymentConfiguration); } }
public void setDeploymentConfiguration(String deploymentName, DeploymentConfiguration deploymentConfiguration) { Halconfig halconfig = halconfigParser.getHalconfig(); List<DeploymentConfiguration> deploymentConfigurations = halconfig.getDeploymentConfigurations(); int matchingIndex = -1; for (int i = 0; i < deploymentConfigurations.size(); i++) { DeploymentConfiguration test = deploymentConfigurations.get(i); if (test.getName().equals(deploymentName)) { matchingIndex = i; break; } } if (matchingIndex < 0) { throw new HalException(Severity.FATAL, "Could not find a deployment with name " + deploymentName); } else { deploymentConfigurations.set(matchingIndex, deploymentConfiguration); } }
return; Halconfig halconfig = getHalconfig(); Set<String> referencedFiles = new HashSet<String>(); Consumer<Node> fileFinder = n -> referencedFiles.addAll(n.localFiles().stream().map(f -> {
return; Halconfig halconfig = getHalconfig(); Set<String> referencedFiles = new HashSet<String>(); Consumer<Node> fileFinder = n -> referencedFiles.addAll(n.localFiles().stream().map(f -> {
public String create() { String halconfigDir = directoryStructure.getHalconfigDirectory(); halconfigParser.backupConfig(); Halconfig halconfig = halconfigParser.getHalconfig(); halconfig.backupLocalFiles(directoryStructure.getBackupConfigDependenciesPath().toString()); halconfig.makeLocalFilesRelative(halconfigDir); halconfigParser.saveConfig(); String tarOutputName = String.format("halbackup-%s.tar", new Date()).replace(" ", "_").replace(":", "-"); String halconfigTar = Paths.get(System.getProperty("user.home"), tarOutputName).toString(); try { tarHalconfig(halconfigDir, halconfigTar); } catch (IOException e) { throw new HalException(Problem.Severity.FATAL, "Unable to safely backup halconfig " + e.getMessage(), e); } finally { halconfigParser.switchToBackupConfig(); halconfigParser.getHalconfig(); halconfigParser.saveConfig(); halconfigParser.switchToPrimaryConfig(); } return halconfigTar; }
public String create() { String halconfigDir = directoryStructure.getHalconfigDirectory(); halconfigParser.backupConfig(); Halconfig halconfig = halconfigParser.getHalconfig(); halconfig.backupLocalFiles(directoryStructure.getBackupConfigDependenciesPath().toString()); halconfig.makeLocalFilesRelative(halconfigDir); halconfigParser.saveConfig(); String tarOutputName = String.format("halbackup-%s.tar", new Date()).replace(" ", "_").replace(":", "-"); String halconfigTar = Paths.get(System.getProperty("user.home"), tarOutputName).toString(); try { tarHalconfig(halconfigDir, halconfigTar); } catch (IOException e) { throw new HalException(Problem.Severity.FATAL, "Unable to safely backup halconfig " + e.getMessage(), e); } finally { halconfigParser.switchToBackupConfig(); halconfigParser.getHalconfig(); halconfigParser.saveConfig(); halconfigParser.switchToPrimaryConfig(); } return halconfigTar; }
public void restore(String backupTar) { String halconfigDir = directoryStructure.getHalconfigDirectory(); untarHalconfig(halconfigDir, backupTar); Halconfig halconfig = halconfigParser.getHalconfig(); halconfig.makeLocalFilesAbsolute(halconfigDir); halconfigParser.saveConfig(); }
ProblemSet validateMatchingFilter(NodeFilter filter) { DaemonTaskHandler.newStage("Running validation"); Halconfig halconfig = parser.getHalconfig(); ConfigProblemSetBuilder psBuilder = new ConfigProblemSetBuilder(applicationContext); recursiveValidate(psBuilder, halconfig, filter); return psBuilder.build(); }
ProblemSet validateMatchingFilter(NodeFilter filter) { DaemonTaskHandler.newStage("Running validation"); Halconfig halconfig = parser.getHalconfig(); ConfigProblemSetBuilder psBuilder = new ConfigProblemSetBuilder(applicationContext); recursiveValidate(psBuilder, halconfig, filter); return psBuilder.build(); }
public void restore(String backupTar) { String halconfigDir = directoryStructure.getHalconfigDirectory(); untarHalconfig(halconfigDir, backupTar); Halconfig halconfig = halconfigParser.getHalconfig(); halconfig.makeLocalFilesAbsolute(halconfigDir); halconfigParser.saveConfig(); }