Package org.apache.flume.conf

Examples of org.apache.flume.conf.ConfigurationException


    if (this.channel == null || this.channel.isEmpty()) {
      errors
          .add(new FlumeConfigurationError(componentName, "channel",
              FlumeConfigurationErrorType.PROPERTY_VALUE_NULL,
              ErrorOrWarning.ERROR));
      throw new ConfigurationException("No channel configured for sink: "
          + this.getComponentName());
    }
  }
View Full Code Here


      if (channels.isEmpty()) {
        errors.add(new FlumeConfigurationError(componentName,
            ComponentType.CHANNEL.getComponentType(),
            FlumeConfigurationErrorType.PROPERTY_VALUE_NULL,
            ErrorOrWarning.ERROR));
        throw new ConfigurationException("No channels set for "
            + this.getComponentName());
      }
      Map<String, String> selectorParams = context.getSubProperties(
              BasicConfigurationConstants.CONFIG_SOURCE_CHANNELSELECTOR_PREFIX);
      String selType;
      if (selectorParams != null && !selectorParams.isEmpty()) {
        selType = selectorParams.get(BasicConfigurationConstants.CONFIG_TYPE);
        System.out.println("Loading selector: " + selType);
      } else {
        selType = ChannelSelectorConfigurationType.REPLICATING.toString();
      }

      if (selType == null || selType.isEmpty()) {
        selType = ChannelSelectorConfigurationType.REPLICATING.toString();

      }
      ChannelSelectorType selectorType =
          this.getKnownChannelSelector(selType);
      Context selectorContext = new Context();
      selectorContext.putAll(selectorParams);
      String config = null;
      if (selectorType == null) {
        config = selectorContext.getString(
            BasicConfigurationConstants.CONFIG_CONFIG);
        if (config == null || config.isEmpty()) {
          config = "OTHER";
        }
      } else {
        config = selectorType.toString().toUpperCase();
      }

      this.selectorConf =
          (ChannelSelectorConfiguration) ComponentConfigurationFactory
              .create(ComponentType.CHANNELSELECTOR.getComponentType(), config,
                  ComponentType.CHANNELSELECTOR);
      selectorConf.setChannels(channels);
      selectorConf.configure(selectorContext);
    } catch (Exception e) {
      errors.add(new FlumeConfigurationError(componentName,
          ComponentType.CHANNELSELECTOR.getComponentType(),
          FlumeConfigurationErrorType.CONFIG_ERROR,
          ErrorOrWarning.ERROR));
      throw new ConfigurationException("Failed to configure component!", e);
    }
  }
View Full Code Here

                                              Properties kafkaProps)
          throws ConfigurationException {
    String brokerList = context.getString(KafkaSinkConstants
            .BROKER_LIST_FLUME_KEY);
    if (brokerList == null) {
      throw new ConfigurationException("brokerList must contain at least " +
              "one Kafka broker");
    }
    kafkaProps.put(KafkaSinkConstants.BROKER_LIST_KEY, brokerList);

    String requiredKey = context.getString(
View Full Code Here

      if (channels.isEmpty()) {
        errors.add(new FlumeConfigurationError(componentName,
            ComponentType.CHANNEL.getComponentType(),
            FlumeConfigurationErrorType.PROPERTY_VALUE_NULL,
            ErrorOrWarning.ERROR));
        throw new ConfigurationException("No channels set for "
            + this.getComponentName());
      }
      Map<String, String> selectorParams = context.getSubProperties(
              BasicConfigurationConstants.CONFIG_SOURCE_CHANNELSELECTOR_PREFIX);
      String selType;
      if (selectorParams != null && !selectorParams.isEmpty()) {
        selType = selectorParams.get(BasicConfigurationConstants.CONFIG_TYPE);
      } else {
        selType = ChannelSelectorConfigurationType.REPLICATING.toString();
      }

      if (selType == null || selType.isEmpty()) {
        selType = ChannelSelectorConfigurationType.REPLICATING.toString();

      }
      ChannelSelectorType selectorType =
          this.getKnownChannelSelector(selType);
      Context selectorContext = new Context();
      selectorContext.putAll(selectorParams);
      String config = null;
      if (selectorType == null) {
        config = selectorContext.getString(
            BasicConfigurationConstants.CONFIG_CONFIG);
        if (config == null || config.isEmpty()) {
          config = "OTHER";
        }
      } else {
        config = selectorType.toString().toUpperCase(Locale.ENGLISH);
      }

      this.selectorConf =
          (ChannelSelectorConfiguration) ComponentConfigurationFactory
              .create(ComponentType.CHANNELSELECTOR.getComponentType(), config,
                  ComponentType.CHANNELSELECTOR);
      selectorConf.setChannels(channels);
      selectorConf.configure(selectorContext);
    } catch (Exception e) {
      errors.add(new FlumeConfigurationError(componentName,
          ComponentType.CHANNELSELECTOR.getComponentType(),
          FlumeConfigurationErrorType.CONFIG_ERROR,
          ErrorOrWarning.ERROR));
      throw new ConfigurationException("Failed to configure component!", e);
    }
  }
View Full Code Here

                                              Properties kafkaProps)
          throws ConfigurationException {
    String zookeeperConnect = context.getString(
            KafkaSourceConstants.ZOOKEEPER_CONNECT_FLUME);
    if (zookeeperConnect == null) {
      throw new ConfigurationException("ZookeeperConnect must contain " +
              "at least one ZooKeeper server");
    }
    kafkaProps.put(KafkaSourceConstants.ZOOKEEPER_CONNECT, zookeeperConnect);

    String groupID = context.getString(KafkaSourceConstants.GROUP_ID_FLUME);
View Full Code Here

    timeUpperLimit = context.getInteger(KafkaSourceConstants.BATCH_DURATION_MS,
            KafkaSourceConstants.DEFAULT_BATCH_DURATION);
    topic = context.getString(KafkaSourceConstants.TOPIC);

    if(topic == null) {
      throw new ConfigurationException("Kafka topic must be specified.");
    }

    kafkaProps = KafkaSourceUtil.getKafkaProperties(context);
    consumerTimeout = Integer.parseInt(kafkaProps.getProperty(
            KafkaSourceConstants.CONSUMER_TIMEOUT));
View Full Code Here

    if (handler == null) {
      MorphlineHandler tmpHandler;
      try {
        tmpHandler = (MorphlineHandler) Class.forName(handlerClass).newInstance();
      } catch (Exception e) {
        throw new ConfigurationException(e);
      }
      tmpHandler.configure(context);
      handler = tmpHandler;
    }   
    super.start();
View Full Code Here

    if (this.channel == null || this.channel.isEmpty()) {
      errors
          .add(new FlumeConfigurationError(componentName, "channel",
              FlumeConfigurationErrorType.PROPERTY_VALUE_NULL,
              ErrorOrWarning.ERROR));
      throw new ConfigurationException("No channel configured for sink: "
          + this.getComponentName());
    }
  }
View Full Code Here

      LOGGER.info(
        "Group ID was not specified. Using " + groupId + " as the group id.");
    }
    String brokerList = ctx.getString(BROKER_LIST_FLUME_KEY);
    if (brokerList == null || brokerList.isEmpty()) {
      throw new ConfigurationException("Broker List must be specified");
    }
    String zkConnect = ctx.getString(ZOOKEEPER_CONNECT_FLUME_KEY);
    if (zkConnect == null || zkConnect.isEmpty()) {
      throw new ConfigurationException(
        "Zookeeper Connection must be specified");
    }
    Long timeout = ctx.getLong(TIMEOUT, Long.valueOf(DEFAULT_TIMEOUT));
    kafkaConf.putAll(ctx.getSubProperties(KAFKA_PREFIX));
    kafkaConf.put(GROUP_ID, groupId);
View Full Code Here

      if (channels.isEmpty()) {
        errors.add(new FlumeConfigurationError(componentName,
            ComponentType.CHANNEL.getComponentType(),
            FlumeConfigurationErrorType.PROPERTY_VALUE_NULL,
            ErrorOrWarning.ERROR));
        throw new ConfigurationException("No channels set for "
            + this.getComponentName());
      }
      Map<String, String> selectorParams = context.getSubProperties(
              BasicConfigurationConstants.CONFIG_SOURCE_CHANNELSELECTOR_PREFIX);
      String selType;
      if (selectorParams != null && !selectorParams.isEmpty()) {
        selType = selectorParams.get(BasicConfigurationConstants.CONFIG_TYPE);
        System.out.println("Loading selector: " + selType);
      } else {
        selType = ChannelSelectorConfigurationType.REPLICATING.toString();
      }

      if (selType == null || selType.isEmpty()) {
        selType = ChannelSelectorConfigurationType.REPLICATING.toString();

      }
      ChannelSelectorType selectorType =
          this.getKnownChannelSelector(selType);
      Context selectorContext = new Context();
      selectorContext.putAll(selectorParams);
      String config = null;
      if (selectorType == null) {
        config = selectorContext.getString(
            BasicConfigurationConstants.CONFIG_CONFIG);
        if (config == null || config.isEmpty()) {
          config = "OTHER";
        }
      } else {
        config = selectorType.toString().toUpperCase();
      }

      this.selectorConf =
          (ChannelSelectorConfiguration) ComponentConfigurationFactory
              .create(ComponentType.CHANNELSELECTOR.getComponentType(), config,
                  ComponentType.CHANNELSELECTOR);
      selectorConf.setChannels(channels);
      selectorConf.configure(selectorContext);
    } catch (Exception e) {
      errors.add(new FlumeConfigurationError(componentName,
          ComponentType.CHANNELSELECTOR.getComponentType(),
          FlumeConfigurationErrorType.CONFIG_ERROR,
          ErrorOrWarning.ERROR));
      throw new ConfigurationException("Failed to configure component!", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.flume.conf.ConfigurationException

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.