Github user pujav65 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/48#discussion_r67527705
--- Diff: dao/mongodb.rya/src/main/java/mvm/rya/mongodb/MongoDBRyaDAO.java
---
@@ -179,85 +145,85 @@ public void destroy() throws RyaDAOException {
IOUtils.closeQuietly(queryEngine);
}
- public void add(RyaStatement statement) throws RyaDAOException {
- // add it to the collection
- try {
- coll.insert(storageStrategy.serialize(statement));
- for(RyaSecondaryIndexer index: secondaryIndexers) {
- index.storeStatement(statement);
- }
- }
- catch (com.mongodb.MongoException.DuplicateKey exception){
- // ignore
- }
- catch (com.mongodb.DuplicateKeyException exception){
- // ignore
- }
- catch (Exception ex){
- // ignore single exceptions
- ex.printStackTrace();
- }
- }
-
- public void add(Iterator<RyaStatement> statement) throws
RyaDAOException {
- List<DBObject> dbInserts = new ArrayList<DBObject>();
- while (statement.hasNext()){
- RyaStatement ryaStatement = statement.next();
- DBObject insert =
storageStrategy.serialize(ryaStatement);
- dbInserts.add(insert);
-
+ @Override
+ public void add(final RyaStatement statement) throws RyaDAOException {
+ // add it to the collection
+ try {
+ coll.insert(storageStrategy.serialize(statement));
+ for(final RyaSecondaryIndexer index: secondaryIndexers) {
+ index.storeStatement(statement);
+ }
+ } catch (final IOException e) {
+ log.error("Unable to add: " + statement.toString());
+ throw new RyaDAOException(e);
+ }
+ }
+
+ @Override
+ public void add(final Iterator<RyaStatement> statement) throws
RyaDAOException {
+ final List<DBObject> dbInserts = new ArrayList<DBObject>();
+ while (statement.hasNext()){
+ final RyaStatement ryaStatement = statement.next();
+ final DBObject insert =
storageStrategy.serialize(ryaStatement);
+ dbInserts.add(insert);
+
try {
- for (RyaSecondaryIndexer index : secondaryIndexers) {
+ for (final RyaSecondaryIndexer index : secondaryIndexers) {
index.storeStatement(ryaStatement);
}
- } catch (IOException e) {
- throw new RyaDAOException(e);
+ } catch (final IOException e) {
+ log.error("Failed to add: " + ryaStatement.toString() + "
to the indexer");
}
-
- }
- coll.insert(dbInserts, new
InsertOptions().continueOnError(true));
- }
-
- public void delete(RyaStatement statement, MongoDBRdfConfiguration conf)
- throws RyaDAOException {
- DBObject obj = storageStrategy.getQuery(statement);
- coll.remove(obj);
- }
-
- public void dropGraph(MongoDBRdfConfiguration conf, RyaURI... graphs)
- throws RyaDAOException {
-
- }
-
- public void delete(Iterator<RyaStatement> statements,
- MongoDBRdfConfiguration conf) throws RyaDAOException {
- while (statements.hasNext()){
- RyaStatement ryaStatement = statements.next();
- coll.remove(storageStrategy.getQuery(ryaStatement));
- }
-
- }
-
- public String getVersion() throws RyaDAOException {
- return "1.0";
- }
-
- public RyaQueryEngine<MongoDBRdfConfiguration> getQueryEngine() {
- return queryEngine;
- }
-
- public RyaNamespaceManager<MongoDBRdfConfiguration>
getNamespaceManager() {
- return nameSpaceManager;
- }
-
- public void purge(RdfCloudTripleStoreConfiguration configuration) {
- // TODO Auto-generated method stub
-
- }
-
- public void dropAndDestroy() throws RyaDAOException {
- db.dropDatabase(); // this is dangerous!
- }
+ }
+ coll.insert(dbInserts, new InsertOptions().continueOnError(true));
--- End diff --
ok does the continue on error catch them?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---