Package org.apache.flume

Examples of org.apache.flume.FlumeException


    }
  }
  private static void checkRequired(Map<String, String> properties,
      String name) {
    if(!properties.containsKey(name)) {
      throw new FlumeException("Required parameter not found " + name);
    }
  }
View Full Code Here


      } finally {
        cf.close();
      }
    } catch (Exception e) {
      LOGGER.error("Error getting configuration info from Zookeeper", e);
      throw new FlumeException(e);
    }
  }
View Full Code Here

    MaterializedConfiguration conf = configurationProvider.get(name,
        properties);
    Map<String, SourceRunner> sources = conf.getSourceRunners();
    if(sources.size() != 1) {
      throw new FlumeException("Expected one source and got "  +
          sources.size());
    }
    Map<String, Channel> channels = conf.getChannels();
    if(channels.size() != 1) {
      throw new FlumeException("Expected one channel and got "  +
          channels.size());
    }
    Map<String, SinkRunner> sinks = conf.getSinkRunners();
    if(sinks.size() != 1) {
      throw new FlumeException("Expected one sink group and got "  +
          sinks.size());
    }
    this.sourceRunner = sources.values().iterator().next();
    this.channel = channels.values().iterator().next();
    this.sinkRunner = sinks.values().iterator().next();
View Full Code Here

    } else {
      String dataDirStr[] = commandLine.getOptionValue("dataDirs").split(",");
      for(String dataDir : dataDirStr) {
        File f = new File(dataDir);
        if(!f.exists()) {
          throw new FlumeException("Data directory, " + dataDir + " does not " +
            "exist.");
        }
        dataDirs.add(f);
      }
    }
View Full Code Here

      @SuppressWarnings("unchecked")
      Class<? extends ChannelSelector> selectorClass =
          (Class<? extends ChannelSelector>) Class.forName(selectorClassName);
      selector = selectorClass.newInstance();
    } catch (Exception ex) {
      throw new FlumeException("Unable to load selector type: " + type
          + ", class: " + selectorClassName, ex);
    }

    return selector;
  }
View Full Code Here

          KEYSTORE_PASSWORD_KEY + " must be specified when SSL is enabled");
      try {
        KeyStore ks = KeyStore.getInstance(keystoreType);
        ks.load(new FileInputStream(keystore), keystorePassword.toCharArray());
      } catch (Exception ex) {
        throw new FlumeException(
            "Avro source configured with invalid keystore: " + keystore, ex);
      }
    }

    enableIpFilter = context.getBoolean(IP_FILTER_KEY, false);
    if (enableIpFilter) {
      patternRuleConfigDefinition = context.getString(IP_FILTER_RULES_KEY);
      if (patternRuleConfigDefinition == null ||
        patternRuleConfigDefinition.trim().isEmpty()) {
        throw new FlumeException(
          "ipFilter is configured with true but ipFilterRules is not defined:" +
            " ");
      }
      String[] patternRuleDefinitions = patternRuleConfigDefinition.split(
        ",");
View Full Code Here

    String patternRuleDefinition) throws FlumeException {
    patternRuleDefinition = patternRuleDefinition.trim();
    //first validate the format
    int firstColonIndex = patternRuleDefinition.indexOf(":");
    if (firstColonIndex == -1) {
      throw new FlumeException(
        "Invalid ipFilter patternRule '" + patternRuleDefinition +
          "' should look like <'allow'  or 'deny'>:<'ip' or " +
          "'name'>:<pattern>");
    } else {
      String ruleAccessFlag = patternRuleDefinition.substring(0,
        firstColonIndex);
      int secondColonIndex = patternRuleDefinition.indexOf(":",
        firstColonIndex + 1);
      if ((!ruleAccessFlag.equals("allow") &&
        !ruleAccessFlag.equals("deny")) || secondColonIndex == -1) {
        throw new FlumeException(
          "Invalid ipFilter patternRule '" + patternRuleDefinition +
            "' should look like <'allow'  or 'deny'>:<'ip' or " +
            "'name'>:<pattern>");
      }

      String patternTypeFlag = patternRuleDefinition.substring(
        firstColonIndex + 1, secondColonIndex);
      if ((!patternTypeFlag.equals("ip") &&
        !patternTypeFlag.equals("name"))) {
        throw new FlumeException(
          "Invalid ipFilter patternRule '" + patternRuleDefinition +
            "' should look like <'allow'  or 'deny'>:<'ip' or " +
            "'name'>:<pattern>");
      }
View Full Code Here

      } catch (Exception ex) {
        sinkCounter.incrementConnectionFailedCount();
        if (ex instanceof FlumeException) {
          throw (FlumeException) ex;
        } else {
          throw new FlumeException(ex);
        }
      }
       logger.debug("Rpc sink {}: Created RpcClient: {}", getName(), client);
    }
View Full Code Here

  public byte[] getBody() {
    if(body != null) {
      try {
        return body.getBytes(charset);
      } catch (UnsupportedEncodingException ex) {
        throw new FlumeException(String.format("%s encoding not supported", charset), ex);
      }
    } else {
      return new byte[0];
    }
View Full Code Here

      AvroEventDeserializer deserializer
          = new AvroEventDeserializer(context, in);
      try {
        deserializer.initialize();
      } catch (Exception e) {
        throw new FlumeException("Cannot instantiate deserializer", e);
      }
      return deserializer;
    }
View Full Code Here

TOP

Related Classes of org.apache.flume.FlumeException

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.