Search in sources :

Example 1 with SampleProcessor

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);
}
Also used : CassandraSampleRepository(org.opennms.newts.persistence.cassandra.CassandraSampleRepository) SampleRepository(org.opennms.newts.api.SampleRepository) CassandraIndexer(org.opennms.newts.cassandra.search.CassandraIndexer) Indexer(org.opennms.newts.api.search.Indexer) CassandraSearcher(org.opennms.newts.cassandra.search.CassandraSearcher) Searcher(org.opennms.newts.api.search.Searcher) ResourceMetadataCache(org.opennms.newts.cassandra.search.ResourceMetadataCache) GuavaResourceMetadataCache(org.opennms.newts.cassandra.search.GuavaResourceMetadataCache) CassandraSession(org.opennms.newts.cassandra.CassandraSession) ContextConfigurations(org.opennms.newts.cassandra.ContextConfigurations) CassandraIndexerSampleProcessor(org.opennms.newts.cassandra.search.CassandraIndexerSampleProcessor) SampleProcessor(org.opennms.newts.api.SampleProcessor) EscapableResourceIdSplitter(org.opennms.newts.cassandra.search.EscapableResourceIdSplitter) ResourceIdSplitter(org.opennms.newts.cassandra.search.ResourceIdSplitter) SimpleResourceIdSplitter(org.opennms.newts.cassandra.search.SimpleResourceIdSplitter)

Aggregations

SampleProcessor (org.opennms.newts.api.SampleProcessor)1 SampleRepository (org.opennms.newts.api.SampleRepository)1 Indexer (org.opennms.newts.api.search.Indexer)1 Searcher (org.opennms.newts.api.search.Searcher)1 CassandraSession (org.opennms.newts.cassandra.CassandraSession)1 ContextConfigurations (org.opennms.newts.cassandra.ContextConfigurations)1 CassandraIndexer (org.opennms.newts.cassandra.search.CassandraIndexer)1 CassandraIndexerSampleProcessor (org.opennms.newts.cassandra.search.CassandraIndexerSampleProcessor)1 CassandraSearcher (org.opennms.newts.cassandra.search.CassandraSearcher)1 EscapableResourceIdSplitter (org.opennms.newts.cassandra.search.EscapableResourceIdSplitter)1 GuavaResourceMetadataCache (org.opennms.newts.cassandra.search.GuavaResourceMetadataCache)1 ResourceIdSplitter (org.opennms.newts.cassandra.search.ResourceIdSplitter)1 ResourceMetadataCache (org.opennms.newts.cassandra.search.ResourceMetadataCache)1 SimpleResourceIdSplitter (org.opennms.newts.cassandra.search.SimpleResourceIdSplitter)1 CassandraSampleRepository (org.opennms.newts.persistence.cassandra.CassandraSampleRepository)1