|
Spring Data Document | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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 |
|
SimpleMongoDbFactory(MongoURI uri)
Creates a new SimpleMongoDbFactory instance from the given MongoURI. |
|
| 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. |
WriteConcern |
getWriteConcern()
|
static String |
parseChars(char[] chars)
|
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.
public SimpleMongoDbFactory(MongoURI uri)
throws MongoException,
UnknownHostException
SimpleMongoDbFactory instance from the given MongoURI.
uri - must not be null.
MongoException
UnknownHostExceptionMongoURI| Method Detail |
|---|
public void setWriteConcern(WriteConcern writeConcern)
WriteConcern to be used on the DB instance being created.
writeConcern - the writeConcern to setpublic WriteConcern getWriteConcern()
public DB getDb()
throws DataAccessException
MongoDbFactoryDB instance.
getDb in interface MongoDbFactoryDataAccessException
public DB getDb(String dbName)
throws DataAccessException
MongoDbFactoryDB instance to access the database with the given name.
getDb in interface MongoDbFactorydbName - must not be null or empty.
DataAccessException
public void destroy()
throws Exception
destroy in interface DisposableBeanExceptionpublic static String parseChars(char[] chars)
|
Spring Data Document | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||