Package org.apache.accumulo.core.iterators.OptionDescriber

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


      msg.append(OptionDescriber.class.getSimpleName());
      msg.append("; use 'config -s' instead.");
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    }
   
    final 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);
    }
    final 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() + ": ";
          reader.flushConsole();
          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): ";
           
            reader.flushConsole();
            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


      iterOptions = (OptionDescriber) skvi;
    }

    String iteratorName;
    if (null != iterOptions) {
      final IteratorOptions itopts = iterOptions.describeOptions();
      iteratorName = itopts.getName();
     
      if (iteratorName == null) {
        throw new IllegalArgumentException(className + " described its default distinguishing name as null");
      }
      String shortClassName = className;
      if (className.contains(".")) {
        shortClassName = className.substring(className.lastIndexOf('.') + 1);
      }
      final 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.println(itopts.getDescription());
 
        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() + ": ";
            reader.flush();
            input = reader.readLine(prompt);
            if (input == null) {
              reader.println();
              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.println(Shell.repeat("-", 10) + "> entering options: " + desc);
            input = "start";
            prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " option (<name> <value>, hit enter to skip): ";
            while (true) {
              reader.flush();
View Full Code Here

        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

    } 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

      msg.append(OptionDescriber.class.getSimpleName());
      msg.append("; use 'config -s' instead.");
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    }
   
    final 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);
    }
    final 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() + ": ";
          reader.flushConsole();
          input = reader.readLine(prompt);
          if (input == null) {
            reader.printNewline();
            throw new IOException("Input stream closed");
          } else {
            input = new String(input);
          }
          // 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): ";
           
            reader.flushConsole();
            input = reader.readLine(prompt);
            if (input == null) {
              reader.printNewline();
              throw new IOException("Input stream closed");
            } else {
              input = new String(input);
            }
           
            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

      iterOptions = (OptionDescriber) skvi;
    }

    String iteratorName;
    if (null != iterOptions) {
      final IteratorOptions itopts = iterOptions.describeOptions();
      iteratorName = itopts.getName();
     
      if (iteratorName == null) {
        throw new IllegalArgumentException(className + " described its default distinguishing name as null");
      }
      String shortClassName = className;
      if (className.contains(".")) {
        shortClassName = className.substring(className.lastIndexOf('.') + 1);
      }
      final 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.println(itopts.getDescription());
 
        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() + ": ";
            reader.flush();
            input = reader.readLine(prompt);
            if (input == null) {
              reader.println();
              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.println(Shell.repeat("-", 10) + "> entering options: " + desc);
            input = "start";
            prompt = Shell.repeat("-", 10) + "> set " + shortClassName + " option (<name> <value>, hit enter to skip): ";
            while (true) {
              reader.flush();
View Full Code Here

    } 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

        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

Related Classes of org.apache.accumulo.core.iterators.OptionDescriber.IteratorOptions

Copyright © 2018 www.massapicom. 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.