@Override protected FlumeConfiguration getFlumeConfiguration() { return new FlumeConfiguration(properties); }
private void validateConfiguration() { Set<Entry<String, AgentConfiguration>> entries = agentConfigMap.entrySet(); Iterator<Entry<String, AgentConfiguration>> it = entries.iterator(); while (it.hasNext()) { Entry<String, AgentConfiguration> next = it.next(); String agentName = next.getKey(); AgentConfiguration aconf = next.getValue(); if (!aconf.isValid()) { LOGGER.warn("Agent configuration invalid for agent '{}'. It will be removed.", agentName); addError(agentName, AGENT_CONFIGURATION_INVALID, ERROR); it.remove(); } LOGGER.debug("Channels:{}\n", aconf.channels); LOGGER.debug("Sinks {}\n", aconf.sinks); LOGGER.debug("Sources {}\n", aconf.sources); } LOGGER.info( "Post-validation flume configuration contains configuration for agents: {}", agentConfigMap.keySet() ); }
/** * Creates a populated Flume Configuration object. */ public FlumeConfiguration(Map<String, String> properties) { agentConfigMap = new HashMap<>(); errors = new LinkedList<>(); // Construct the in-memory component hierarchy for (Entry<String, String> entry : properties.entrySet()) { if (!addRawProperty(entry.getKey(), entry.getValue())) { LOGGER.warn("Configuration property ignored: {} = {}", entry.getKey(), entry.getValue()); } } // Now iterate thru the agentContext and create agent configs and add them // to agentConfigMap // validate and remove improperly configured components validateConfiguration(); }
public MaterializedConfiguration getConfiguration() { MaterializedConfiguration conf = new SimpleMaterializedConfiguration(); FlumeConfiguration fconfig = getFlumeConfiguration(); AgentConfiguration agentConf = fconfig.getConfigurationFor(getAgentName()); if (agentConf != null) { Map<String, ChannelComponent> channelComponentMap = Maps.newHashMap();
public MaterializedConfiguration getConfiguration() { MaterializedConfiguration conf = new SimpleMaterializedConfiguration(); FlumeConfiguration fconfig = getFlumeConfiguration(); AgentConfiguration agentConf = fconfig.getConfigurationFor(getAgentName()); if (agentConf != null) { Map<String, ChannelComponent> channelComponentMap = Maps.newHashMap();
protected FlumeConfiguration configFromBytes(byte[] configData) throws IOException { Map<String, String> configMap; if (configData == null || configData.length == 0) { configMap = Collections.emptyMap(); } else { String fileContent = new String(configData, Charsets.UTF_8); Properties properties = new Properties(); properties.load(new StringReader(fileContent)); configMap = toMap(properties); } return new FlumeConfiguration(configMap); } }
/** * Creates a populated Flume Configuration object. * @deprecated please use the other constructor */ @Deprecated public FlumeConfiguration(Properties properties) { agentConfigMap = new HashMap<>(); errors = new LinkedList<>(); // Construct the in-memory component hierarchy for (Entry entry : properties.entrySet()) { if (!addRawProperty(entry.getKey().toString(), entry.getValue().toString())) { LOGGER.warn("Configuration property ignored: {} = {}", entry.getKey(), entry.getValue()); } } // Now iterate thru the agentContext and create agent configs and add them // to agentConfigMap // validate and remove improperly configured components validateConfiguration(); }
private boolean addRawProperty(String rawName, String rawValue) { addError("", AGENT_NAME_MISSING, ERROR); return false; addError(name, PROPERTY_VALUE_NULL, ERROR); return false; addError(name, AGENT_NAME_MISSING, ERROR); return false; addError(name, AGENT_NAME_MISSING, ERROR); return false; addError(name, PROPERTY_NAME_NULL, ERROR); return false;
Properties properties = propsclass.newInstance(); properties.load(reader); return new FlumeConfiguration(toMap(properties)); } catch (IOException ex) { LOGGER.error("Unable to load file:" + file return new FlumeConfiguration(new HashMap<String, String>());
/** * Creates a populated Flume Configuration object. */ public FlumeConfiguration(Map<String, String> properties) { agentConfigMap = new HashMap<>(); errors = new LinkedList<>(); // Construct the in-memory component hierarchy for (Entry<String, String> entry : properties.entrySet()) { if (!addRawProperty(entry.getKey(), entry.getValue())) { LOGGER.warn("Configuration property ignored: {} = {}", entry.getKey(), entry.getValue()); } } // Now iterate thru the agentContext and create agent configs and add them // to agentConfigMap // validate and remove improperly configured components validateConfiguration(); }
private void validateConfiguration() { Set<Entry<String, AgentConfiguration>> entries = agentConfigMap.entrySet(); Iterator<Entry<String, AgentConfiguration>> it = entries.iterator(); while (it.hasNext()) { Entry<String, AgentConfiguration> next = it.next(); String agentName = next.getKey(); AgentConfiguration aconf = next.getValue(); if (!aconf.isValid()) { LOGGER.warn("Agent configuration invalid for agent '{}'. It will be removed.", agentName); addError(agentName, AGENT_CONFIGURATION_INVALID, ERROR); it.remove(); } LOGGER.debug("Channels:{}\n", aconf.channels); LOGGER.debug("Sinks {}\n", aconf.sinks); LOGGER.debug("Sources {}\n", aconf.sources); } LOGGER.info( "Post-validation flume configuration contains configuration for agents: {}", agentConfigMap.keySet() ); }
protected FlumeConfiguration configFromBytes(byte[] configData) throws IOException { Map<String, String> configMap; if (configData == null || configData.length == 0) { configMap = Collections.emptyMap(); } else { String fileContent = new String(configData, Charsets.UTF_8); Properties properties = new Properties(); properties.load(new StringReader(fileContent)); configMap = toMap(properties); } return new FlumeConfiguration(configMap); } }
/** * Creates a populated Flume Configuration object. * @deprecated please use the other constructor */ @Deprecated public FlumeConfiguration(Properties properties) { agentConfigMap = new HashMap<>(); errors = new LinkedList<>(); // Construct the in-memory component hierarchy for (Entry entry : properties.entrySet()) { if (!addRawProperty(entry.getKey().toString(), entry.getValue().toString())) { LOGGER.warn("Configuration property ignored: {} = {}", entry.getKey(), entry.getValue()); } } // Now iterate thru the agentContext and create agent configs and add them // to agentConfigMap // validate and remove improperly configured components validateConfiguration(); }
private boolean addRawProperty(String rawName, String rawValue) { addError("", AGENT_NAME_MISSING, ERROR); return false; addError(name, PROPERTY_VALUE_NULL, ERROR); return false; addError(name, AGENT_NAME_MISSING, ERROR); return false; addError(name, AGENT_NAME_MISSING, ERROR); return false; addError(name, PROPERTY_NAME_NULL, ERROR); return false;
Properties properties = propsclass.newInstance(); properties.load(reader); return new FlumeConfiguration(toMap(properties)); } catch (IOException ex) { LOGGER.error("Unable to load file:" + file return new FlumeConfiguration(new HashMap<String, String>());