Exemple #1
0
  @Override
  public void invoke(String... args) throws IOException, CommandException {
    verifyArgs(args, 1);

    // Evaluate input file
    Path file = IOHelper.toPath(args[0]);
    LogHelper.subInfo("Evaluating file: '%s'", file);
    try (BufferedReader reader = new LineReader(IOHelper.newReader(file))) {
      for (String line = reader.readLine(); line != null; line = reader.readLine()) {
        server.commandHandler.eval(line, false);
      }
    }
  }
  @Override
  protected Set<String> requestDo(HInput input, HOutput output) throws IOException {
    int count = input.readLength(0);

    // Read all update dirs names
    Set<String> result = new HashSet<>(count);
    for (int i = 0; i < count; i++) {
      result.add(IOHelper.verifyFileName(input.readString(255)));
    }

    // We're done. Make it unmodifiable and return
    return Collections.unmodifiableSet(result);
  }
Exemple #3
0
  @LauncherAPI
  public void verify() {
    // Version
    getVersion();
    IOHelper.verifyFileName(getAssetIndex());

    // Client
    VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Profile title can't be empty");
    VerifyHelper.verify(
        getServerAddress(), VerifyHelper.NOT_EMPTY, "Server address can't be empty");
    VerifyHelper.verifyInt(
        getServerPort(), VerifyHelper.range(0, 65535), "Illegal server port: " + getServerPort());

    //  Updater and client watch service
    update.verifyOfType(ConfigEntry.Type.STRING);
    updateVerify.verifyOfType(ConfigEntry.Type.STRING);
    updateExclusions.verifyOfType(ConfigEntry.Type.STRING);

    // Client launcher
    jvmArgs.verifyOfType(ConfigEntry.Type.STRING);
    classPath.verifyOfType(ConfigEntry.Type.STRING);
    clientArgs.verifyOfType(ConfigEntry.Type.STRING);
    VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty");
  }