private void createConfigFilters() { for (String name: configFilterSet) { Context context = configFilterContextMap.get(name); ComponentConfiguration componentConfiguration = configFilterConfigMap.get(name); try { if (context != null) { ConfigFilter configFilter = ConfigFilterFactory.create( name, context.getString(BasicConfigurationConstants.CONFIG_TYPE) ); configFilter.initializeWithConfiguration(context.getParameters()); configFiltersInstances.add(configFilter); configFilterPatternCache.put(configFilter.getName(), createConfigFilterPattern(configFilter)); } else if (componentConfiguration != null) { ConfigFilter configFilter = ConfigFilterFactory.create( componentConfiguration.getComponentName(), componentConfiguration.getType() ); configFiltersInstances.add(configFilter); configFilterPatternCache.put(configFilter.getName(), createConfigFilterPattern(configFilter)); } } catch (Exception e) { LOGGER.error("Error while creating config filter {}", name, e); } } }
public void configure(Context context) throws ConfigurationException { super.configure(context); this.channel = context.getString("channel"); 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()); } }
public void configure(Context context) throws ConfigurationException { failIfConfigured(); String confType = context.getString( BasicConfigurationConstants.CONFIG_TYPE); if (confType != null && !confType.isEmpty()) { this.type = confType; } // Type can be set by child class constructors, so check if it was. if (this.type == null || this.type.isEmpty()) { errors.add(new FlumeConfigurationError(componentName, BasicConfigurationConstants.CONFIG_TYPE, FlumeConfigurationErrorType.ATTRS_MISSING, ErrorOrWarning.ERROR)); throw new ConfigurationException( "Component has no type. Cannot configure. " + componentName); } }
@SuppressWarnings("unchecked") public static SinkProcessor getProcessor(ComponentConfiguration conf, List<Sink> sinks) { String typeStr = conf.getType(); SinkProcessor processor; SinkProcessorType type = SinkProcessorType.DEFAULT; try { type = SinkProcessorType.valueOf(typeStr.toUpperCase(Locale.ENGLISH)); } catch (Exception ex) { logger.warn("Sink type {} does not exist, using default", typeStr); } Class<? extends SinkProcessor> processorClass = null; try { processorClass = (Class<? extends SinkProcessor>) Class.forName(type .getSinkProcessorClassName()); } catch (Exception ex) { throw new FlumeException("Unable to load sink processor type: " + typeStr + ", class: " + type.getSinkProcessorClassName(), ex); } try { processor = processorClass.newInstance(); } catch (Exception e) { throw new FlumeException("Unable to create processor, type: " + typeStr + ", class: " + type.getSinkProcessorClassName(), e); } processor.setSinks(sinks); Configurables.configure(processor, conf); return processor; }
SinkGroup group = new SinkGroup(groupSinks); Configurables.configure(group, groupConf); sinkRunnerMap.put(comp.getComponentName(), new SinkRunner(group.getProcessor())); } catch (Exception e) {
public String toString() { return toString(0); }
@SuppressWarnings("unchecked") public static SinkProcessor getProcessor(ComponentConfiguration conf, List<Sink> sinks) { String typeStr = conf.getType(); SinkProcessor processor; SinkProcessorType type = SinkProcessorType.DEFAULT; try { type = SinkProcessorType.valueOf(typeStr.toUpperCase(Locale.ENGLISH)); } catch (Exception ex) { logger.warn("Sink type {} does not exist, using default", typeStr); } Class<? extends SinkProcessor> processorClass = null; try { processorClass = (Class<? extends SinkProcessor>) Class.forName(type .getSinkProcessorClassName()); } catch (Exception ex) { throw new FlumeException("Unable to load sink processor type: " + typeStr + ", class: " + type.getSinkProcessorClassName(), ex); } try { processor = processorClass.newInstance(); } catch (Exception e) { throw new FlumeException("Unable to create processor, type: " + typeStr + ", class: " + type.getSinkProcessorClassName(), e); } processor.setSinks(sinks); Configurables.configure(processor, conf); return processor; }
SinkGroup group = new SinkGroup(groupSinks); Configurables.configure(group, groupConf); sinkRunnerMap.put(comp.getComponentName(), new SinkRunner(group.getProcessor())); } catch (Exception e) {
@Override public String toString(int indentCount) { String basicStr = super.toString(indentCount); StringBuilder sb = new StringBuilder(); sb.append(basicStr).append(FlumeConfiguration.INDENTSTEP).append( "CHANNEL:").append(this.channel).append( FlumeConfiguration.NEWLINE); return sb.toString(); }
if (comp != null) { Channel channel = getOrCreateChannel(channelsNotReused, comp.getComponentName(), comp.getType()); try { Configurables.configure(channel, comp); channelComponentMap.put(comp.getComponentName(), new ChannelComponent(channel)); LOGGER.info("Created channel " + chName);
@Override public String toString(int indentCount) { String basicStr = super.toString(indentCount); StringBuilder sb = new StringBuilder(); sb.append(basicStr).append("CHANNELS:"); for (String channel : this.channels) { sb.append(FlumeConfiguration.INDENTSTEP).append( channel).append(FlumeConfiguration.NEWLINE); } return sb.toString(); }
@Override public void configure(Context context) throws ConfigurationException { super.configure(context); sinks = Arrays.asList(context.getString( BasicConfigurationConstants.CONFIG_SINKS).split("\\s+")); Map<String, String> params = context.getSubProperties( BasicConfigurationConstants.CONFIG_SINK_PROCESSOR_PREFIX); processorContext = new Context(); processorContext.putAll(params); SinkProcessorType spType = getKnownSinkProcessor(processorContext.getString( BasicConfigurationConstants.CONFIG_TYPE)); if (spType != null) { processorConf = (SinkProcessorConfiguration) ComponentConfigurationFactory.create( this.getComponentName() + "-processor", spType.toString(), ComponentType.SINK_PROCESSOR); if (processorConf != null) { processorConf.setSinks(new HashSet<String>(sinks)); processorConf.configure(processorContext); } } setConfigured(); }
public void configure(Context context) throws ConfigurationException { failIfConfigured(); String confType = context.getString( BasicConfigurationConstants.CONFIG_TYPE); if (confType != null && !confType.isEmpty()) { this.type = confType; } // Type can be set by child class constructors, so check if it was. if (this.type == null || this.type.isEmpty()) { errors.add(new FlumeConfigurationError(componentName, BasicConfigurationConstants.CONFIG_TYPE, FlumeConfigurationErrorType.ATTRS_MISSING, ErrorOrWarning.ERROR)); throw new ConfigurationException( "Component has no type. Cannot configure. " + componentName); } }
if (comp != null) { SinkConfiguration config = (SinkConfiguration) comp; Sink sink = sinkFactory.create(comp.getComponentName(), comp.getType()); try { Configurables.configure(sink, config); sinks.put(comp.getComponentName(), sink); channelComponent.components.add(sinkName); } catch (Exception e) {
public String toString() { return toString(0); }
public void configure(Context context) throws ConfigurationException { super.configure(context); try { String channelList = context.getString(
SourceConfiguration config = (SourceConfiguration) comp; Source source = sourceFactory.create(comp.getComponentName(), comp.getType()); try { Configurables.configure(source, config); sourceRunnerMap.put(comp.getComponentName(), SourceRunner.forSource(source)); for (Channel channel : sourceChannels) {
@Override public String toString(int indentCount) { String basicStr = super.toString(indentCount); StringBuilder sb = new StringBuilder(); sb.append(basicStr).append(FlumeConfiguration.INDENTSTEP).append( "CHANNEL:").append(this.channel).append( FlumeConfiguration.NEWLINE); return sb.toString(); }
public void configure(Context context) throws ConfigurationException { super.configure(context); this.channel = context.getString("channel"); 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()); } }
private void createConfigFilters() { for (String name: configFilterSet) { Context context = configFilterContextMap.get(name); ComponentConfiguration componentConfiguration = configFilterConfigMap.get(name); try { if (context != null) { ConfigFilter configFilter = ConfigFilterFactory.create( name, context.getString(BasicConfigurationConstants.CONFIG_TYPE) ); configFilter.initializeWithConfiguration(context.getParameters()); configFiltersInstances.add(configFilter); configFilterPatternCache.put(configFilter.getName(), createConfigFilterPattern(configFilter)); } else if (componentConfiguration != null) { ConfigFilter configFilter = ConfigFilterFactory.create( componentConfiguration.getComponentName(), componentConfiguration.getType() ); configFiltersInstances.add(configFilter); configFilterPatternCache.put(configFilter.getName(), createConfigFilterPattern(configFilter)); } } catch (Exception e) { LOGGER.error("Error while creating config filter {}", name, e); } } }