private void step3() { if (keyPair[0] == null) { MsgBox.warning(shell, "You have to load a server key pair."); return; } if (keyPair[1] == null) { MsgBox.warning(shell, "You have to load an admin key pair."); return; } builder.serverKeyPair = keyPair[0]; builder.adminKeyPair = keyPair[1]; File parent = builder.configFile.getAbsoluteFile().getParentFile(); if (!parent.exists() && parent.mkdirs()) { shell.setVisible(false); MsgBox.error(shell, "Failed to create directory: " + parent.getAbsolutePath()); shell.dispose(); return; } ServerConfigManager cm = new ServerConfigManager(builder, null); try { cm.save(); } catch (IOException ex) { shell.setVisible(false); MsgBox.error(shell, "Failed to save to file: " + ex.getMessage()); shell.dispose(); return; } shell.setVisible(false); MsgBox.info(shell, "Configuration was written successfuly."); shell.dispose(); }
private void step2() { builder.serverInfo.name = serverNameT.getText(); builder.serverInfo.blockSize = optionsInt[blockSizeC.getSelectionIndex()]; builder.virtualDiskBlocks = Integer.parseInt(diskBlocksT.getText()); builder.serverInfo.minimumBlocks = Integer.parseInt(minBlocksT.getText()); builder.serverInfo.maximumBlocks = Integer.parseInt(diskBlocksT.getText()); builder.port = Integer.parseInt(portT.getText()); builder.serverInfo.checkInTime = Integer.parseInt(checkInTimeT.getText()); builder.threadPoolOptions = ThreadPoolOptions.fromString(threadPoolT.getText()); builder.databaseUrl = databaseUrlT.getText(); builder.databaseUser = databaseUserT.getText(); builder.databasePassword = databasePasswordT.getText(); builder.firstRun = true; if (builder.threadPoolOptions == null) { MsgBox.warning(shell, "The thread pool options are invalid."); return; } stackLayout.topControl = p2; shell.setDefaultButton(doneB); shell.layout(); }