org.elasticsearch.hadoop.cli.Keytool类的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.elasticsearch.hadoop.cli.Keytool类的一些代码示例,展示了Keytool类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keytool类的具体详情如下:
包路径:org.elasticsearch.hadoop.cli.Keytool
类名称:Keytool

Keytool介绍

暂无

代码示例

代码示例来源:origin: elastic/elasticsearch-hadoop

public static void main(String[] args) {
  System.exit(execute(new ConsolePrompt(), args));
}

代码示例来源:origin: elastic/elasticsearch-hadoop

String arg = args[idx];
  if (arg.equals(FLAG_H) || arg.equals(FLAG_HELP)) {
    printUsage(console);
    return 0;
  } else if (hasSTDIN == false && (arg.equals(FLAG_STDIN))) {
    command = Command.byName(arg.toLowerCase());
    if (command == null) {
      printUsage(console);
      error(console, "Unknown command [" + arg + "]");
      return 2;
    commandArg = arg;
  } else {
    printUsage(console);
    error(console, "Unexpected argument [" + arg + "]");
    return 3;
  printUsage(console);
  error(console, "No command specified");
  return 1;
  printUsage(console);
  error(console, "Settings name required for command [" + command.text + "]");
  return 4;
  return new Keytool(console, command).run(commandArg, hasSTDIN, force);
} catch (IOException e) {
  console.println("ERROR: " + e.getMessage());

代码示例来源:origin: elastic/elasticsearch-hadoop

switch (command) {
  case CREATE:
    if (ksExists()) {
      boolean proceed = promptYesNo("An es-hadoop keystore already exists. Overwrite? [y/N]");
      if (proceed == false) {
        prompt.println("Exiting without creating keystore");
    outputStream = openWrite();
    keystoreWrapper.saveKeystore(outputStream);
    return 0;
  case LIST:
    if (!ksExists()) {
      prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
      return 5;
    inputStream = openRead();
    keystoreWrapper = KeystoreWrapper.loadStore(inputStream).build();
    for (String entry : keystoreWrapper.listEntries()) {
    if (!ksExists()) {
      prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
      return 5;
    inputStream = openRead();
    keystoreWrapper = KeystoreWrapper.loadStore(inputStream).build();
    if (keystoreWrapper.containsEntry(arg) && force == false) {
      boolean proceed = promptYesNo("Setting %s already exists. Overwrite? [y/N]", arg);
      if (proceed == false) {
        prompt.println("Exiting without modifying keystore");

代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop

String arg = args[idx];
  if (arg.equals(FLAG_H) || arg.equals(FLAG_HELP)) {
    printUsage(console);
    return 0;
  } else if (hasSTDIN == false && (arg.equals(FLAG_STDIN))) {
    command = Command.byName(arg.toLowerCase());
    if (command == null) {
      printUsage(console);
      error(console, "Unknown command [" + arg + "]");
      return 2;
    commandArg = arg;
  } else {
    printUsage(console);
    error(console, "Unexpected argument [" + arg + "]");
    return 3;
  printUsage(console);
  error(console, "No command specified");
  return 1;
  printUsage(console);
  error(console, "Settings name required for command [" + command.text + "]");
  return 4;
  return new Keytool(console, command).run(commandArg, hasSTDIN, force);
} catch (IOException e) {
  console.println("ERROR: " + e.getMessage());

代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop

switch (command) {
  case CREATE:
    if (ksExists()) {
      boolean proceed = promptYesNo("An es-hadoop keystore already exists. Overwrite? [y/N]");
      if (proceed == false) {
        prompt.println("Exiting without creating keystore");
    outputStream = openWrite();
    keystoreWrapper.saveKeystore(outputStream);
    return 0;
  case LIST:
    if (!ksExists()) {
      prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
      return 5;
    inputStream = openRead();
    keystoreWrapper = KeystoreWrapper.loadStore(inputStream).build();
    for (String entry : keystoreWrapper.listEntries()) {
    if (!ksExists()) {
      prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
      return 5;
    inputStream = openRead();
    keystoreWrapper = KeystoreWrapper.loadStore(inputStream).build();
    if (keystoreWrapper.containsEntry(arg) && force == false) {
      boolean proceed = promptYesNo("Setting %s already exists. Overwrite? [y/N]", arg);
      if (proceed == false) {
        prompt.println("Exiting without modifying keystore");

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeAddFailUnknownArgument() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"add", "--stdin", "property.name", "someOtherTHing"}), equalTo(3));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: org.elasticsearch/elasticsearch-spark-13

String arg = args[idx];
  if (arg.equals(FLAG_H) || arg.equals(FLAG_HELP)) {
    printUsage(console);
    return 0;
  } else if (hasSTDIN == false && (arg.equals(FLAG_STDIN))) {
    command = Command.byName(arg.toLowerCase());
    if (command == null) {
      printUsage(console);
      error(console, "Unknown command [" + arg + "]");
      return 2;
    commandArg = arg;
  } else {
    printUsage(console);
    error(console, "Unexpected argument [" + arg + "]");
    return 3;
  printUsage(console);
  error(console, "No command specified");
  return 1;
  printUsage(console);
  error(console, "Settings name required for command [" + command.text + "]");
  return 4;
  return new Keytool(console, command).run(commandArg, hasSTDIN, force);
} catch (IOException e) {
  console.println("ERROR: " + e.getMessage());

代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop-mr

switch (command) {
  case CREATE:
    if (ksExists()) {
      boolean proceed = promptYesNo("An es-hadoop keystore already exists. Overwrite? [y/N]");
      if (proceed == false) {
        prompt.println("Exiting without creating keystore");
    outputStream = openWrite();
    keystoreWrapper.saveKeystore(outputStream);
    return 0;
  case LIST:
    if (!ksExists()) {
      prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
      return 5;
    inputStream = openRead();
    keystoreWrapper = KeystoreWrapper.loadStore(inputStream).build();
    for (String entry : keystoreWrapper.listEntries()) {
    if (!ksExists()) {
      prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
      return 5;
    inputStream = openRead();
    keystoreWrapper = KeystoreWrapper.loadStore(inputStream).build();
    if (keystoreWrapper.containsEntry(arg) && force == false) {
      boolean proceed = promptYesNo("Setting %s already exists. Overwrite? [y/N]", arg);
      if (proceed == false) {
        prompt.println("Exiting without modifying keystore");

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeAdd() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"add", "--stdin", "property.name", "someOtherTHing"}), equalTo(3));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop-mr

String arg = args[idx];
  if (arg.equals(FLAG_H) || arg.equals(FLAG_HELP)) {
    printUsage(console);
    return 0;
  } else if (hasSTDIN == false && (arg.equals(FLAG_STDIN))) {
    command = Command.byName(arg.toLowerCase());
    if (command == null) {
      printUsage(console);
      error(console, "Unknown command [" + arg + "]");
      return 2;
    commandArg = arg;
  } else {
    printUsage(console);
    error(console, "Unexpected argument [" + arg + "]");
    return 3;
  printUsage(console);
  error(console, "No command specified");
  return 1;
  printUsage(console);
  error(console, "Settings name required for command [" + command.text + "]");
  return 4;
  return new Keytool(console, command).run(commandArg, hasSTDIN, force);
} catch (IOException e) {
  console.println("ERROR: " + e.getMessage());

代码示例来源:origin: org.elasticsearch/elasticsearch-spark-13

switch (command) {
  case CREATE:
    if (ksExists()) {
      boolean proceed = promptYesNo("An es-hadoop keystore already exists. Overwrite? [y/N]");
      if (proceed == false) {
        prompt.println("Exiting without creating keystore");
    outputStream = openWrite();
    keystoreWrapper.saveKeystore(outputStream);
    return 0;
  case LIST:
    if (!ksExists()) {
      prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
      return 5;
    inputStream = openRead();
    keystoreWrapper = KeystoreWrapper.loadStore(inputStream).build();
    for (String entry : keystoreWrapper.listEntries()) {
    if (!ksExists()) {
      prompt.printf("ERROR: ES-Hadoop keystore not found. Use '%s' command to create one.%n", Command.CREATE.getText());
      return 5;
    inputStream = openRead();
    keystoreWrapper = KeystoreWrapper.loadStore(inputStream).build();
    if (keystoreWrapper.containsEntry(arg) && force == false) {
      boolean proceed = promptYesNo("Setting %s already exists. Overwrite? [y/N]", arg);
      if (proceed == false) {
        prompt.println("Exiting without modifying keystore");

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeNoCommandWithArgs() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"--stdin"}), equalTo(1));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeNoCommand() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{}), equalTo(1));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeHelpExt() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"--help"}), equalTo(0));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeAddFailNoArgument() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"add"}), equalTo(4));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeListFailUnknownArgument() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"list", "property.name"}), equalTo(3));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeHelp() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"-h"}), equalTo(0));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeCommandFail() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"blah"}), equalTo(2));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeCommandFailWithHelp() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"blah", "--help"}), equalTo(2));
  assertHelpMessage(console.getOutput());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

@Test
public void executeAddFailNoSettingsName() {
  TestPrompt console = new TestPrompt();
  assertThat(Keytool.execute(console, new String[]{"add", "--stdin"}), equalTo(4));
  assertHelpMessage(console.getOutput());
}

相关文章