mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
11.55.2009 f370207cb8fe0ad9c458be62acfe9d3e4fb10d21
opends/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
@@ -41,6 +41,7 @@
import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.IntegerArgument;
import org.opends.server.util.args.StringArgument;
/**
@@ -55,6 +56,11 @@
  // This CLI is always using the administration connector with SSL
  private final boolean alwaysSSL = true;
  /**
   * The 'refresh' argument.
   */
  private IntegerArgument refreshArg;
  /**
   * The 'scriptFriendly' argument.
   */
@@ -120,6 +126,12 @@
    setNoPropertiesFileArgument(noPropertiesFileArgument);
    initializeGlobalArguments(defaultArgs);
    refreshArg = new IntegerArgument("refresh", 'r',
        "refresh", false, true, INFO_PERIOD_PLACEHOLDER.get(),
        true, 1, false, Integer.MAX_VALUE,
        INFO_DESCRIPTION_REFRESH_PERIOD.get());
    addGlobalArgument(refreshArg, ioArgGroup);
  }
  /**
@@ -155,6 +167,33 @@
  }
  /**
   * Returns the refresh period (in seconds) specified in the command-line.
   * If no refresh period was specified, returns -1.
   * The code assumes that the attributes have been successfully parsed.
   * @return the specified refresh period in the command-line.
   */
  public int getRefreshPeriod()
  {
    if (refreshArg.isPresent())
    {
      try
      {
        return refreshArg.getIntValue();
      }
      catch (ArgumentException ae)
      {
        // Bug
        throw new IllegalStateException("Error getting value, this method "+
            "should be called after parsing the attributes: "+ae, ae);
      }
    }
    else
    {
      return -1;
    }
  }
  /**
   * Returns the bind DN explicitly provided in the command-line.
   * @return the bind DN explicitly provided in the command-line.
   * Returns <CODE>null</CODE> if no bind DN was explicitly provided.