Package rs.baselib.sql
Interface IJdbcConnectionProvider2
- All Superinterfaces:
IJdbcConnectionProvider
- All Known Implementing Classes:
AbstractJdbcConnectionProvider
,HyperSqlFileJdbcConnectionProvider
,HyperSqlServerJdbcConnectionProvider
,MySql5JdbcConnectionProvider
Enhanced
IJdbcConnectionProvider
which allows more
control on connection provider settings.- Author:
- ralph
-
Method Summary
Modifier and TypeMethodDescriptiongetAdditionalArgument
(int index, String s) Returns the additional argument to be used for URL construction.int
Returns the number of additional arguments this provider knows about.getAdditionalArgumentName
(int index) Returns the name of the additional argument.String[]
Returns the names of additional arguments.getDbLogin
(String s) Returns the DB login argument to be used for URL construction.Returns the DB name argument to be used for URL construction.Returns the DB password argument to be used for URL construction.getDefaultAdditionalArgument
(int index) Returns the default additional argument to be used when it is disabled or actual value is empty.Returns the default DB login argument to be used when DB login argument is disabled or actual value is empty.Returns the default DB name argument to be used when DB name argument is disabled or actual value is empty.Returns the default DB password argument to be used when DB password argument is disabled or actual value is empty.Returns the default host argument to be used when host argument is disabled or actual value is empty.Returns the default port argument to be used when port argument is disabled or actual value is empty.getDriverParameter
(String name) Returns the value of th edriver parameter.int
Returns the number of additional driver parameters.Returns the URL driver parameter string to be used inurl
.Returns the host argument to be used for URL construction.Returns the port argument to be used for URL construction.boolean
isAdditionalArgumentEnabled
(int index) Returns whether additional argument is enabled.boolean
Returns whether DB login argument is enabled.boolean
Returns whether DB name argument is enabled.boolean
Returns whether DB password argument is enabled.boolean
Returns whether host argument is enabled.boolean
Returns whether port argument is enabled.void
setAdditionalArgument
(int index, String name, boolean enabled, String defaultValue) void
setAdditionalArgumentEnabled
(int index, boolean b) Sets whether additional argument is enabled.void
setAdditionalArgumentName
(int index, String s) Sets the name of the additional argument.void
setDbLogin
(boolean enabled, String defaultValue) A shortcut method forsetDbLoginEnabled(boolean)
andsetDefaultDbLogin(String)
.void
setDbLoginEnabled
(boolean b) Sets whether DB login argument is enabled.void
A shortcut method forsetDbNameEnabled(boolean)
andsetDefaultDbName(String)
.void
setDbNameEnabled
(boolean b) Sets whether DB name argument is enabled.void
setDbPassword
(boolean enabled, String defaultValue) A shortcut method forsetDbPasswordEnabled(boolean)
andsetDefaultDbPassword(String)
.void
setDbPasswordEnabled
(boolean b) Sets whether DB password argument is enabled.void
setDefaultAdditionalArgument
(int index, String s) Sets the default additional argument to be used when it is disabled or actual value is empty.void
Sets the default DB login argument to be used when DB login argument is disabled or actual value is empty.void
Sets the default DB name argument to be used when DB name argument is disabled or actual value is empty.void
Sets the default DB password argument to be used when DB password argument is disabled or actual value is empty.void
Sets the default host argument to be used when host argument is disabled or actual value is empty.void
Sets the default port argument to be used when port argument is disabled or actual value is empty.void
setDriverParameter
(String name, String value) Sets a driver parameter value or deletes it.void
A shortcut method forsetHostEnabled(boolean)
andsetDefaultHost(String)
.void
setHostEnabled
(boolean b) Sets whether host argument is enabled.void
A shortcut method forsetPortEnabled(boolean)
andsetDefaultPort(String)
.void
setPortEnabled
(boolean b) Sets whether port argument is enabled.Methods inherited from interface rs.baselib.sql.IJdbcConnectionProvider
getConnection, getDbDriverClassName, getDriverUrl
-
Method Details
-
getHost
Returns the host argument to be used for URL construction. Descendants can override this method when they have more sophisticated algorithms to determine the host argument. This implementation returns the default host when the passed string is either empty or host argument was disabled.- Parameters:
s
- the string containing an actual host argument- Returns:
- the argument to be used in URL construction
- See Also:
-
isHostEnabled
boolean isHostEnabled()Returns whether host argument is enabled. The information can be used for UI developers to control the input flow.- Returns:
true
whenhost
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setHostEnabled
void setHostEnabled(boolean b) Sets whether host argument is enabled. The information can be used for UI developers to control the input flow.- Parameters:
b
-true
whenhost
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setHost
A shortcut method forsetHostEnabled(boolean)
andsetDefaultHost(String)
.- Parameters:
enabled
- whether to enable host argumentdefaultValue
- the default value
-
getDefaultHost
String getDefaultHost()Returns the default host argument to be used when host argument is disabled or actual value is empty.- Returns:
- default value
-
setDefaultHost
Sets the default host argument to be used when host argument is disabled or actual value is empty.- Parameters:
s
- default value
-
getPort
Returns the port argument to be used for URL construction. Descendants can override this method when they have more sophisticated algorithms to determine the port argument. This implementation returns the default port when the passed string is either empty or port argument was disabled.- Parameters:
s
- the string containing an actual port argument- Returns:
- the argument to be used in URL construction
- See Also:
-
isPortEnabled
boolean isPortEnabled()Returns whether port argument is enabled. The information can be used for UI developers to control the input flow.- Returns:
true
whenport
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setPortEnabled
void setPortEnabled(boolean b) Sets whether port argument is enabled. The information can be used for UI developers to control the input flow.- Parameters:
b
-true
whenport
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setPort
A shortcut method forsetPortEnabled(boolean)
andsetDefaultPort(String)
.- Parameters:
enabled
- whether to enable port argumentdefaultValue
- the default value
-
getDefaultPort
String getDefaultPort()Returns the default port argument to be used when port argument is disabled or actual value is empty.- Returns:
- default value
-
setDefaultPort
Sets the default port argument to be used when port argument is disabled or actual value is empty.- Parameters:
s
- default value
-
getDbName
Returns the DB name argument to be used for URL construction. Descendants can override this method when they have more sophisticated algorithms to determine the DB name argument. This implementation returns the default DB name when the passed string is either empty or DB name argument was disabled.- Parameters:
s
- the string containing an actual DB name argument- Returns:
- the argument to be used in URL construction
- See Also:
-
isDbNameEnabled
boolean isDbNameEnabled()Returns whether DB name argument is enabled. The information can be used for UI developers to control the input flow.- Returns:
true
whendbName
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setDbNameEnabled
void setDbNameEnabled(boolean b) Sets whether DB name argument is enabled. The information can be used for UI developers to control the input flow.- Parameters:
b
-true
whendbName
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setDbName
A shortcut method forsetDbNameEnabled(boolean)
andsetDefaultDbName(String)
.- Parameters:
enabled
- whether to enable DB name argumentdefaultValue
- the default value
-
getDefaultDbName
String getDefaultDbName()Returns the default DB name argument to be used when DB name argument is disabled or actual value is empty.- Returns:
- default value
-
setDefaultDbName
Sets the default DB name argument to be used when DB name argument is disabled or actual value is empty.- Parameters:
s
- default value
-
getDbLogin
Returns the DB login argument to be used for URL construction. Descendants can override this method when they have more sophisticated algorithms to determine the DB login argument. This implementation returns the default DB login when the passed string is either empty or DB login argument was disabled.- Parameters:
s
- the string containing an actual DB login argument- Returns:
- the argument to be used in URL construction
- See Also:
-
isDbLoginEnabled
boolean isDbLoginEnabled()Returns whether DB login argument is enabled. The information can be used for UI developers to control the input flow.- Returns:
true
whendbLogin
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setDbLoginEnabled
void setDbLoginEnabled(boolean b) Sets whether DB login argument is enabled. The information can be used for UI developers to control the input flow.- Parameters:
b
-true
whendbLogin
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setDbLogin
A shortcut method forsetDbLoginEnabled(boolean)
andsetDefaultDbLogin(String)
.- Parameters:
enabled
- whether to enable DB login argumentdefaultValue
- the default value
-
getDefaultDbLogin
String getDefaultDbLogin()Returns the default DB login argument to be used when DB login argument is disabled or actual value is empty.- Returns:
- default value
-
setDefaultDbLogin
Sets the default DB login argument to be used when DB login argument is disabled or actual value is empty.- Parameters:
s
- default value
-
getDbPassword
Returns the DB password argument to be used for URL construction. Descendants can override this method when they have more sophisticated algorithms to determine the DB password argument. This implementation returns the default DB password when the passed string is either empty or DB password argument was disabled.- Parameters:
s
- the string containing an actual DB password argument- Returns:
- the argument to be used in URL construction
- See Also:
-
isDbPasswordEnabled
boolean isDbPasswordEnabled()Returns whether DB password argument is enabled. The information can be used for UI developers to control the input flow.- Returns:
true
whendbPassword
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setDbPasswordEnabled
void setDbPasswordEnabled(boolean b) Sets whether DB password argument is enabled. The information can be used for UI developers to control the input flow.- Parameters:
b
-true
whendbPassword
argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setDbPassword
A shortcut method forsetDbPasswordEnabled(boolean)
andsetDefaultDbPassword(String)
.- Parameters:
enabled
- whether to enable DB password argumentdefaultValue
- the default value
-
getDefaultDbPassword
String getDefaultDbPassword()Returns the default DB password argument to be used when DB password argument is disabled or actual value is empty.- Returns:
- default value
-
setDefaultDbPassword
Sets the default DB password argument to be used when DB password argument is disabled or actual value is empty.- Parameters:
s
- default value
-
getAdditionalArgument
Returns the additional argument to be used for URL construction. Descendants can override this method when they have more sophisticated algorithms to determine the additional argument. This implementation returns the default additional argument when the passed string is either empty or the additional argument was disabled.- Parameters:
index
- index of additional arguments
- the string containing an actual additional argument- Returns:
- the argument to be used in URL construction
- See Also:
-
isAdditionalArgumentEnabled
boolean isAdditionalArgumentEnabled(int index) Returns whether additional argument is enabled. The information can be used for UI developers to control the input flow.- Parameters:
index
- index of additional argument- Returns:
true
when additional argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setAdditionalArgumentEnabled
void setAdditionalArgumentEnabled(int index, boolean b) Sets whether additional argument is enabled. The information can be used for UI developers to control the input flow.- Parameters:
index
- index of additional argumentb
-true
when additional argument can be passed toIJdbcConnectionProvider.getConnection(String, String, String, String, String, String...)
-
setAdditionalArgument
A shortcut method forsetAdditionalArgumentEnabled(int, boolean)
,setAdditionalArgumentName(int, String)
andsetDefaultAdditionalArgument(int, String)
.- Parameters:
index
- index of additional argumentenabled
- whether to enable additional argumentname
- name of additional argumentdefaultValue
- the default value
-
getDefaultAdditionalArgument
Returns the default additional argument to be used when it is disabled or actual value is empty.- Parameters:
index
- index of additional argument- Returns:
- default value
-
setDefaultAdditionalArgument
Sets the default additional argument to be used when it is disabled or actual value is empty.- Parameters:
index
- index of additional arguments
- default value
-
getAdditionalArgumentName
Returns the name of the additional argument. The name can be used for labels.- Parameters:
index
- index of argument- Returns:
- name of argument
-
setAdditionalArgumentName
Sets the name of the additional argument. The name can be used for labels.- Parameters:
index
- index of arguments
- name of argument
-
getAdditionalArgumentNames
String[] getAdditionalArgumentNames()Returns the names of additional arguments.- Returns:
- array of names in order (array is empty when no additional arguments are used)
-
getAdditionalArgumentCount
int getAdditionalArgumentCount()Returns the number of additional arguments this provider knows about.- Returns:
- number of additional arguments
-
getDriverParameterCount
int getDriverParameterCount()Returns the number of additional driver parameters.- Returns:
- number of driver parameters.
- Since:
- 1.2.9
-
setDriverParameter
Sets a driver parameter value or deletes it.- Parameters:
name
- name of parametervalue
- value of parameter ornull
if parameter shall be removed- Since:
- 1.2.9
-
getDriverParameter
Returns the value of th edriver parameter.- Parameters:
name
- name of parameter- Returns:
- value of parameter
- Since:
- 1.2.9
-
getDriverParametersString
String getDriverParametersString()Returns the URL driver parameter string to be used inurl
.- Returns:
- the parameter string
- Since:
- 1.2.9
-