private final SourceFactory sourceFactory = new DefaultSourceFactory();
private final SinkFactory sinkFactory = new DefaultSinkFactory();
public NodeConfiguration load(String name, Properties props, NodeConfigurationAware configurationAware) {
NodeConfiguration conf = new SimpleNodeConfiguration();
FlumeConfiguration fconfig;
try {
fconfig = new FlumeConfiguration(props);
List<FlumeConfigurationError> errors = fconfig.getConfigurationErrors();
if (errors.size() > 0) {
boolean isError = false;
for (FlumeConfigurationError error : errors) {
StringBuilder sb = new StringBuilder();
sb.append("Component: ").append(error.getComponentName()).append(" ");
sb.append("Key: ").append(error.getKey()).append(" ");
sb.append(error.getErrorType().name()).append(" - ").append(error.getErrorType().getError());
switch (error.getErrorOrWarning()) {
case ERROR:
isError = true;
LOGGER.error(sb.toString());
break;
case WARNING:
LOGGER.warn(sb.toString());
break;
}
}
if (isError) {
throw new ConfigurationException("Unable to configure Flume due to errors");
}
}
} catch (RuntimeException ex) {
printProps(props);
throw ex;
}
FlumeConfiguration.AgentConfiguration agentConf = fconfig.getConfigurationFor(name);
if (agentConf != null) {
loadChannels(agentConf, conf);
loadSources(agentConf, conf);