Java Code Examples for org.apache.cassandra.utils.FBUtilities#getToolsOutputDirectory()
The following examples show how to use
org.apache.cassandra.utils.FBUtilities#getToolsOutputDirectory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NodeTool.java From stratio-cassandra with Apache License 2.0 | 6 votes |
private static void printHistory(String... args) { //don't bother to print if no args passed (meaning, nodetool is just printing out the sub-commands list) if (args.length == 0) return; String cmdLine = Joiner.on(" ").skipNulls().join(args); cmdLine = cmdLine.replaceFirst("(?<=(-pw|--password))\\s+\\S+", " <hidden>"); try (FileWriter writer = new FileWriter(new File(FBUtilities.getToolsOutputDirectory(), HISTORYFILE), true)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS"); writer.append(sdf.format(new Date())).append(": ").append(cmdLine).append(System.lineSeparator()); } catch (IOException | IOError ioe) { //quietly ignore any errors about not being able to write out history } }
Example 2
Source File: CliMain.java From stratio-cassandra with Apache License 2.0 | 5 votes |
private static File handleHistoryFiles() { File outputDir = FBUtilities.getToolsOutputDirectory(); File historyFile = new File(outputDir, HISTORYFILE); File oldHistoryFile = new File(System.getProperty("user.home"), OLD_HISTORYFILE); if(oldHistoryFile.exists()) FileUtils.renameWithConfirm(oldHistoryFile, historyFile); return historyFile; }
Example 3
Source File: CliClient.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public CfAssumptions() { assumptions = new HashMap<String, Map<String, Map<String, String>>>(); assumptionsChanged = false; assumptionDirectory = FBUtilities.getToolsOutputDirectory(); File oldAssumptionDir = new File(System.getProperty("user.home") + File.separator + ".cassandra-cli"); if (oldAssumptionDir.exists()) { File oldAssumptionFile = new File(oldAssumptionDir, ASSUMPTIONS_FILENAME); if (oldAssumptionFile.exists()) FileUtils.renameWithConfirm(oldAssumptionFile, new File(assumptionDirectory, ASSUMPTIONS_FILENAME)); FileUtils.deleteRecursive(oldAssumptionDir); } }