@Override
 public ExitCode exec(CommandEnvironment env, OptionsProvider options)
     throws ShutdownBlazeServerException {
   FooOptions fooOptions = options.getOptions(FooOptions.class);
   env.getReporter().getOutErr().printOut("" + fooOptions.numOption);
   return ExitCode.SUCCESS;
 }
Esempio n. 2
0
 /**
  * Produce identical numbers for similar <code>ActivationGroupDesc</code>s.
  *
  * @return an integer
  * @see java.util.Hashtable
  */
 public int hashCode() {
   // hash location, className, data, and env
   // but omit props (may be expensive)
   return ((location == null ? 0 : location.hashCode() << 24)
       ^ (env == null ? 0 : env.hashCode() << 16)
       ^ (className == null ? 0 : className.hashCode() << 8)
       ^ (data == null ? 0 : data.hashCode()));
 }
Esempio n. 3
0
  /**
   * Compares two activation group descriptors for content equality.
   *
   * @param obj the Object to compare with
   * @return true if these Objects are equal; false otherwise.
   * @see java.util.Hashtable
   * @since 1.2
   */
  public boolean equals(Object obj) {

    if (obj instanceof ActivationGroupDesc) {
      ActivationGroupDesc desc = (ActivationGroupDesc) obj;
      return ((className == null ? desc.className == null : className.equals(desc.className))
          && (location == null ? desc.location == null : location.equals(desc.location))
          && (data == null ? desc.data == null : data.equals(desc.data))
          && (env == null ? desc.env == null : env.equals(desc.env))
          && (props == null ? desc.props == null : props.equals(desc.props)));
    } else {
      return false;
    }
  }
Esempio n. 4
0
  public String buildCommandString() {
    StringBuilder sb = new StringBuilder();
    if (env != null) {
      for (Entry<String, String> e : env.all()) {
        sb.append(e.getKey() + "=" + escapeQuoted(e.getValue()) + " ");
      }
    }

    for (int i = 0; i < args.size(); i++) {
      Argument arg = args.get(i);
      if (i != 0) {
        sb.append(" ");
      }
      sb.append(arg.command);
    }

    return sb.toString();
  }