Class ConnectionDefinition

  • All Implemented Interfaces:
    DatabaseObject

    public class ConnectionDefinition
    extends AbstractDatabaseObject
    Definition of a connection to another database or service.

    Other terms that are used for this are "named connection" or "connection object". A connection definition is a named database object that contains a reference to the remote database or service and optionally credentials.

    • Constructor Detail

      • ConnectionDefinition

        public ConnectionDefinition​(DatabaseObjectWriter writer,
                                    String name,
                                    String target)
        Create a connection without credentials.
        Parameters:
        writer - database object writer
        name - name of the connection
        target - target the connection points to
      • ConnectionDefinition

        public ConnectionDefinition​(DatabaseObjectWriter writer,
                                    String name,
                                    String target,
                                    String userName,
                                    String password)
        Create a connection with credentials.
        Parameters:
        writer - database object writer
        name - name of the connection
        target - target the connection points to
        userName - user as which to connect
        password - password or password-like credential
    • Method Detail

      • getType

        public String getType()
        Description copied from interface: DatabaseObject
        Get the type of the database object.
        Returns:
        type of the database object
      • getTarget

        public String getTarget()
        Get the target the connection definition points to.
        Returns:
        target of the connection
      • getUserName

        public String getUserName()
        Get the name of the user who connects to the remote database or service.
        Returns:
        user name
      • getPassword

        public String getPassword()
        Get the password of the user who connects to the remote database or service.
        Returns:
        password or password-like credential
      • hasParent

        public boolean hasParent()
        Description copied from interface: DatabaseObject
        Check if this object has a parent object that sets the scope within the database
        Returns:
        true if the object has a parent
      • getParent

        public DatabaseObject getParent()
        Description copied from interface: DatabaseObject
        Get the parent object.
        Returns:
        parent object
      • hasUserName

        public boolean hasUserName()
        Check whether the connection definition contains a user name.
        Returns:
        true if the connection definition contains a user name
      • hasPassword

        public boolean hasPassword()
        Check whether the connection definition contains a password.
        Returns:
        true if the connection definition contains a password