org.graylog2.telemetry.radio.TelemetryRadioModule Maven / Gradle / Ivy
package org.graylog2.telemetry.radio;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.squareup.okhttp.OkHttpClient;
import org.graylog2.plugin.PluginConfigBean;
import org.graylog2.plugin.PluginModule;
import org.graylog2.telemetry.TelemetryConfiguration;
import org.graylog2.telemetry.TelemetryNodePeriodical;
import org.graylog2.telemetry.TelemetryNodeService;
import org.graylog2.telemetry.providers.ObjectMapperProvider;
import org.graylog2.telemetry.providers.OkHttpClientProvider;
import java.util.Collections;
import java.util.Set;
import static com.google.inject.name.Names.named;
public class TelemetryRadioModule extends PluginModule {
@Override
public Set extends PluginConfigBean> getConfigBeans() {
return Collections.singleton(new TelemetryConfiguration());
}
@Override
protected void configure() {
bind(ObjectMapper.class).annotatedWith(named("telemetryObjectMapper")).toProvider(ObjectMapperProvider.class);
bind(OkHttpClient.class).annotatedWith(named("telemetryHttpClient")).toProvider(OkHttpClientProvider.class);
bind(TelemetryNodeService.class).asEagerSingleton();
addPeriodical(TelemetryNodePeriodical.class);
addRestResource(TelemetryRadioResource.class);
addConfigBeans();
}
}