Class BackendInfo


  • public class BackendInfo
    extends Object
    Configuration info for a backend.
    Author:
    harald
    • Constructor Detail

      • BackendInfo

        public BackendInfo​(Backend backend)
        Creates a backend info from a backend.
        The info cannot be used to connect.
        Parameters:
        backend - the backend
      • BackendInfo

        public BackendInfo​(String backendName)
        Creates a backend info from a backend name.
        The info cannot be used to connect.
        Parameters:
        backendName - the backend name
      • BackendInfo

        public BackendInfo​(String url,
                           String user,
                           char[] password,
                           String[] schemas)
        Creates a backend info.
        This info is able to create a connection.
        Parameters:
        url - the backend url
        user - the username
        password - the password
        schemas - the optional schemas, null if no schema check
      • BackendInfo

        public BackendInfo​(Properties backendProperties)
        Creates a backend info from backend properties.
        The info is able to create a connection.
        Parameters:
        backendProperties - the properties
      • BackendInfo

        public BackendInfo​(BackendInfo backendInfo,
                           String user,
                           char[] password)
        Creates a backend info from another one with a different user and password.
        Parameters:
        backendInfo - the orginal backend info
        user - the username
        password - the password
    • Method Detail

      • getBackend

        public Backend getBackend()
        Gets the backend.
        Returns:
        the backend
      • isRemote

        public boolean isRemote()
        Returns whether this backend is remote.
        Returns:
        true if remote
      • getJndiDataSource

        public DataSource getJndiDataSource()
        Gets the JNDI source.
        Returns:
        the JNDI datasource if this a JNDI connection
      • getUrl

        public String getUrl()
        Gets the connection url.
        Returns:
        the url, null if info cannot connect
      • getUser

        public String 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

        public String[] 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
      • connect

        public Connection connect()
                           throws SQLException
        Creates a connection.
        Returns:
        the connection in autocommit mode
        Throws:
        SQLException - if connection could not be created