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);
}
Aggregations