use of org.apache.asterix.event.schema.cluster.WorkingDir in project asterixdb by apache.
the class ConfigureConfig method configureCluster.
private void configureCluster(String dir, String file) throws JAXBException, PropertyException, FileNotFoundException {
String clusterDir = InstallerDriver.getManagixHome() + File.separator + "clusters" + File.separator + dir;
String localClusterPath = clusterDir + File.separator + file;
if (!Files.exists(Paths.get(localClusterPath))) {
return;
}
Cluster cluster = EventUtil.getCluster(localClusterPath);
String workingDir = clusterDir + File.separator + "working_dir";
cluster.setWorkingDir(new WorkingDir(workingDir, true));
cluster.setIodevices(configureIoDevices(cluster.getIodevices(), workingDir));
cluster.setLogDir(configureDirectory(cluster.getLogDir(), workingDir));
cluster.setTxnLogDir(configureDirectory(cluster.getTxnLogDir(), workingDir));
String javaHome = System.getProperty("java.home");
if (javaHome.endsWith(File.separator + "jre")) {
javaHome = javaHome.substring(0, javaHome.indexOf(File.separator + "jre"));
}
cluster.setJavaHome(javaHome);
for (Node node : cluster.getNode()) {
node.setIodevices(configureIoDevices(node.getIodevices(), workingDir));
node.setLogDir(configureDirectory(node.getLogDir(), workingDir));
node.setTxnLogDir(configureDirectory(node.getTxnLogDir(), workingDir));
}
JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
Marshaller marshaller = ctx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(cluster, new FileOutputStream(localClusterPath));
}
Aggregations