use of org.opennms.newts.api.SampleProcessor in project newts by OpenNMS.
the class CassandraGuiceModule method configure.
@Override
protected void configure() {
bind(String.class).annotatedWith(named("cassandra.keyspace")).toInstance(m_newtsConf.getCassandraKeyspace());
bind(String.class).annotatedWith(named("cassandra.hostname")).toInstance(m_newtsConf.getCassandraHost());
bind(Integer.class).annotatedWith(named("cassandra.port")).toInstance(m_newtsConf.getCassandraPort());
bind(String.class).annotatedWith(named("cassandra.compression")).toInstance(m_newtsConf.getCassandraCompression());
bind(String.class).annotatedWith(named("cassandra.username")).toInstance(m_newtsConf.getCassandraUsername());
bind(String.class).annotatedWith(named("cassandra.password")).toInstance(m_newtsConf.getCassandraPassword());
bind(Boolean.class).annotatedWith(named("cassandra.ssl")).toInstance(m_newtsConf.getCassandraSsl());
bind(Integer.class).annotatedWith(named("cassandra.pool.core-connections-per-host")).toInstance(m_newtsConf.getCoreConnectionsPerHost());
bind(Integer.class).annotatedWith(named("cassandra.pool.max-connections-per-host")).toInstance(m_newtsConf.getMaxConnectionsPerHost());
bind(Integer.class).annotatedWith(named("cassandra.pool.max-requests-per-connection")).toInstance(m_newtsConf.getMaxRequestsPerConnection());
bind(Integer.class).annotatedWith(named("samples.cassandra.time-to-live")).toInstance(m_newtsConf.getCassandraColumnTTL());
bind(Integer.class).annotatedWith(named("search.cassandra.time-to-live")).toInstance(m_newtsConf.getCassandraColumnTTL());
bind(Integer.class).annotatedWith(named("sampleProcessor.maxThreads")).toInstance(m_newtsConf.getMaxSampleProcessorThreads());
bind(Long.class).annotatedWith(named("search.resourceMetadata.maxCacheEntries")).toInstance(m_newtsConf.getSearchConfig().getMaxCacheEntries());
bind(Boolean.class).annotatedWith(named("search.hierarical-indexing")).toInstance(m_newtsConf.getSearchConfig().isHierarchicalIndexingEnabled());
bind(CassandraSession.class).to(CassandraSessionImpl.class);
bind(ResourceMetadataCache.class).to(GuavaResourceMetadataCache.class);
bind(Searcher.class).to(CassandraSearcher.class);
bind(SampleRepository.class).to(CassandraSampleRepository.class);
bind(Indexer.class).to(CassandraIndexer.class);
Multibinder<SampleProcessor> processors = Multibinder.newSetBinder(binder(), SampleProcessor.class);
if (m_newtsConf.getSearchConfig().isSeparatorEscapingEnabled()) {
bind(ResourceIdSplitter.class).to(EscapableResourceIdSplitter.class);
} else {
bind(ResourceIdSplitter.class).to(SimpleResourceIdSplitter.class);
}
// Only add the search indexer if search is enabled
if (m_newtsConf.getSearchConfig().isEnabled()) {
processors.addBinding().to(CassandraIndexerSampleProcessor.class);
}
// Pull in context specific attributes
ContextConfigurations contextConfigurations = new ContextConfigurations();
for (ContextConfig contextConfig : m_newtsConf.getContextConfigs().values()) {
contextConfigurations.addContextConfig(contextConfig.getContext(), contextConfig.getResourceShard(), contextConfig.getReadConsistency(), contextConfig.getWriteConsistency());
}
bind(ContextConfigurations.class).toInstance(contextConfigurations);
}
Aggregations