Search in sources :

Example 6 with MongoDbBatchWriterException

use of org.apache.rya.mongodb.batch.MongoDbBatchWriterException 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

MongoDbBatchWriterException (org.apache.rya.mongodb.batch.MongoDbBatchWriterException)6 RyaDAOException (org.apache.rya.api.persist.RyaDAOException)4 DBObject (com.mongodb.DBObject)2 IOException (java.io.IOException)2 RyaStatement (org.apache.rya.api.domain.RyaStatement)2 MongoDbBatchWriterConfig (org.apache.rya.mongodb.batch.MongoDbBatchWriterConfig)2 DbCollectionType (org.apache.rya.mongodb.batch.collection.DbCollectionType)2 ArrayList (java.util.ArrayList)1 LongAdder (java.util.concurrent.atomic.LongAdder)1 RyaSecondaryIndexer (org.apache.rya.api.persist.index.RyaSecondaryIndexer)1 ForwardChainException (org.apache.rya.forwardchain.ForwardChainException)1 SimpleMongoDBNamespaceManager (org.apache.rya.mongodb.dao.SimpleMongoDBNamespaceManager)1 SimpleMongoDBStorageStrategy (org.apache.rya.mongodb.dao.SimpleMongoDBStorageStrategy)1 Document (org.bson.Document)1 Bson (org.bson.conversions.Bson)1