java.lang.Object
org.tentackle.sql.BackendInfo
Configuration info for a backend.
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionBackendInfo(String backendName) Creates a backend info from a backend name.
The info cannot be used to connect.BackendInfo(String url, String user, char[] password, String[] schemas) Creates a backend info.
This info is able to create a connection.BackendInfo(EncryptedProperties backendProperties) Creates a backend info from backend properties.
The info is able to create a connection.BackendInfo(Backend backend) Creates a backend info from a backend.
The info cannot be used to connect.BackendInfo(BackendInfo backendInfo, String user, char[] password) Creates a backend info from another one with a different user and password. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all passwords (stored in char[]-arrays) so that they are no more visible in memory.connect()Creates a connection.Gets the backend.intGets the optional database connection inactivity timeout.Gets the JNDI source.char[]Gets the connection password.String[]Gets the schemas.getUrl()Gets the connection url.getUser()Gets the username to connect.booleanReturns whether backend info can be used to connect.booleanisRemote()Returns whether this backend is remote.voidsetBackendTimeout(int backendTimeout) Sets the database connection inactivity timeout.toString()
-
Constructor Details
-
BackendInfo
Creates a backend info from a backend.
The info cannot be used to connect.- Parameters:
backend- the backend
-
BackendInfo
Creates a backend info from a backend name.
The info cannot be used to connect.- Parameters:
backendName- the backend name
-
BackendInfo
Creates a backend info.
This info is able to create a connection.- Parameters:
url- the backend urluser- the usernamepassword- the passwordschemas- the optional schemas, null if no schema check
-
BackendInfo
Creates a backend info from backend properties.
The info is able to create a connection.- Parameters:
backendProperties- the properties
-
BackendInfo
Creates a backend info from another one with a different user and password.- Parameters:
backendInfo- the original backend infouser- the usernamepassword- the password
-
-
Method Details
-
getBackend
Gets the backend.- Returns:
- the backend
-
isRemote
public boolean isRemote()Returns whether this backend is remote.- Returns:
- true if remote
-
getJndiDataSource
Gets the JNDI source.- Returns:
- the JNDI datasource if this a JNDI connection
-
getUrl
Gets the connection url.- Returns:
- the url, null if info cannot connect
-
getUser
Gets the username to connect.- Returns:
- the username
-
getPassword
public char[] getPassword()Gets the connection password.- Returns:
- the password
-
clearPassword
public void clearPassword()Clears all passwords (stored in char[]-arrays) so that they are no more visible in memory. -
getSchemas
Gets the schemas.- Returns:
- the schemas for migration
-
isConnectable
public boolean isConnectable()Returns whether backend info can be used to connect.- Returns:
- true if connectable
-
getBackendTimeout
public int getBackendTimeout()Gets the optional database connection inactivity timeout.- Returns:
- the timeout in minutes, 0 if none
-
setBackendTimeout
public void setBackendTimeout(int backendTimeout) Sets the database connection inactivity timeout.- Parameters:
backendTimeout- the timeout in minutes, 0 if none
-
connect
Creates a connection.- Returns:
- the connection in autocommit mode
- Throws:
SQLException- if connection could not be created
-
toString
-