示例#1
0
  /**
   * returns true if the last version check was done more than two weeks ago.
   *
   * @param session the command session.
   * @return true if a version check is required else returns false.
   */
  public static boolean shouldDoVersionCheck(final CommandSession session) {
    final boolean interactive = (Boolean) session.get(Constants.INTERACTIVE_MODE);
    if (!interactive) {
      return false;
    }

    final long lastAskedTS = getLastTimeAskedAboutVersionCheck();
    // check only if checked over a two weeks ago and user agrees
    try {
      if (lastAskedTS <= System.currentTimeMillis() - TWO_WEEKS_IN_MILLIS) {
        final boolean userConfirms = ShellUtils.promptUser(session, "version_check_confirmation");
        registerVersionCheck();
        return userConfirms;
      }
    } catch (final IOException e) {
      logger.log(Level.FINE, "Failed to prompt user", e);
    }
    return false;
  }
示例#2
0
 private boolean promptWouldYouLikeToContinueQuestion() throws IOException {
   return ShellUtils.promptUser(
       session, "would_you_like_to_continue_service_installation", serviceName);
 }