Class MorphiumConfig


  • public class MorphiumConfig
    extends Object
    Stores the configuration for the MongoDBLayer.
    Author:
    stephan
    • Constructor Detail

      • MorphiumConfig

        public MorphiumConfig​(Properties prop)
      • MorphiumConfig

        public MorphiumConfig()
      • MorphiumConfig

        public MorphiumConfig​(String db,
                              int maxConnections,
                              int globalCacheValidTime,
                              int housekeepingTimeout)
    • Method Detail

      • getPropertyNames

        public static List<String> getPropertyNames​(String prefix)
      • getMessagingWindowSize

        public int getMessagingWindowSize()
      • setMessagingWindowSize

        public void setMessagingWindowSize​(int messagingWindowSize)
      • isAtlas

        public boolean isAtlas()
      • getAtlasUrl

        public String getAtlasUrl()
      • setAtlasUrl

        public void setAtlasUrl​(String atlasUrl)
      • isReplicaset

        public boolean isReplicaset()
      • setReplicasetMonitoring

        public MorphiumConfig setReplicasetMonitoring​(boolean replicaset)
      • setEncryptionKeyProviderClass

        public void setEncryptionKeyProviderClass​(Class<? extends EncryptionKeyProvider> encryptionKeyProviderClass)
      • getCredentialsEncryptionKey

        public String getCredentialsEncryptionKey()
      • setCredentialsEncryptionKey

        public MorphiumConfig setCredentialsEncryptionKey​(String credentialsEncryptionKey)
      • getCredentialsDecryptionKey

        public String getCredentialsDecryptionKey()
      • setCredentialsDecryptionKey

        public MorphiumConfig setCredentialsDecryptionKey​(String credentialsDecryptionKey)
      • getDriverName

        public String getDriverName()
      • isAutoIndexAndCappedCreationOnWrite

        public boolean isAutoIndexAndCappedCreationOnWrite()
      • setAutoIndexAndCappedCreationOnWrite

        public MorphiumConfig setAutoIndexAndCappedCreationOnWrite​(boolean autoIndexAndCappedCreationOnWrite)
      • isWarnOnNoEntitySerialization

        public boolean isWarnOnNoEntitySerialization()
      • setWarnOnNoEntitySerialization

        public void setWarnOnNoEntitySerialization​(boolean warnOnNoEntitySerialization)
      • isCheckForNew

        public boolean isCheckForNew()
      • setCheckForNew

        public MorphiumConfig setCheckForNew​(boolean checkForNew)
        if set to false, all checks if an entity is new when CreationTime is used is switched off if set to true, only those, whose CreationTime settings use checkfornew will work default false
        Parameters:
        checkForNew - boolean, check if object is really not stored yet
      • getRetriesOnNetworkError

        public int getRetriesOnNetworkError()
      • setRetriesOnNetworkError

        public MorphiumConfig setRetriesOnNetworkError​(int retriesOnNetworkError)
      • getSleepBetweenNetworkErrorRetries

        public int getSleepBetweenNetworkErrorRetries()
      • setSleepBetweenNetworkErrorRetries

        public MorphiumConfig setSleepBetweenNetworkErrorRetries​(int sleepBetweenNetworkErrorRetries)
      • getReplicaSetMonitoringTimeout

        public int getReplicaSetMonitoringTimeout()
      • setReplicaSetMonitoringTimeout

        public MorphiumConfig setReplicaSetMonitoringTimeout​(int replicaSetMonitoringTimeout)
      • getWriteBufferTimeGranularity

        public int getWriteBufferTimeGranularity()
      • setWriteBufferTimeGranularity

        public MorphiumConfig setWriteBufferTimeGranularity​(int writeBufferTimeGranularity)
      • getWriteBufferTime

        public int getWriteBufferTime()
      • setWriteBufferTime

        public MorphiumConfig setWriteBufferTime​(int writeBufferTime)
      • getGlobalW

        public int getGlobalW()
      • getThreadConnectionMultiplier

        public int getThreadConnectionMultiplier()
      • setThreadConnectionMultiplier

        public void setThreadConnectionMultiplier​(int threadConnectionMultiplier)
      • isGlobalJ

        public boolean isGlobalJ()
      • isGlobalFsync

        public boolean isGlobalFsync()
      • setGlobalFsync

        public MorphiumConfig setGlobalFsync​(boolean globalFsync)
      • getConnectionTimeout

        public int getConnectionTimeout()
      • setConnectionTimeout

        public MorphiumConfig setConnectionTimeout​(int connectionTimeout)
      • getMaxWaitTime

        public int getMaxWaitTime()
      • setMaxWaitTime

        public MorphiumConfig setMaxWaitTime​(int maxWaitTime)
        Sets the maximum time that a thread will block waiting for a connection.
        Parameters:
        maxWaitTime - the maximum wait time, in milliseconds
        Returns:
        this
      • getServerSelectionTimeout

        public int getServerSelectionTimeout()
      • setServerSelectionTimeout

        public MorphiumConfig setServerSelectionTimeout​(int serverSelectionTimeout)

        Sets the server selection timeout in milliseconds, which defines how long the driver will wait for server selection to succeed before throwing an exception.

        A value of 0 means that it will timeout immediately if no server is available. A negative value means to wait indefinitely.

        Parameters:
        serverSelectionTimeout - the server selection timeout, in milliseconds
        Returns:
        this
      • getCredentialsEncrypted

        public Boolean getCredentialsEncrypted()
      • setCredentialsEncrypted

        public MorphiumConfig setCredentialsEncrypted​(Boolean credentialsEncrypted)
      • getMongoAuthDb

        public String getMongoAuthDb()
      • decryptAuthDb

        public String decryptAuthDb()
      • decryptMongoLogin

        public String decryptMongoLogin()
      • decryptMongoPassword

        public String decryptMongoPassword()
      • getMongoLogin

        public String getMongoLogin()
      • getMongoPassword

        public String getMongoPassword()
      • getDefaultReadPreference

        public ReadPreference getDefaultReadPreference()
      • getDefaultReadPreferenceType

        public String getDefaultReadPreferenceType()
      • setDefaultReadPreferenceType

        public MorphiumConfig setDefaultReadPreferenceType​(String stringDefaultReadPreference)
      • getWriteCacheTimeout

        public int getWriteCacheTimeout()
      • setWriteCacheTimeout

        public MorphiumConfig setWriteCacheTimeout​(int writeCacheTimeout)
      • setHostSeed

        public MorphiumConfig setHostSeed​(List<String> str)
        setting hosts as Host:Port
        Parameters:
        str - list of hosts, with or without port
      • getMaxConnections

        public int getMaxConnections()
      • setMaxConnections

        public MorphiumConfig setMaxConnections​(int maxConnections)
      • getGlobalCacheValidTime

        public int getGlobalCacheValidTime()
        for future use - set Global Caching time
        Returns:
        the global cache valid time
      • setGlobalCacheValidTime

        public MorphiumConfig setGlobalCacheValidTime​(int globalCacheValidTime)
      • getDatabase

        public String getDatabase()
      • getHousekeepingTimeout

        public int getHousekeepingTimeout()
      • setHousekeepingTimeout

        public MorphiumConfig setHousekeepingTimeout​(int housekeepingTimeout)
      • getValidTime

        public long getValidTime()
      • toString

        public String toString()
        returns json representation of this object containing all values
        Overrides:
        toString in class Object
        Returns:
        json string
      • getMaximumRetriesBufferedWriter

        public int getMaximumRetriesBufferedWriter()
      • setMaximumRetriesBufferedWriter

        public MorphiumConfig setMaximumRetriesBufferedWriter​(int maximumRetriesBufferedWriter)
      • getMaximumRetriesWriter

        public int getMaximumRetriesWriter()
      • setMaximumRetriesWriter

        public MorphiumConfig setMaximumRetriesWriter​(int maximumRetriesWriter)
      • getMaximumRetriesAsyncWriter

        public int getMaximumRetriesAsyncWriter()
      • setMaximumRetriesAsyncWriter

        public MorphiumConfig setMaximumRetriesAsyncWriter​(int maximumRetriesAsyncWriter)
      • getRetryWaitTimeBufferedWriter

        public int getRetryWaitTimeBufferedWriter()
      • setRetryWaitTimeBufferedWriter

        public MorphiumConfig setRetryWaitTimeBufferedWriter​(int retryWaitTimeBufferedWriter)
      • getRetryWaitTimeWriter

        public int getRetryWaitTimeWriter()
      • setRetryWaitTimeWriter

        public MorphiumConfig setRetryWaitTimeWriter​(int retryWaitTimeWriter)
      • getRetryWaitTimeAsyncWriter

        public int getRetryWaitTimeAsyncWriter()
      • setRetryWaitTimeAsyncWriter

        public MorphiumConfig setRetryWaitTimeAsyncWriter​(int retryWaitTimeAsyncWriter)
      • asProperties

        public Properties asProperties()
        returns a property set only containing non-default values set
        Returns:
        properties
      • asProperties

        public Properties asProperties​(String prefix,
                                       boolean effectiveConfig)
        Parameters:
        prefix - prefix to use in property keys
        effectiveConfig - when true, use the current effective config, including overrides from Environment
        Returns:
        the properties
      • isReadCacheEnabled

        public boolean isReadCacheEnabled()
      • setReadCacheEnabled

        public MorphiumConfig setReadCacheEnabled​(boolean readCacheEnabled)
      • isAsyncWritesEnabled

        public boolean isAsyncWritesEnabled()
      • setAsyncWritesEnabled

        public MorphiumConfig setAsyncWritesEnabled​(boolean asyncWritesEnabled)
      • isBufferedWritesEnabled

        public boolean isBufferedWritesEnabled()
      • setBufferedWritesEnabled

        public MorphiumConfig setBufferedWritesEnabled​(boolean bufferedWritesEnabled)
      • disableBufferedWrites

        public MorphiumConfig disableBufferedWrites()
      • isAutoValuesEnabled

        public boolean isAutoValuesEnabled()
      • setAutoValuesEnabled

        public MorphiumConfig setAutoValuesEnabled​(boolean enabled)
      • isCamelCaseConversionEnabled

        public boolean isCamelCaseConversionEnabled()
      • setCamelCaseConversionEnabled

        public MorphiumConfig setCamelCaseConversionEnabled​(boolean camelCaseConversionEnabled)
      • getThreadPoolMessagingCoreSize

        public int getThreadPoolMessagingCoreSize()
      • setThreadPoolMessagingCoreSize

        public MorphiumConfig setThreadPoolMessagingCoreSize​(int threadPoolMessagingCoreSize)
      • getThreadPoolMessagingMaxSize

        public int getThreadPoolMessagingMaxSize()
      • setThreadPoolMessagingMaxSize

        public MorphiumConfig setThreadPoolMessagingMaxSize​(int threadPoolMessagingMaxSize)
      • getThreadPoolMessagingKeepAliveTime

        public long getThreadPoolMessagingKeepAliveTime()
      • setThreadPoolMessagingKeepAliveTime

        public MorphiumConfig setThreadPoolMessagingKeepAliveTime​(long threadPoolMessagingKeepAliveTime)
      • getThreadPoolAsyncOpCoreSize

        public int getThreadPoolAsyncOpCoreSize()
      • setThreadPoolAsyncOpCoreSize

        public MorphiumConfig setThreadPoolAsyncOpCoreSize​(int threadPoolAsyncOpCoreSize)
      • getThreadPoolAsyncOpMaxSize

        public int getThreadPoolAsyncOpMaxSize()
      • setThreadPoolAsyncOpMaxSize

        public MorphiumConfig setThreadPoolAsyncOpMaxSize​(int threadPoolAsyncOpMaxSize)
      • getThreadPoolAsyncOpKeepAliveTime

        public long getThreadPoolAsyncOpKeepAliveTime()
      • setThreadPoolAsyncOpKeepAliveTime

        public MorphiumConfig setThreadPoolAsyncOpKeepAliveTime​(long threadPoolAsyncOpKeepAliveTime)
      • isObjectSerializationEnabled

        public boolean isObjectSerializationEnabled()
      • setObjectSerializationEnabled

        public MorphiumConfig setObjectSerializationEnabled​(boolean objectSerializationEnabled)
      • getHeartbeatFrequency

        public int getHeartbeatFrequency()
      • setHeartbeatFrequency

        public MorphiumConfig setHeartbeatFrequency​(int heartbeatFrequency)
      • getMinConnectionsHost

        public int getMinConnectionsHost()
      • setMinConnections

        public MorphiumConfig setMinConnections​(int minConnections)
      • getLocalThreshold

        public int getLocalThreshold()
      • setLocalThreshold

        public MorphiumConfig setLocalThreshold​(int localThreshold)

        Sets the local threshold. When choosing among multiple MongoDB servers to send a request, the MongoClient will only send that request to a server whose ping time is less than or equal to the server with the fastest ping time plus the local threshold.

        For example, let's say that the client is choosing a server to send a query when the read preference is ReadPreference.secondary(), and that there are three secondaries, server1, server2, and server3, whose ping times are 10, 15, and 16 milliseconds, respectively. With a local threshold of 5 milliseconds, the client will send the query to either server1 or server2 (randomly selecting between the two).

        Default is 15 milliseconds.

        Returns:
        the local threshold, in milliseconds
        Since:
        2.13.0
      • getMaxConnectionIdleTime

        public int getMaxConnectionIdleTime()
      • setMaxConnectionIdleTime

        public MorphiumConfig setMaxConnectionIdleTime​(int maxConnectionIdleTime)
      • getMaxConnectionLifeTime

        public int getMaxConnectionLifeTime()
      • setMaxConnectionLifeTime

        public MorphiumConfig setMaxConnectionLifeTime​(int maxConnectionLifeTime)
      • getRequiredReplicaSetName

        public String getRequiredReplicaSetName()
      • setRequiredReplicaSetName

        public MorphiumConfig setRequiredReplicaSetName​(String requiredReplicaSetName)
      • getDefaultTags

        public String getDefaultTags()
      • getCursorBatchSize

        public int getCursorBatchSize()
      • setCursorBatchSize

        public MorphiumConfig setCursorBatchSize​(int cursorBatchSize)
      • getSslContext

        public SSLContext getSslContext()
      • setSslContext

        public void setSslContext​(SSLContext sslContext)
      • isUseSSL

        public boolean isUseSSL()
      • setUseSSL

        public void setUseSSL​(boolean useSSL)
      • isSslInvalidHostNameAllowed

        public boolean isSslInvalidHostNameAllowed()
      • setSslInvalidHostNameAllowed

        public void setSslInvalidHostNameAllowed​(boolean sslInvalidHostNameAllowed)
      • getReadTimeout

        public int getReadTimeout()
      • setReadTimeout

        public void setReadTimeout​(int readTimeout)
      • isRetryReads

        public boolean isRetryReads()
      • setRetryReads

        public void setRetryReads​(boolean retryReads)
      • isRetryWrites

        public boolean isRetryWrites()
      • setRetryWrites

        public void setRetryWrites​(boolean retryWrites)
      • getUuidRepresentation

        public String getUuidRepresentation()
      • setUuidRepresentation

        public void setUuidRepresentation​(String uuidRepresentation)
        Sets the UUID representation to use when encoding instances of UUID and when decoding BSON binary values with subtype of 3.

        The default is UNSPECIFIED, If your application stores UUID values in MongoDB, you must set this value to the desired representation. New applications should prefer STANDARD, while existing Java applications should prefer JAVA_LEGACY. Applications wishing to interoperate with existing Python or .NET applications should prefer PYTHON_LEGACY or C_SHARP_LEGACY, respectively. Applications that do not store UUID values in MongoDB don't need to set this value.

        Parameters:
        uuidRepresentation - the UUID representation
        Since:
        3.12