diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/DBCallback.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/DbCallback.java similarity index 93% rename from spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/DBCallback.java rename to spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/DbCallback.java index 5545865a1..a54efdd0f 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/DBCallback.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/DbCallback.java @@ -20,8 +20,7 @@ import org.springframework.dao.DataAccessException; import com.mongodb.DB; import com.mongodb.MongoException; -public interface DBCallback { +public interface DbCallback { T doInDB(DB db) throws MongoException, DataAccessException; - } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/MongoOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/MongoOperations.java index 544218fd0..d50012e3a 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/MongoOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/MongoOperations.java @@ -62,7 +62,7 @@ public interface MongoOperations { void executeCommand(DBObject command); /** - * Executes a {@link DBCallback} translating any exceptions as necessary. + * Executes a {@link DbCallback} translating any exceptions as necessary. * * Allows for returning a result object, that is a domain object or a collection of domain objects. * @@ -71,7 +71,7 @@ public interface MongoOperations { * * @return a result object returned by the action or null */ - T execute(DBCallback action); + T execute(DbCallback action); /** * Executes the given {@link CollectionCallback} on the default collection. @@ -98,7 +98,7 @@ public interface MongoOperations { T execute(CollectionCallback action, String collectionName); /** - * Executes the given {@link DBCallback} within the same connection to the database so as to ensure + * Executes the given {@link DbCallback} within the same connection to the database so as to ensure * consistency in a write heavy environment where you may read the data that you wrote. See the * comments on {@see Java Driver Concurrency} * @@ -108,7 +108,7 @@ public interface MongoOperations { * @param action callback that specified the MongoDB actions to perform on the DB instance * @return a result object returned by the action or null */ - T executeInSession(DBCallback action); + T executeInSession(DbCallback action); /** * Create an uncapped collection with the provided name. diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/MongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/MongoTemplate.java index 7ccfe2f40..4a256ca10 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/MongoTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/document/mongodb/MongoTemplate.java @@ -138,7 +138,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations { */ public DBCollection getDefaultCollection() { - return execute(new DBCallback() { + return execute(new DbCallback() { public DBCollection doInDB(DB db) throws MongoException, DataAccessException { return db.getCollection(getDefaultCollectionName()); } @@ -157,7 +157,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations { */ public void executeCommand(final DBObject command) { - CommandResult result = execute(new DBCallback() { + CommandResult result = execute(new DbCallback() { public CommandResult doInDB(DB db) throws MongoException, DataAccessException { return db.command(command); } @@ -246,9 +246,9 @@ public class MongoTemplate implements InitializingBean, MongoOperations { /* (non-Javadoc) * @see org.springframework.data.document.mongodb.MongoOperations#executeInSession(org.springframework.data.document.mongodb.DBCallback) */ - public T executeInSession(final DBCallback action) { + public T executeInSession(final DbCallback action) { - return execute(new DBCallback() { + return execute(new DbCallback() { public T doInDB(DB db) throws MongoException, DataAccessException { try { db.requestStart(); @@ -264,7 +264,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations { * @see org.springframework.data.document.mongodb.MongoOperations#createCollection(java.lang.String) */ public DBCollection createCollection(final String collectionName) { - return execute(new DBCallback() { + return execute(new DbCallback() { public DBCollection doInDB(DB db) throws MongoException, DataAccessException { return db.createCollection(collectionName, new BasicDBObject()); } @@ -275,7 +275,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations { * @see org.springframework.data.document.mongodb.MongoOperations#createCollection(java.lang.String, org.springframework.data.document.mongodb.CollectionOptions) */ public void createCollection(final String collectionName, final CollectionOptions collectionOptions) { - execute(new DBCallback() { + execute(new DbCallback() { public Void doInDB(DB db) throws MongoException, DataAccessException { db.createCollection(collectionName, convertToDbObject(collectionOptions)); return null; @@ -287,7 +287,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations { * @see org.springframework.data.document.mongodb.MongoOperations#getCollection(java.lang.String) */ public DBCollection getCollection(final String collectionName) { - return execute(new DBCallback() { + return execute(new DbCallback() { public DBCollection doInDB(DB db) throws MongoException, DataAccessException { return db.getCollection(collectionName); } @@ -299,7 +299,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations { * @see org.springframework.data.document.mongodb.MongoOperations#collectionExists(java.lang.String) */ public boolean collectionExists(final String collectionName) { - return execute(new DBCallback() { + return execute(new DbCallback() { public Boolean doInDB(DB db) throws MongoException, DataAccessException { return db.collectionExists(collectionName); } @@ -544,7 +544,7 @@ public class MongoTemplate implements InitializingBean, MongoOperations { * @see org.springframework.data.document.mongodb.MongoOperations#getCollectionNames() */ public Set getCollectionNames() { - return execute(new DBCallback>() { + return execute(new DbCallback>() { public Set doInDB(DB db) throws MongoException, DataAccessException { return db.getCollectionNames(); }