Package org.ldaptive

Class DefaultConnectionFactory.DefaultConnection

    • Field Detail

      • logger

        protected final Logger logger
        Logger for this class.
    • Constructor Detail

      • DefaultConnection

        public DefaultConnection​(ConnectionConfig cc,
                                 ProviderConnectionFactory<?> cf)
        Creates a new default connection.
        Parameters:
        cc - connection configuration
        cf - provider connection factory
    • Method Detail

      • getConnectionConfig

        public ConnectionConfig getConnectionConfig()
        Description copied from interface: Connection
        Returns the connection config for this connection. The config may be read-only.
        Specified by:
        getConnectionConfig in interface Connection
        Returns:
        connection config
      • open

        public Response<Void> open​(BindRequest request)
                            throws LdapException
        This will establish a connection if one does not already exist and bind to the LDAP using the supplied bind request. This connection should be closed using close().
        Specified by:
        open in interface Connection
        Parameters:
        request - bind request
        Returns:
        response associated with the bind operation
        Throws:
        IllegalStateException - if the connection is already open
        LdapException - if the LDAP cannot be reached
      • isOpen

        public boolean isOpen()
        Returns whether the underlying provider connection is not null.
        Specified by:
        isOpen in interface Connection
        Returns:
        whether the provider connection has been initialized
      • close

        public void close()
        Description copied from interface: Connection
        This will close the connection to the LDAP.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Connection
      • close

        public void close​(RequestControl[] controls)
        Description copied from interface: Connection
        This will close the connection to the LDAP using the supplied controls.
        Specified by:
        close in interface Connection
        Parameters:
        controls - request controls
      • reopen

        public Response<Void> reopen()
                              throws LdapException
        Description copied from interface: Connection
        This will close an existing connection to the LDAP and establish a new connection to the LDAP.
        Specified by:
        reopen in interface Connection
        Returns:
        response associated with the ConnectionInitializer or an empty response if no connection initializer was configured
        Throws:
        LdapException - if the LDAP cannot be reached
      • reopen

        public Response<Void> reopen​(BindRequest request)
                              throws LdapException
        Description copied from interface: Connection
        This will close an existing connection to the LDAP and establish a new connection to the LDAP using the supplied bind request.
        Specified by:
        reopen in interface Connection
        Parameters:
        request - containing bind information
        Returns:
        response associated with the bind operation
        Throws:
        LdapException - if the LDAP cannot be reached