本文整理汇总了Java中org.apache.cassandra.utils.FBUtilities.getToolsOutputDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java FBUtilities.getToolsOutputDirectory方法的具体用法?Java FBUtilities.getToolsOutputDirectory怎么用?Java FBUtilities.getToolsOutputDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.utils.FBUtilities
的用法示例。
在下文中一共展示了FBUtilities.getToolsOutputDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printHistory
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
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
}
}
示例2: printHistory
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
private static void printHistory(String[] args, ToolCommandLine cmd)
{
//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);
final String password = cmd.getOptionValue(PASSWORD_OPT.left);
if (password != null)
cmdLine = cmdLine.replace(password, "<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()) + ": " + cmdLine + "\n");
}
catch (IOException ioe)
{
//quietly ignore any errors about not being able to write out history
}
}
示例3: handleHistoryFiles
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
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;
}
示例4: CfAssumptions
import org.apache.cassandra.utils.FBUtilities; //导入方法依赖的package包/类
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);
}
}