Examples of IteratorOptions


Examples of org.apache.accumulo.core.iterators.OptionDescriber.IteratorOptions

    } catch (ClassCastException e) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Unable to load " + className + " as type " + OptionDescriber.class.getName()
          + "; configure with 'config' instead");
    }
   
    IteratorOptions itopts = skvi.describeOptions();
    if (itopts.getName() == null)
      throw new IllegalArgumentException(className + " described its default distinguishing name as null");
   
    String shortClassName = className;
    if (className.contains("."))
      shortClassName = className.substring(className.lastIndexOf('.') + 1);
   
    Map<String,String> localOptions = new HashMap<String,String>();
    do {
      // clean up the overall options that caused things to fail
      for (String key : localOptions.keySet())
        options.remove(key);
      localOptions.clear();
     
      reader.printString(itopts.getDescription());
      reader.printNewline();
     
      String prompt;
      if (itopts.getNamedOptions() != null) {
        for (Entry<String,String> e : itopts.getNamedOptions().entrySet()) {
          prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " parameter " + e.getKey() + ", " + e.getValue() + ": ";
         
          input = reader.readLine(prompt);
          if (input == null) {
            reader.printNewline();
            throw new IOException("Input stream closed");
          }
          // Places all Parameters and Values into the LocalOptions, even if the value is "".
          // This allows us to check for "" values when setting the iterators and allows us to remove
          // the parameter and value from the table property.
          localOptions.put(e.getKey(), input);
        }
      }
     
      if (itopts.getUnnamedOptionDescriptions() != null) {
        for (String desc : itopts.getUnnamedOptionDescriptions()) {
          reader.printString(Shell.repeat("-", 10) + "> entering options: " + desc + "\n");
          input = "start";
          while (true) {
            prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " option (<name> <value>, hit enter to skip): ";
           
            input = reader.readLine(prompt);
            if (input == null) {
              reader.printNewline();
              throw new IOException("Input stream closed");
            }
           
            if (input.length() == 0)
              break;
           
            String[] sa = input.split(" ", 2);
            localOptions.put(sa[0], sa[1]);
          }
        }
      }
     
      options.putAll(localOptions);
      if (!skvi.validateOptions(options))
        reader.printString("invalid options for " + clazz.getName() + "\n");
     
    } while (!skvi.validateOptions(options));
    return itopts.getName();
  }
View Full Code Here

Examples of org.apache.accumulo.core.iterators.OptionDescriber.IteratorOptions

        throw new IllegalArgumentException(e.getMessage());
      } catch (IllegalAccessException e) {
        throw new IllegalArgumentException(e.getMessage());
      }
     
      IteratorOptions itopts = skvi.describeOptions();
      if (itopts.name == null)
        throw new IllegalArgumentException(className + " described its default distinguishing name as null");
     
      Map<String,String> localOptions = new HashMap<String,String>();
      do {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.