|
Spring Data Document | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.mongodb.core.SimpleMongoDbFactory
public class SimpleMongoDbFactory
Factory to create DB
instances from a Mongo
instance.
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
---|---|
SimpleMongoDbFactory(Mongo mongo,
String databaseName)
Create an instance of SimpleMongoDbFactory given the Mongo instance and database name. |
|
SimpleMongoDbFactory(Mongo mongo,
String databaseName,
org.springframework.data.authentication.UserCredentials userCredentials)
Create an instance of SimpleMongoDbFactory given the Mongo instance, database name, and username/password |
Method Summary | |
---|---|
void |
destroy()
Clean up the Mongo instance. |
DB |
getDb()
Creates a default DB instance. |
DB |
getDb(String dbName)
Creates a DB instance to access the database with the given name. |
void |
setWriteConcern(WriteConcern writeConcern)
Configures the WriteConcern to be used on the DB instance being created. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public SimpleMongoDbFactory(Mongo mongo, String databaseName)
SimpleMongoDbFactory
given the Mongo
instance and database name.
mongo
- Mongo instance, must not be null.databaseName
- database name, not be null.public SimpleMongoDbFactory(Mongo mongo, String databaseName, org.springframework.data.authentication.UserCredentials userCredentials)
mongo
- Mongo instance, must not be null.databaseName
- Database name, must not be null.userCredentials
- username and password must not be null.Method Detail |
---|
public void setWriteConcern(WriteConcern writeConcern)
WriteConcern
to be used on the DB
instance being created.
writeConcern
- the writeConcern to setpublic DB getDb() throws DataAccessException
MongoDbFactory
DB
instance.
getDb
in interface MongoDbFactory
DataAccessException
public DB getDb(String dbName) throws DataAccessException
MongoDbFactory
DB
instance to access the database with the given name.
getDb
in interface MongoDbFactory
dbName
- must not be null or empty.
DataAccessException
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
|
Spring Data Document | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |