use of org.graylog2.shared.bindings.PluginBindings in project graylog2-server by Graylog2.
the class CmdLineTool method installPluginConfigAndBindings.
private PluginBindings installPluginConfigAndBindings(String pluginPath, ChainingClassLoader classLoader) {
final Set<Plugin> plugins = loadPlugins(pluginPath, classLoader);
final PluginBindings pluginBindings = new PluginBindings(plugins);
for (final Plugin plugin : plugins) {
for (final PluginModule pluginModule : plugin.modules()) {
for (final PluginConfigBean configBean : pluginModule.getConfigBeans()) {
jadConfig.addConfigurationBean(configBean);
}
}
}
return pluginBindings;
}
use of org.graylog2.shared.bindings.PluginBindings in project graylog2-server by Graylog2.
the class CmdLineTool method run.
@Override
public void run() {
final Level logLevel = setupLogger();
final PluginBindings pluginBindings = installPluginConfigAndBindings(getPluginPath(configFile), chainingClassLoader);
if (isDumpDefaultConfig()) {
dumpDefaultConfigAndExit();
}
final NamedConfigParametersModule configModule = readConfiguration(configFile);
if (isDumpConfig()) {
dumpCurrentConfigAndExit();
}
if (!validateConfiguration()) {
LOG.error("Validating configuration file failed - exiting.");
System.exit(1);
}
beforeStart();
final List<String> arguments = ManagementFactory.getRuntimeMXBean().getInputArguments();
LOG.info("Running with JVM arguments: {}", Joiner.on(' ').join(arguments));
injector = setupInjector(configModule, pluginBindings, binder -> binder.bind(ChainingClassLoader.class).toInstance(chainingClassLoader));
if (injector == null) {
LOG.error("Injector could not be created, exiting! (Please include the previous error messages in bug reports.)");
System.exit(1);
}
// This is holding all our metrics.
final MetricRegistry metrics = injector.getInstance(MetricRegistry.class);
addInstrumentedAppender(metrics, logLevel);
// Report metrics via JMX.
final JmxReporter reporter = JmxReporter.forRegistry(metrics).build();
reporter.start();
startCommand();
}
Aggregations