aconf = new AgentConfiguration(agentName, errors); agentConfigMap.put(agentName, aconf);
} else { LOGGER.warn("Duplicate configfilter list specified for agent: {}", agentName); addError(CONFIG_CONFIGFILTERS, DUPLICATE_PROPERTY, ERROR); return false; } else { LOGGER.warn("Duplicate source list specified for agent: {}", agentName); addError(CONFIG_SOURCES, DUPLICATE_PROPERTY, ERROR); return false; } else { LOGGER.warn("Duplicate sink list specfied for agent: {}", agentName); addError(CONFIG_SINKS, DUPLICATE_PROPERTY, ERROR); return false; } else { LOGGER.warn("Duplicate channel list specified for agent: {}", agentName); addError(CONFIG_CHANNELS, DUPLICATE_PROPERTY, ERROR); return false; } else { LOGGER.warn("Duplicate sinkgroup list specfied for agent: {}", agentName); addError(CONFIG_SINKGROUPS, DUPLICATE_PROPERTY, ERROR); return false; if (addAsSourceConfig(key, value) || addAsChannelValue(key, value) || addAsSinkConfig(key, value) || addAsSinkGroupConfig(key, value)
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); } } }
addError(CONFIG_SOURCES, PROPERTY_VALUE_NULL, WARNING); return new HashSet<String>(); boolean configSpecified = false; if (srcContext != null) { SourceType srcType = getKnownSource(srcContext.getString( BasicConfigurationConstants.CONFIG_TYPE)); if (srcType == null) { this.getSpaceDelimitedList(channels)); addError(sourceName, CONFIG_ERROR, ERROR); LOGGER.warn("Configuration empty for: {}.Removed.", sourceName);
if (sinks == null || sinks.isEmpty()) { LOGGER.warn("Agent configuration for '{}' has no sinks.", agentName); addError(CONFIG_SINKS, PROPERTY_VALUE_NULL, WARNING); return new HashSet<String>(); } else { iter.remove(); LOGGER.warn("no context for sink{}", sinkName); addError(sinkName, CONFIG_ERROR, ERROR); } else { String config = null; boolean configSpecified = false; SinkType sinkType = getKnownSink(sinkContext.getString( BasicConfigurationConstants.CONFIG_TYPE)); if (sinkType == null) {
ChannelType chType = getKnownChannel(channelContext.getString( BasicConfigurationConstants.CONFIG_TYPE)); boolean configSpecified = false; addError(channelName, CONFIG_ERROR, ERROR);
ConfigFilterType chType = getKnownConfigFilter(configFilterContext.getString( BasicConfigurationConstants.CONFIG_TYPE)); boolean configSpecified = false; addError(configFilterName, CONFIG_ERROR, ERROR); LOGGER.warn("Configuration empty for: {}. Removed.", configFilterName);
LOGGER.debug("Starting validation of configuration for agent: {}", agentName); if (LOGGER.isDebugEnabled() && LogPrivacyUtil.allowLogPrintConfig()) { LOGGER.debug("Initial configuration: {}", getPrevalidationConfig()); configFilterSet = validateConfigFilterSet(); createConfigFilters(); runFiltersThroughConfigs(); agentName ); addError(CONFIG_CHANNELS, PROPERTY_VALUE_NULL, ERROR); return false; channelSet = validateChannels(channelSet); if (channelSet.isEmpty()) { LOGGER.warn( agentName ); addError(CONFIG_CHANNELS, PROPERTY_VALUE_NULL, ERROR); return false; sourceSet = validateSources(channelSet); sinkSet = validateSinks(channelSet); sinkgroupSet = validateGroups(sinkSet); agentName ); addError(CONFIG_SOURCES, PROPERTY_VALUE_NULL, ERROR);
} else { LOGGER.warn("Duplicate configfilter list specified for agent: {}", agentName); addError(CONFIG_CONFIGFILTERS, DUPLICATE_PROPERTY, ERROR); return false; } else { LOGGER.warn("Duplicate source list specified for agent: {}", agentName); addError(CONFIG_SOURCES, DUPLICATE_PROPERTY, ERROR); return false; } else { LOGGER.warn("Duplicate sink list specfied for agent: {}", agentName); addError(CONFIG_SINKS, DUPLICATE_PROPERTY, ERROR); return false; } else { LOGGER.warn("Duplicate channel list specified for agent: {}", agentName); addError(CONFIG_CHANNELS, DUPLICATE_PROPERTY, ERROR); return false; } else { LOGGER.warn("Duplicate sinkgroup list specfied for agent: {}", agentName); addError(CONFIG_SINKGROUPS, DUPLICATE_PROPERTY, ERROR); return false; if (addAsSourceConfig(key, value) || addAsChannelValue(key, value) || addAsSinkConfig(key, value) || addAsSinkGroupConfig(key, value)
Set<String> sinkgroupSet = stringToSet(sinkgroups, " "); Map<String, String> usedSinks = new HashMap<String, String>(); Iterator<String> iter = sinkgroupSet.iterator(); Set<String> groupSinks = validGroupSinks(sinkSet, usedSinks, conf); if (conf != null) errorList.addAll(conf.getErrors()); if (groupSinks != null && !groupSinks.isEmpty()) { sinkgroupConfigMap.put(sinkgroupName, conf); } else { addError(sinkgroupName, CONFIG_ERROR, ERROR); if (conf != null) errorList.addAll(conf.getErrors()); throw new ConfigurationException( addError(sinkgroupName, CONFIG_ERROR, ERROR); LOGGER.warn( "Could not configure sink group {} due to: {}", addError(sinkgroupName, CONFIG_ERROR, ERROR); LOGGER.warn("Configuration error for: {}.Removed.", sinkgroupName);
new Object[]{agentName, groupConf.getComponentName(), curSink, usedSinks.get(curSink)} ); addError(groupConf.getComponentName(), PROPERTY_PART_OF_ANOTHER_GROUP, ERROR); sinkIt.remove(); continue; new Object[]{agentName, groupConf.getComponentName(), curSink} ); addError(curSink, INVALID_PROPERTY, ERROR); sinkIt.remove(); continue;
aconf = new AgentConfiguration(agentName, errors); agentConfigMap.put(agentName, aconf);
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); } } }
private boolean addAsSourceConfig(String key, String value) { return addComponentConfig( key, value, CONFIG_SOURCES_PREFIX, sourceContextMap ); }
private boolean addAsSinkGroupConfig(String key, String value) { return addComponentConfig( key, value, CONFIG_SINKGROUPS_PREFIX, sinkGroupContextMap ); }
private boolean addAsConfigFilterConfig(String key, String value) { return addComponentConfig( key, value, CONFIG_CONFIGFILTERS_PREFIX, configFilterContextMap ); }
private boolean addAsChannelValue(String key, String value) { return addComponentConfig( key, value, CONFIG_CHANNELS_PREFIX, channelContextMap ); }
private boolean addAsSinkConfig(String key, String value) { return addComponentConfig( key, value, CONFIG_SINKS_PREFIX, sinkContextMap ); }
addError(CONFIG_SOURCES, PROPERTY_VALUE_NULL, WARNING); return new HashSet<String>(); boolean configSpecified = false; if (srcContext != null) { SourceType srcType = getKnownSource(srcContext.getString( BasicConfigurationConstants.CONFIG_TYPE)); if (srcType == null) { this.getSpaceDelimitedList(channels)); addError(sourceName, CONFIG_ERROR, ERROR); LOGGER.warn("Configuration empty for: {}.Removed.", sourceName);
if (sinks == null || sinks.isEmpty()) { LOGGER.warn("Agent configuration for '{}' has no sinks.", agentName); addError(CONFIG_SINKS, PROPERTY_VALUE_NULL, WARNING); return new HashSet<String>(); } else { iter.remove(); LOGGER.warn("no context for sink{}", sinkName); addError(sinkName, CONFIG_ERROR, ERROR); } else { String config = null; boolean configSpecified = false; SinkType sinkType = getKnownSink(sinkContext.getString( BasicConfigurationConstants.CONFIG_TYPE)); if (sinkType == null) {