Example #1
0
  /**
   * Applies the command line arguments to the startup preferences. This function is mostly useful
   * because it allows us to supply an arbitrary {@code args} array, link in {@link
   * edu.wisc.ssec.mcidasv.McIDASV#main(String[])}.
   *
   * @param ignoreUnknown If {@code true} ignore any parameters that do not apply to the startup
   *     manager. If {@code false} the non-applicable parameters should signify an error.
   * @param fromStartupManager Whether or not this call originated from the startup manager (rather
   *     than preferences).
   * @param args Incoming command line arguments. Cannot be {@code null}.
   * @throws NullPointerException if {@code args} is null.
   * @see #getArgs(boolean, boolean, String[], Properties)
   */
  public static void applyArgs(
      final boolean ignoreUnknown, final boolean fromStartupManager, final String[] args) {
    if (args == null) {
      throw new NullPointerException("Arguments list cannot be null");
    }
    StartupManager sm = StartupManager.getInstance();
    Platform platform = sm.getPlatform();

    Properties props = getArgs(ignoreUnknown, fromStartupManager, args, getDefaultProperties());
    platform.setUserDirectory(props.getProperty("userpath"));
    platform.setAvailableMemory(props.getProperty(Constants.PROP_SYSMEM));
  }