@Inject public ConfigurationVariableService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper) { super(mongoConnection, mapper, ConfigurationVariable.class, COLLECTION_NAME); db.createIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true)); }
@Inject public SidecarService(CollectorService collectorService, ConfigurationService configurationService, MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, Validator validator) { super(mongoConnection, mapper, Sidecar.class, COLLECTION_NAME); this.collectorService = collectorService; this.configurationService = configurationService; this.validator = validator; db.createIndex(new BasicDBObject(Sidecar.FIELD_NODE_ID, 1), new BasicDBObject("unique", true)); }
ContentPackInstallationPersistenceService(final JacksonDBCollection<ContentPackInstallation, ObjectId> dbCollection) { this.dbCollection = dbCollection; dbCollection.createIndex(new BasicDBObject(ContentPackInstallation.FIELD_CONTENT_PACK_ID, 1)); dbCollection.createIndex(new BasicDBObject(ContentPackInstallation.FIELD_CONTENT_PACK_ID, 1).append(ContentPackInstallation.FIELD_CONTENT_PACK_REVISION, 1)); }
ContentPackPersistenceService(final JacksonDBCollection<ContentPack, ObjectId> dbCollection) { this.dbCollection = dbCollection; try { dbCollection.createIndex(new BasicDBObject(Identified.FIELD_META_ID, 1).append(Revisioned.FIELD_META_REVISION, 1), new BasicDBObject("unique", true)); } catch (DuplicateKeyException e) { // Ignore - this can happen if this runs before the migration of old content packs } }
@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 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 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)); }
@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 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 protected RoleServiceImpl(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, Permissions permissions, Validator validator) { this.validator = validator; dbCollection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(ROLES), RoleImpl.class, ObjectId.class, mapper.get()); // lower case role names are unique, this allows arbitrary naming, but still uses an index dbCollection.createIndex(new BasicDBObject(NAME_LOWER, 1), new BasicDBObject("unique", true)); // make sure the two built-in roles actually exist adminRoleObjectId = checkNotNull(ensureBuiltinRole(ADMIN_ROLENAME, Sets.newHashSet("*"), "Admin", "Grants all permissions for Graylog administrators (built-in)")); readerRoleObjectId = checkNotNull(ensureBuiltinRole(READER_ROLENAME, permissions.readerBasePermissions(), "Reader", "Grants basic permissions for every Graylog user (built-in)")); }
@Inject public MongoIndexRangeService(MongoConnection mongoConnection, MongoJackObjectMapperProvider objectMapperProvider, Indices indices, IndexSetRegistry indexSetRegistry, AuditEventSender auditEventSender, NodeId nodeId, EventBus eventBus) { this.indices = indices; this.indexSetRegistry = indexSetRegistry; this.auditEventSender = auditEventSender; this.nodeId = nodeId; this.collection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(COLLECTION_NAME), MongoIndexRange.class, ObjectId.class, objectMapperProvider.get()); eventBus.register(this); collection.createIndex(new BasicDBObject(MongoIndexRange.FIELD_INDEX_NAME, 1)); collection.createIndex(BasicDBObjectBuilder.start() .add(MongoIndexRange.FIELD_BEGIN, 1) .add(MongoIndexRange.FIELD_END, 1) .get()); }
@Inject public DBCacheService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper) { db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection("lut_caches"), CacheDto.class, ObjectId.class, mapper.get()); db.createIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true)); }
@Inject public DBDataAdapterService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper) { db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection("lut_data_adapters"), DataAdapterDto.class, ObjectId.class, mapper.get()); 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 DBLookupTableService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper) { db = JacksonDBCollection.wrap(mongoConnection.getDatabase().getCollection("lut_tables"), LookupTableDto.class, ObjectId.class, mapper.get()); db.createIndex(new BasicDBObject("name", 1), new BasicDBObject("unique", true)); }
@Inject protected RoleServiceImpl(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, Permissions permissions, Validator validator) { this.validator = validator; dbCollection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(ROLES), RoleImpl.class, ObjectId.class, mapper.get()); // lower case role names are unique, this allows arbitrary naming, but still uses an index dbCollection.createIndex(new BasicDBObject(NAME_LOWER, 1), new BasicDBObject("unique", true)); // make sure the two built-in roles actually exist adminRoleObjectId = checkNotNull(ensureBuiltinRole(ADMIN_ROLENAME, Sets.newHashSet("*"), "Admin", "Grants all permissions for Graylog administrators (built-in)")); readerRoleObjectId = checkNotNull(ensureBuiltinRole(READER_ROLENAME, permissions.readerBasePermissions(), "Reader", "Grants basic permissions for every Graylog user (built-in)")); }
@Inject public MongoIndexRangeService(MongoConnection mongoConnection, MongoJackObjectMapperProvider objectMapperProvider, Indices indices, IndexSetRegistry indexSetRegistry, AuditEventSender auditEventSender, NodeId nodeId, EventBus eventBus) { this.indices = indices; this.indexSetRegistry = indexSetRegistry; this.auditEventSender = auditEventSender; this.nodeId = nodeId; this.collection = JacksonDBCollection.wrap( mongoConnection.getDatabase().getCollection(COLLECTION_NAME), MongoIndexRange.class, ObjectId.class, objectMapperProvider.get()); eventBus.register(this); collection.createIndex(new BasicDBObject(MongoIndexRange.FIELD_INDEX_NAME, 1)); collection.createIndex(BasicDBObjectBuilder.start() .add(MongoIndexRange.FIELD_BEGIN, 1) .add(MongoIndexRange.FIELD_END, 1) .get()); }