Class PdbProperties
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<Object,Object>
-
- java.util.Properties
-
- com.feedzai.commons.sql.abstraction.engine.configuration.PdbProperties
-
- All Implemented Interfaces:
Cloneable<PdbProperties>,Serializable,Cloneable,Map<Object,Object>
public class PdbProperties extends Properties implements Cloneable<PdbProperties>
Represents the possible properties to include when configuring the engine.- Since:
- 2.0.0
- Author:
- Rui Vilao (rui.vilao@feedzai.com)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringALLOW_COLUMN_DROPProperty to allow column drops on entity updates.static StringBLOB_BUFFER_SIZEThe blob buffer size propertystatic StringCHECK_CONNECTION_TIMEOUTProperty that indicates the maximum time taken when checking if a connection is available.static StringCOMPRESS_LOBSProperty that indicates the lobs should be compressed.static StringDISABLE_LOB_CACHINGProperty that indicates if LOB data caching should be disabled, to avoid consuming too much memory and/or disk space in the DB server.static StringDRIVERThe database driver.static StringENCRYPTED_PASSWORDThe property for using encrypted passwords.static StringENCRYPTED_USERNAMEThe property for using encrypted usernames.static StringENGINEThe engine property.static StringFETCH_SIZEProperty that indicates the fetch size for queries.static StringISOLATION_LEVELThe default isolation level.static StringJDBCThe JDBC property name.static StringLOGIN_TIMEOUTProperty that indicates the waiting time for the database connection to be established (in seconds).static StringMAX_BLOB_SIZEThe maximum blob size propertystatic StringMAX_IDENTIFIER_SIZEThe maximum identifier size propertystatic StringMAX_NUMBER_OF_RETRIESThe maximum number of retries.static StringMAXIMUM_TIME_BATCH_SHUTDOWNProperty that indicates how much time to wait for a batch to shutdown.static StringPASSWORDThe PASSWORD property name.static StringRECONNECT_ON_LOSTThe property of reconnection.static StringRETRY_INTERVALThe retry interval.static StringSCHEMADatabase schema property name.static StringSCHEMA_POLICYSchema policy property name.static StringSECRET_LOCATIONThe location of the private key for passwords.static StringSELECT_QUERY_TIMEOUTProperty that indicates the maximum time a select query is allowed to run, in seconds.static StringSOCKET_TIMEOUTProperty that indicates the time, in seconds, of socket timeout.static StringTRANSLATORThe translator.static StringUSERNAMEThe USERNAME property name.static StringVARCHAR_SIZEVARCHAR size property name.-
Fields inherited from class java.util.Properties
defaults
-
-
Constructor Summary
Constructors Constructor Description PdbProperties()Creates a new instance of an emptyPdbProperties.PdbProperties(boolean useDefaults)Creates a new instance ofPdbPropertieswith the default configuration.PdbProperties(Properties properties, boolean useDefaults)Merges the given properties with the default configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowColumnDrop()Checks if column drop is allowed when the schema changes.voidcheckMandatoryProperties()Checks if the configuration validates for mandatory properties.PdbPropertiesclone()Clones an object.intgetBlobBufferSize()Gets the blob buffer size.intgetCheckConnectionTimeout()Gets the check connection timeout (in seconds).StringgetDriver()Gets the driver property.StringgetEngine()Gets the engine.intgetFetchSize()Gets the fetch size.intgetIsolationLevel()Gets the isolation level.StringgetJdbc()Gets the JDBC URL.intgetLoginTimeout()Gets the socket login timeout (in seconds).intgetMaxBlobSize()Gets the maximum blob size.intgetMaxIdentifierSize()Gets the maximum identifier size.longgetMaximumAwaitTimeBatchShutdown()Gets the maximum await time for batches to shutdown.intgetMaxRetries()Gets the maximum number of retries.StringgetPassword()Gets the password.longgetRetryInterval()Gets the retry interval.StringgetSchema()Gets the database schema.intgetSelectQueryTimeout()Gets the query select timeout (in seconds).intgetSocketTimeout()Gets the socket connection timeout (in seconds).StringgetTranslator()Gets the translator class.StringgetUsername()Gets the username.booleanisDriverSet()Checks if the driver property is set.booleanisEncryptedPassword()Checks if password encryption is set.booleanisEncryptedUsername()Checks if username encryption is set.booleanisLobCachingDisabled()Checks if LOB data caching should be disabled.booleanisMaxBlobSizeSet()Checks if thegetMaxBlobSize()is set.booleanisReconnectOnLost()Checks if reconnect on connection lost is set.booleanisSchemaPolicyCreate()Checks if the schema policy is CREATE.booleanisSchemaPolicyCreateDrop()Checks if schema policy is CREATE DROP.booleanisSchemaPolicyDropCreate()Checks if schema policy is DROP CREATE.booleanisSchemaPolicyNone()Checks if schema policy is NONE.booleanisSchemaSet()Checks if the the schema is set.booleanisTranslatorSet()Checks if a provided translator class is set.voidmerge(Properties properties)Merges properties with the existing ones.voidsetProperty(String key, Object o)Adds a property object by converting it to string.booleanshouldCompressLobs()Checks if LOBS columns should be compressed.-
Methods inherited from class java.util.Properties
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
-
-
-
Field Detail
-
JDBC
public static final String JDBC
The JDBC property name.- See Also:
- Constant Field Values
-
USERNAME
public static final String USERNAME
The USERNAME property name.- See Also:
- Constant Field Values
-
PASSWORD
public static final String PASSWORD
The PASSWORD property name.- See Also:
- Constant Field Values
-
VARCHAR_SIZE
public static final String VARCHAR_SIZE
VARCHAR size property name.- See Also:
- Constant Field Values
-
SCHEMA_POLICY
public static final String SCHEMA_POLICY
Schema policy property name.- See Also:
- Constant Field Values
-
ENGINE
public static final String ENGINE
The engine property.- See Also:
- Constant Field Values
-
TRANSLATOR
public static final String TRANSLATOR
The translator.- See Also:
- Constant Field Values
-
SCHEMA
public static final String SCHEMA
Database schema property name.- See Also:
- Constant Field Values
-
MAX_IDENTIFIER_SIZE
public static final String MAX_IDENTIFIER_SIZE
The maximum identifier size property- See Also:
- Constant Field Values
-
MAX_BLOB_SIZE
public static final String MAX_BLOB_SIZE
The maximum blob size property- See Also:
- Constant Field Values
-
BLOB_BUFFER_SIZE
public static final String BLOB_BUFFER_SIZE
The blob buffer size property- See Also:
- Constant Field Values
-
MAX_NUMBER_OF_RETRIES
public static final String MAX_NUMBER_OF_RETRIES
The maximum number of retries.- See Also:
- Constant Field Values
-
RETRY_INTERVAL
public static final String RETRY_INTERVAL
The retry interval.- See Also:
- Constant Field Values
-
ISOLATION_LEVEL
public static final String ISOLATION_LEVEL
The default isolation level.- See Also:
- Constant Field Values
-
DRIVER
public static final String DRIVER
The database driver.- See Also:
- Constant Field Values
-
RECONNECT_ON_LOST
public static final String RECONNECT_ON_LOST
The property of reconnection.- See Also:
- Constant Field Values
-
ENCRYPTED_PASSWORD
public static final String ENCRYPTED_PASSWORD
The property for using encrypted passwords.- See Also:
- Constant Field Values
-
SECRET_LOCATION
public static final String SECRET_LOCATION
The location of the private key for passwords.- See Also:
- Constant Field Values
-
ENCRYPTED_USERNAME
public static final String ENCRYPTED_USERNAME
The property for using encrypted usernames.- See Also:
- Constant Field Values
-
ALLOW_COLUMN_DROP
public static final String ALLOW_COLUMN_DROP
Property to allow column drops on entity updates.- See Also:
- Constant Field Values
-
FETCH_SIZE
public static final String FETCH_SIZE
Property that indicates the fetch size for queries.- See Also:
- Constant Field Values
-
MAXIMUM_TIME_BATCH_SHUTDOWN
public static final String MAXIMUM_TIME_BATCH_SHUTDOWN
Property that indicates how much time to wait for a batch to shutdown.- See Also:
- Constant Field Values
-
COMPRESS_LOBS
public static final String COMPRESS_LOBS
Property that indicates the lobs should be compressed. This depends on the database implementation.- See Also:
- Constant Field Values
-
DISABLE_LOB_CACHING
public static final String DISABLE_LOB_CACHING
Property that indicates if LOB data caching should be disabled, to avoid consuming too much memory and/or disk space in the DB server. This depends on the database implementation.- See Also:
- Constant Field Values
-
LOGIN_TIMEOUT
public static final String LOGIN_TIMEOUT
Property that indicates the waiting time for the database connection to be established (in seconds). In some drivers this may refer only to the login timeout, in others it may refer to the total time to wait for getting a connection in addition to logging in.- See Also:
- Constant Field Values
-
SOCKET_TIMEOUT
public static final String SOCKET_TIMEOUT
Property that indicates the time, in seconds, of socket timeout.- See Also:
- Constant Field Values
-
SELECT_QUERY_TIMEOUT
public static final String SELECT_QUERY_TIMEOUT
Property that indicates the maximum time a select query is allowed to run, in seconds. No limit if zero. SeeStatement.setQueryTimeout(int).- See Also:
- Constant Field Values
-
CHECK_CONNECTION_TIMEOUT
public static final String CHECK_CONNECTION_TIMEOUT
Property that indicates the maximum time taken when checking if a connection is available.- Since:
- 2.7.2
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PdbProperties
public PdbProperties()
Creates a new instance of an emptyPdbProperties.
-
PdbProperties
public PdbProperties(boolean useDefaults)
Creates a new instance ofPdbPropertieswith the default configuration.- Parameters:
useDefaults-trueif default properties are to be set,falseotherwise.
-
PdbProperties
public PdbProperties(Properties properties, boolean useDefaults)
Merges the given properties with the default configuration.- Parameters:
properties- The properties to merge.useDefaults-trueif default properties are to be set,falseotherwise.
-
-
Method Detail
-
setProperty
public void setProperty(String key, Object o)
Adds a property object by converting it to string.- Parameters:
key- The key.o- The object to add.
-
merge
public final void merge(Properties properties)
Merges properties with the existing ones.- Parameters:
properties- The properties to merge.
-
isTranslatorSet
public boolean isTranslatorSet()
Checks if a provided translator class is set.- Returns:
trueif a provided translator class is set,falseotherwise.
-
isEncryptedUsername
public boolean isEncryptedUsername()
Checks if username encryption is set.- Returns:
trueif username encryption is set,falseotherwise.
-
isEncryptedPassword
public boolean isEncryptedPassword()
Checks if password encryption is set.- Returns:
trueif password encryption is set,falseotherwise.
-
getFetchSize
public int getFetchSize()
Gets the fetch size.- Returns:
- the fetch size.
-
getMaximumAwaitTimeBatchShutdown
public long getMaximumAwaitTimeBatchShutdown()
Gets the maximum await time for batches to shutdown.- Returns:
- The maximum await time for batches to shutdown.
-
isSchemaPolicyCreateDrop
public boolean isSchemaPolicyCreateDrop()
Checks if schema policy is CREATE DROP.- Returns:
trueif the schema is create-drop,falseotherwise.
-
isSchemaPolicyDropCreate
public boolean isSchemaPolicyDropCreate()
Checks if schema policy is DROP CREATE.- Returns:
trueif the schema is drop-create,falseotherwise.
-
isSchemaPolicyCreate
public boolean isSchemaPolicyCreate()
Checks if the schema policy is CREATE.- Returns:
trueif the schema is create,falseotherwise.
-
isSchemaPolicyNone
public boolean isSchemaPolicyNone()
Checks if schema policy is NONE.- Returns:
trueif the schema is none,falseotherwise.
-
getMaxIdentifierSize
public int getMaxIdentifierSize()
Gets the maximum identifier size.- Returns:
- Gets the maximum identifier size.
-
getMaxBlobSize
public int getMaxBlobSize()
Gets the maximum blob size.- Returns:
- Gets the maximum blob size.
-
isMaxBlobSizeSet
public boolean isMaxBlobSizeSet()
Checks if thegetMaxBlobSize()is set.- Returns:
trueif the maximum blob size is set,falseotherwise.
-
getBlobBufferSize
public int getBlobBufferSize()
Gets the blob buffer size.- Returns:
- The blob buffer size for Object -> ByteArray conversions.
-
getMaxRetries
public int getMaxRetries()
Gets the maximum number of retries.- Returns:
- Maximum number of retries.
-
getRetryInterval
public long getRetryInterval()
Gets the retry interval.- Returns:
- The retry interval.
-
isReconnectOnLost
public boolean isReconnectOnLost()
Checks if reconnect on connection lost is set.- Returns:
trueif the connection is uses reconnect on lost,falseotherwise.
-
shouldCompressLobs
public boolean shouldCompressLobs()
Checks if LOBS columns should be compressed.- Returns:
trueif LOBS should be compressed,falseotherwise.
-
isLobCachingDisabled
public boolean isLobCachingDisabled()
Checks if LOB data caching should be disabled.- Returns:
trueif LOB caching should be disabled,falseotherwise.
-
getIsolationLevel
public int getIsolationLevel()
Gets the isolation level.- Returns:
- The isolation level.
-
getJdbc
public String getJdbc()
Gets the JDBC URL.- Returns:
- The JDBC URL.
-
getUsername
public String getUsername()
Gets the username.- Returns:
- The username.
-
getPassword
public String getPassword()
Gets the password.- Returns:
- The password.
-
getEngine
public String getEngine()
Gets the engine.- Returns:
- The engine.
-
getTranslator
public String getTranslator()
Gets the translator class.- Returns:
- The translator class.
-
getSchema
public String getSchema()
Gets the database schema.- Returns:
- The database schema.
-
getLoginTimeout
public int getLoginTimeout()
Gets the socket login timeout (in seconds).- Returns:
- The socket login timeout.
-
getSocketTimeout
public int getSocketTimeout()
Gets the socket connection timeout (in seconds).- Returns:
- The socket connection timeout.
-
getSelectQueryTimeout
public int getSelectQueryTimeout()
Gets the query select timeout (in seconds).- Returns:
- The query select timeout.
-
getCheckConnectionTimeout
public int getCheckConnectionTimeout()
Gets the check connection timeout (in seconds).- Returns:
- The check connection timeout.
- Since:
- 2.7.2
-
isDriverSet
public boolean isDriverSet()
Checks if the driver property is set.- Returns:
trueif the driver property is set,falseotherwise.
-
isSchemaSet
public boolean isSchemaSet()
Checks if the the schema is set.- Returns:
trueif the schema is set,falseotherwise.
-
allowColumnDrop
public boolean allowColumnDrop()
Checks if column drop is allowed when the schema changes.- Returns:
trueif the column drop is allowed,falseotherwise.
-
checkMandatoryProperties
public void checkMandatoryProperties() throws PdbConfigurationExceptionChecks if the configuration validates for mandatory properties.- Throws:
PdbConfigurationException- If mandatory fields are not set.
-
clone
public PdbProperties clone()
Description copied from interface:CloneableClones an object.- Specified by:
clonein interfaceCloneable<PdbProperties>- Overrides:
clonein classProperties- Returns:
- The new instance of the object to be cloned.
-
getDriver
public String getDriver()
Gets the driver property.- Returns:
- The driver property.
-
-