private ClusterEventPeriodical(final JacksonDBCollection<ClusterEvent, String> dbCollection, final NodeId nodeId, final ObjectMapper objectMapper, final ChainingClassLoader chainingClassLoader, final EventBus serverEventBus, final ClusterEventBus clusterEventBus) { this.nodeId = checkNotNull(nodeId); this.dbCollection = checkNotNull(dbCollection); this.objectMapper = checkNotNull(objectMapper); this.chainingClassLoader = chainingClassLoader; this.serverEventBus = checkNotNull(serverEventBus); checkNotNull(clusterEventBus).registerClusterEventSubscriber(this); }
@Inject public DBDataAdapterService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, ClusterEventBus clusterEventBus) { this.db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection("lut_data_adapters"), DataAdapterDto.class, ObjectId.class, mapper.get()); this.clusterEventBus = clusterEventBus; db.createIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true)); }
@Inject public DBCacheService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, ClusterEventBus clusterEventBus) { this.db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection("lut_caches"), CacheDto.class, ObjectId.class, mapper.get()); this.clusterEventBus = clusterEventBus; db.createIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true)); }
@Inject public DBLookupTableService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, ClusterEventBus clusterEventBus) { this.db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection("lut_tables"), LookupTableDto.class, ObjectId.class, mapper.get()); this.clusterEventBus = clusterEventBus; db.createIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true)); }
@Inject public TrafficCounterService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper) { db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection("traffic"), TrafficDto.class, ObjectId.class, mapper.get()); db.createIndex(new BasicDBObject(BUCKET, 1), new BasicDBObject("unique", true)); }
@Inject public IndexFieldTypesService(MongoConnection mongoConnection, MongoJackObjectMapperProvider objectMapperProvider) { this.db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection("index_field_types"), IndexFieldTypesDTO.class, ObjectId.class, objectMapperProvider.get()); this.db.createIndex(new BasicDBObject(ImmutableMap.of( IndexFieldTypesDTO.FIELD_INDEX_NAME, 1, IndexFieldTypesDTO.FIELD_INDEX_SET_ID, 1 )), new BasicDBObject("unique", true)); this.db.createIndex(new BasicDBObject(IndexFieldTypesDTO.FIELD_INDEX_NAME, 1), new BasicDBObject("unique", true)); this.db.createIndex(new BasicDBObject(FIELDS_FIELD_NAMES, 1)); }
@Inject public ClusterEventCleanupPeriodical(final MongoJackObjectMapperProvider mapperProvider, final MongoConnection mongoConnection) { this(JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection(COLLECTION_NAME), ClusterEvent.class, String.class, mapperProvider.get()), DEFAULT_MAX_EVENT_AGE); }
@Inject public ContentPackInstallationPersistenceService(final MongoJackObjectMapperProvider mapperProvider, final MongoConnection mongoConnection) { this(JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection(COLLECTION_NAME), ContentPackInstallation.class, ObjectId.class, mapperProvider.get())); }
@Inject public ClusterConfigServiceImpl(final MongoJackObjectMapperProvider mapperProvider, final MongoConnection mongoConnection, final NodeId nodeId, final ChainingClassLoader chainingClassLoader, final ClusterEventBus clusterEventBus) { this(JacksonDBCollection.wrap(prepareCollection(mongoConnection), ClusterConfig.class, String.class, mapperProvider.get()), nodeId, mapperProvider.get(), chainingClassLoader, clusterEventBus); }
@Inject public DecoratorServiceImpl(MongoConnection mongoConnection, MongoJackObjectMapperProvider mongoJackObjectMapperProvider) { final String collectionName = DecoratorImpl.class.getAnnotation(CollectionName.class).value(); final DBCollection dbCollection = mongoConnection.getDatabase().getCollection(collectionName); this.coll = JacksonDBCollection.wrap(dbCollection, DecoratorImpl.class, String.class, mongoJackObjectMapperProvider.get()); }
@Inject public ActionService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper){ dbCollection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(COLLECTION_NAME), CollectorActions.class, ObjectId.class, mapper.get()); }
@Inject public ContentPackPersistenceService(final MongoJackObjectMapperProvider mapperProvider, final MongoConnection mongoConnection) { this(JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection(COLLECTION_NAME), ContentPack.class, ObjectId.class, mapperProvider.get())); }
@Inject protected MongoDbGrokPatternService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, ClusterEventBus clusterBus) { this.dbCollection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(COLLECTION_NAME), GrokPattern.class, ObjectId.class, mapper.get()); this.clusterBus = clusterBus; // TODO: Uncomment once there are no Graylog clusters with duplicate Grok patterns out there, // probably around Graylog 4.0.0. // createIndex(mongoConnection); }
@Inject public OutputServiceImpl(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapperProvider, StreamService streamService, OutputRegistry outputRegistry) { this.streamService = streamService; final String collectionName = OutputImpl.class.getAnnotation(CollectionName.class).value(); this.dbCollection = mongoConnection.getDatabase().getCollection(collectionName); this.coll = JacksonDBCollection.wrap(dbCollection, OutputImpl.class, String.class, mapperProvider.get()); this.outputRegistry = outputRegistry; }
@Inject public MongoDbPipelineStreamConnectionsService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, ClusterEventBus clusterBus) { this.dbCollection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(COLLECTION), PipelineConnections.class, String.class, mapper.get()); this.clusterBus = clusterBus; dbCollection.createIndex(DBSort.asc("stream_id"), new BasicDBObject("unique", true)); }
@Inject public AlarmCallbackConfigurationServiceImpl(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapperProvider) { final String collectionName = AlarmCallbackConfigurationImpl.class.getAnnotation(CollectionName.class).value(); final DBCollection dbCollection = mongoConnection.getDatabase().getCollection(collectionName); this.coll = JacksonDBCollection.wrap(dbCollection, AlarmCallbackConfigurationImpl.class, String.class, mapperProvider.get()); dbCollection.createIndex(AlarmCallbackConfigurationImpl.FIELD_STREAM_ID); }
@Inject public AlarmCallbackHistoryServiceImpl(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapperProvider) { final String collectionName = AlarmCallbackHistoryImpl.class.getAnnotation(CollectionName.class).value(); final DBCollection dbCollection = mongoConnection.getDatabase().getCollection(collectionName); this.coll = JacksonDBCollection.wrap(dbCollection, AlarmCallbackHistoryImpl.class, String.class, mapperProvider.get()); dbCollection.createIndex(AlarmCallbackHistoryImpl.FIELD_ALERTID); }
@Inject public MongoDbRuleService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, ClusterEventBus clusterBus) { this.dbCollection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(COLLECTION), RuleDao.class, String.class, mapper.get()); this.clusterBus = clusterBus; dbCollection.createIndex(DBSort.asc("title"), new BasicDBObject("unique", true)); }
@Inject public MongoDbPipelineService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, ClusterEventBus clusterBus) { this.dbCollection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(COLLECTION), PipelineDao.class, String.class, mapper.get()); this.clusterBus = clusterBus; dbCollection.createIndex(DBSort.asc("title"), new BasicDBObject("unique", true)); }
protected PaginatedDbService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, Class<DTO> dtoClass, String collectionName) { this.db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection(collectionName), dtoClass, ObjectId.class, mapper.get()); }