Search in sources :

Example 1 with SimpleMongoDBNamespaceManager

use of org.apache.rya.mongodb.dao.SimpleMongoDBNamespaceManager in project incubator-rya by apache.

the class MongoDBRyaDAO method init.

@Override
public void init() throws RyaDAOException {
    if (isInitialized.get()) {
        return;
    }
    secondaryIndexers = conf.getAdditionalIndexers();
    for (final MongoSecondaryIndex index : secondaryIndexers) {
        index.setConf(conf);
    }
    db = mongoClient.getDB(conf.get(MongoDBRdfConfiguration.MONGO_DB_NAME));
    coll = db.getCollection(conf.getTriplesCollectionName());
    nameSpaceManager = new SimpleMongoDBNamespaceManager(db.getCollection(conf.getNameSpacesCollectionName()));
    queryEngine = new MongoDBQueryEngine();
    queryEngine.setConf(conf);
    storageStrategy = new SimpleMongoDBStorageStrategy();
    storageStrategy.createIndices(coll);
    for (final MongoSecondaryIndex index : secondaryIndexers) {
        index.init();
    }
    final MongoDbBatchWriterConfig mongoDbBatchWriterConfig = MongoDbBatchWriterUtils.getMongoDbBatchWriterConfig(conf);
    mongoDbBatchWriter = new MongoDbBatchWriter<>(new DbCollectionType(coll), mongoDbBatchWriterConfig);
    try {
        mongoDbBatchWriter.start();
    } catch (final MongoDbBatchWriterException e) {
        throw new RyaDAOException("Error starting MongoDB batch writer", e);
    }
    isInitialized.set(true);
}
Also used : SimpleMongoDBNamespaceManager(org.apache.rya.mongodb.dao.SimpleMongoDBNamespaceManager) RyaDAOException(org.apache.rya.api.persist.RyaDAOException) MongoDbBatchWriterConfig(org.apache.rya.mongodb.batch.MongoDbBatchWriterConfig) DbCollectionType(org.apache.rya.mongodb.batch.collection.DbCollectionType) SimpleMongoDBStorageStrategy(org.apache.rya.mongodb.dao.SimpleMongoDBStorageStrategy) MongoDbBatchWriterException(org.apache.rya.mongodb.batch.MongoDbBatchWriterException)

Aggregations

RyaDAOException (org.apache.rya.api.persist.RyaDAOException)1 MongoDbBatchWriterConfig (org.apache.rya.mongodb.batch.MongoDbBatchWriterConfig)1 MongoDbBatchWriterException (org.apache.rya.mongodb.batch.MongoDbBatchWriterException)1 DbCollectionType (org.apache.rya.mongodb.batch.collection.DbCollectionType)1 SimpleMongoDBNamespaceManager (org.apache.rya.mongodb.dao.SimpleMongoDBNamespaceManager)1 SimpleMongoDBStorageStrategy (org.apache.rya.mongodb.dao.SimpleMongoDBStorageStrategy)1