final class MongoConfigImpl extends java.lang.Object implements MongoConfig
;; MongoDB client configuration [Mongo] ;; MongoDB hosts to connect to. Use comma-separated list for all hosts of a replicaSet. ;; example: hosts = "host1:27017,host2:27017" ; hosts = "127.0.0.1:27017" ;; MongoDB database name ; databaseName = "epagesj" ;; username in connect string ; username = ;; password in connect string ; password = ;; database connect options. See MongoDB documentation on topic Connection String: ;; http://docs.mongodb.org/master/single/index.html#document-reference/connection-string ; options = ;; Behavior of checking write results. Used in Spring Data MongoDB. ;; Possible values are: NONE, LOG, EXCEPTION. SeeWriteResultChecking
;; @since 6.15.0 ; writeResultChecking = "NONE" ;; Write Concern for writing to MongoDB. Possible values are: ;; NONE = No exceptions are raised, even for network issues ;; NORMAL = Exceptions are raised for network issues, but not server errors ;; SAFE = Exceptions are raised for network issues, and server errors; waits on a server for the write operation ;; MAJORITY = Exceptions are raised for network issues, and server errors; waits on a majority of servers for the write operation ;; FSYNC_SAFE = Exceptions are raised for network issues, and server errors; the write operation waits for the server to flush the data to disk ;; JOURNAL_SAFE = Exceptions are raised for network issues, and server errors; the write operation waits for the server to group commit to the journal file on disk ;; REPLICAS_SAFE = Exceptions are raised for network issues, and server errors; waits for at least 2 servers for the write operation ;; SeeWriteConcern
;; @since 6.15.0 ; writeConcern = "FSYNC_SAFE" ;; Default database record expiry time in seconds. This is making use of TTL feature from MongoDB 2.2+ ;; Used for caches, that use MongoDB for storing (e.g. attribute cache, category cache) ; expireAfterSeconds = 864000
Modifier and Type | Class and Description |
---|---|
static class |
MongoConfigImpl.ConfigurationProperty |
Modifier and Type | Field and Description |
---|---|
private org.apache.commons.configuration.DataConfiguration |
config |
private static java.lang.String |
DATABASENAME_DEFAULT |
private static int |
EXPIRE_AFTER_SECONDS_DEFAULT |
private static java.lang.String |
HOSTS_DEFAULT |
private static int |
SECONDS_IN_ONE_DAY |
private static java.lang.String |
WRITE_CONCERN_DEFAULT |
private static org.springframework.data.mongodb.core.WriteResultChecking |
WRITE_RESULT_CHECKING_DEFAULT |
private static java.lang.String |
WRITE_RESULT_CHECKING_DEFAULT_STRING |
Constructor and Description |
---|
MongoConfigImpl(org.apache.commons.configuration.DataConfiguration config) |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
credentialsExist() |
java.lang.String |
getDatabaseName() |
int |
getExpireAfterSeconds()
Used for caches, that write to MongoDB for storing values
(e.g.
|
java.lang.String |
getHosts() |
java.lang.String |
getOptions() |
java.lang.String |
getPassword() |
private <T> T |
getStaticFieldByFieldname(java.lang.Class<?> declaringClass,
java.lang.Class<T> returnType,
java.lang.String name) |
com.mongodb.MongoURI |
getURI()
|
java.lang.String |
getUsername() |
com.mongodb.WriteConcern |
getWriteConcern()
Controls safety-checking of write operations to MongoDB
|
org.springframework.data.mongodb.core.WriteResultChecking |
getWriteResultChecking()
Behavior of checking write results.
|
private static final int SECONDS_IN_ONE_DAY
private static final java.lang.String DATABASENAME_DEFAULT
private static final java.lang.String HOSTS_DEFAULT
private static final int EXPIRE_AFTER_SECONDS_DEFAULT
private static final java.lang.String WRITE_CONCERN_DEFAULT
private static final java.lang.String WRITE_RESULT_CHECKING_DEFAULT_STRING
private static final org.springframework.data.mongodb.core.WriteResultChecking WRITE_RESULT_CHECKING_DEFAULT
private final org.apache.commons.configuration.DataConfiguration config
@Inject public MongoConfigImpl(org.apache.commons.configuration.DataConfiguration config)
public com.mongodb.MongoURI getURI()
MongoConfig
getURI
in interface MongoConfig
boolean credentialsExist()
public java.lang.String getDatabaseName()
getDatabaseName
in interface MongoConfig
public int getExpireAfterSeconds()
MongoConfig
getExpireAfterSeconds
in interface MongoConfig
public java.lang.String getHosts()
getHosts
in interface MongoConfig
public java.lang.String getUsername()
getUsername
in interface MongoConfig
public java.lang.String getPassword()
getPassword
in interface MongoConfig
public java.lang.String getOptions()
getOptions
in interface MongoConfig
public org.springframework.data.mongodb.core.WriteResultChecking getWriteResultChecking()
MongoConfig
getWriteResultChecking
in interface MongoConfig
public com.mongodb.WriteConcern getWriteConcern()
MongoConfig
getWriteConcern
in interface MongoConfig
private <T> T getStaticFieldByFieldname(java.lang.Class<?> declaringClass, java.lang.Class<T> returnType, java.lang.String name)