Package org.apache.accumulo.core.util.shell

Examples of org.apache.accumulo.core.util.shell.ShellCommandException


          new String(Base64.decodeBase64(("ICAgICAgIC4tLS4KICAgICAgLyAvXCBcCiAgICAgKCAvLS1cICkKICAgICAuPl8gIF88LgogICAgLyB8ICd8ICcgXAog"
              + "ICAvICB8Xy58Xy4gIFwKICAvIC98ICAgICAgfFwgXAogfCB8IHwgfFwvfCB8IHwgfAogfF98IHwgfCAgfCB8IHxffAogICAgIC8gIF9fICBcCiAgICAvICAv"
              + "ICBcICBcCiAgIC8gIC8gICAgXCAgXF8KIHwvICAvICAgICAgXCB8IHwKIHxfXy8gICAgICAgIFx8X3wK").getBytes(Constants.UTF8)), Constants.UTF8));
      shellState.getReader().printNewline();
    } else {
      throw new ShellCommandException(ErrorCode.UNRECOGNIZED_COMMAND, getName());
    }
    return 0;
  }
View Full Code Here


    // remove empty values
   
    final String tableName = OptUtil.getTableOpt(cl, shellState);

    if (!shellState.getConnector().tableOperations().testClassLoad(tableName, classname, SortedKeyValueIterator.class.getName())) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + classname + " as type "
          + SortedKeyValueIterator.class.getName());
    }
   
    final String aggregatorClass = options.get("aggregatorClass");
    @SuppressWarnings("deprecation")
    String deprecatedAggregatorClassName = org.apache.accumulo.core.iterators.aggregation.Aggregator.class.getName();
    if (aggregatorClass != null && !shellState.getConnector().tableOperations().testClassLoad(tableName, aggregatorClass, deprecatedAggregatorClassName)) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + aggregatorClass + " as type "
          + deprecatedAggregatorClassName);
    }
   
    for (Iterator<Entry<String,String>> i = options.entrySet().iterator(); i.hasNext();) {
      final Entry<String,String> entry = i.next();
View Full Code Here

      if (className.indexOf('.') < 0) {
        msg.append("; did you use a fully qualified package name?");
      } else {
        msg.append("; class not found.");
      }
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    } catch (InstantiationException e) {
      throw new IllegalArgumentException(e.getMessage());
    } catch (IllegalAccessException e) {
      throw new IllegalArgumentException(e.getMessage());
    } catch (ClassCastException e) {
      StringBuilder msg = new StringBuilder("Loaded ");
      msg.append(className).append(" but it does not implement ");
      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");
View Full Code Here

   
    switch (OptUtil.getAldOpt(cl)) {
      case ADD:
        for (String constraint : cl.getArgs()) {
          if (!shellState.getConnector().tableOperations().testClassLoad(tableName, constraint, Constraint.class.getName())) {
            throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + constraint + " as type "
                + Constraint.class.getName());
          }
          i = shellState.getConnector().tableOperations().addConstraint(tableName, constraint);
          shellState.getReader().printString("Added constraint " + constraint + " to table " + tableName + " with number " + i + "\n");
        }
View Full Code Here

    // instead of setting table properties, just put the options in a list to use at scan time
    Class<?> loadClass;
    try {
      loadClass = getClass().getClassLoader().loadClass(classname);
    } catch (ClassNotFoundException e) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Unable to load " + classname);
    }
    try {
      loadClass.asSubclass(SortedKeyValueIterator.class);
    } catch (ClassCastException ex) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Unable to load " + classname  + " as type "
          + SortedKeyValueIterator.class.getName());
    }
   
    for (Iterator<Entry<String,String>> i = options.entrySet().iterator(); i.hasNext();) {
      final Entry<String,String> entry = i.next();
View Full Code Here

    // remove empty values

    final String tableName = OptUtil.getTableOpt(cl, shellState);

    if (!shellState.getConnector().tableOperations().testClassLoad(tableName, classname, SortedKeyValueIterator.class.getName())) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + classname + " as type "
          + SortedKeyValueIterator.class.getName());
    }

    final String aggregatorClass = options.get("aggregatorClass");
    @SuppressWarnings("deprecation")
    String deprecatedAggregatorClassName = org.apache.accumulo.core.iterators.aggregation.Aggregator.class.getName();
    if (aggregatorClass != null && !shellState.getConnector().tableOperations().testClassLoad(tableName, aggregatorClass, deprecatedAggregatorClassName)) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + aggregatorClass + " as type "
          + deprecatedAggregatorClassName);
    }

    for (Iterator<Entry<String,String>> i = options.entrySet().iterator(); i.hasNext();) {
      final Entry<String,String> entry = i.next();
View Full Code Here

    // remove empty values

    final String namespace = OptUtil.getNamespaceOpt(cl, shellState);

    if (!shellState.getConnector().namespaceOperations().testClassLoad(namespace, classname, SortedKeyValueIterator.class.getName())) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + classname + " as type "
          + SortedKeyValueIterator.class.getName());
    }

    final String aggregatorClass = options.get("aggregatorClass");
    @SuppressWarnings("deprecation")
    String deprecatedAggregatorClassName = org.apache.accumulo.core.iterators.aggregation.Aggregator.class.getName();
    if (aggregatorClass != null && !shellState.getConnector().namespaceOperations().testClassLoad(namespace, aggregatorClass, deprecatedAggregatorClassName)) {
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + aggregatorClass + " as type "
          + deprecatedAggregatorClassName);
    }

    for (Iterator<Entry<String,String>> i = options.entrySet().iterator(); i.hasNext();) {
      final Entry<String,String> entry = i.next();
View Full Code Here

      if (className.indexOf('.') < 0) {
        msg.append("; did you use a fully qualified package name?");
      } else {
        msg.append("; class not found.");
      }
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    } catch (InstantiationException e) {
      throw new IllegalArgumentException(e.getMessage());
    } catch (IllegalAccessException e) {
      throw new IllegalArgumentException(e.getMessage());
    } catch (ClassCastException e) {
      StringBuilder msg = new StringBuilder(50);
      msg.append(className).append(" loaded successfully but does not implement SortedKeyValueIterator.");
      msg.append(" This class cannot be used with this command.");
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, msg.toString());
    }

    @SuppressWarnings("unchecked")
    SortedKeyValueIterator<Key,Value> skvi = (SortedKeyValueIterator<Key,Value>) untypedInstance;
    OptionDescriber iterOptions = null;
View Full Code Here

      shellState.getReader().println(
          new String(Base64.decodeBase64(("ICAgICAgIC4tLS4KICAgICAgLyAvXCBcCiAgICAgKCAvLS1cICkKICAgICAuPl8gIF88LgogICAgLyB8ICd8ICcgXAog"
              + "ICAvICB8Xy58Xy4gIFwKICAvIC98ICAgICAgfFwgXAogfCB8IHwgfFwvfCB8IHwgfAogfF98IHwgfCAgfCB8IHxffAogICAgIC8gIF9fICBcCiAgICAvICAv"
              + "ICBcICBcCiAgIC8gIC8gICAgXCAgXF8KIHwvICAvICAgICAgXCB8IHwKIHxfXy8gICAgICAgIFx8X3wK").getBytes(Constants.UTF8)), Constants.UTF8));
    } else {
      throw new ShellCommandException(ErrorCode.UNRECOGNIZED_COMMAND, getName());
    }
    return 0;
  }
View Full Code Here

  @Override
  protected void setTableProperties(CommandLine cl, Shell shellState, String tableName, int priority, Map<String,String> options, String classname, String name)
      throws AccumuloException, AccumuloSecurityException, ShellCommandException, TableNotFoundException {
    // instead of setting table properties, just put the options in a list to use at scan time
    if (!shellState.getConnector().instanceOperations().testClassLoad(classname, SortedKeyValueIterator.class.getName()))
      throw new ShellCommandException(ErrorCode.INITIALIZATION_FAILURE, "Servers are unable to load " + classname + " as type "
          + SortedKeyValueIterator.class.getName());
    List<IteratorSetting> tableScanIterators = shellState.scanIteratorOptions.get(tableName);
    if (tableScanIterators == null) {
      tableScanIterators = new ArrayList<IteratorSetting>();
      shellState.scanIteratorOptions.put(tableName, tableScanIterators);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.util.shell.ShellCommandException

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.