Package org.ldaptive

Class SingleConnectionFactory

    • Constructor Detail

      • SingleConnectionFactory

        public SingleConnectionFactory()
        Default constructor.
      • SingleConnectionFactory

        public SingleConnectionFactory​(Transport t)
        Creates a new single connection factory.
        Parameters:
        t - transport
      • SingleConnectionFactory

        public SingleConnectionFactory​(String ldapUrl)
        Creates a new single connection factory.
        Parameters:
        ldapUrl - to connect to
      • SingleConnectionFactory

        public SingleConnectionFactory​(String ldapUrl,
                                       Transport t)
        Creates a new single connection factory.
        Parameters:
        ldapUrl - to connect to
        t - transport
      • SingleConnectionFactory

        public SingleConnectionFactory​(ConnectionConfig cc)
        Creates a new single connection factory.
        Parameters:
        cc - connection configuration
      • SingleConnectionFactory

        public SingleConnectionFactory​(ConnectionConfig cc,
                                       Transport t)
        Creates a new single connection factory.
        Parameters:
        cc - connection configuration
        t - transport
    • Method Detail

      • getFailFastInitialize

        public boolean getFailFastInitialize()
        Returns whether initialize() should throw if the connection cannot be opened.
        Returns:
        whether initialize() should throw
      • setFailFastInitialize

        public void setFailFastInitialize​(boolean b)
        Sets whether initialize() should throw if the connection cannot be opened.
        Parameters:
        b - whether initialize() should throw
      • getNonBlockingInitialize

        public boolean getNonBlockingInitialize()
        Returns whether initialize() should execute on a separate thread.
        Returns:
        whether initialize() should block
      • setNonBlockingInitialize

        public void setNonBlockingInitialize​(boolean b)
        Sets whether initialize() should execute on a separate thread.
        Parameters:
        b - whether initialize() should block
      • getOnOpen

        public Function<Connection,​Boolean> getOnOpen()
        Returns the function to run when the connection is opened.
        Returns:
        on open function
      • setOnOpen

        public void setOnOpen​(Function<Connection,​Boolean> function)
        Sets the function to run when the connection is opened.
        Parameters:
        function - to run on connection open
      • getOnClose

        public Function<Connection,​Boolean> getOnClose()
        Returns the function to run when the connection is closed.
        Returns:
        on close function
      • setOnClose

        public void setOnClose​(Function<Connection,​Boolean> function)
        Sets the function to run when the connection is closed.
        Parameters:
        function - to run on connection close
      • getValidator

        public ConnectionValidator getValidator()
        Returns the connection validator for this factory.
        Returns:
        connection validator
      • setValidator

        public void setValidator​(ConnectionValidator cv)
        Sets the connection validator for this factory.
        Parameters:
        cv - connection validator
      • isInitialized

        public boolean isInitialized()
        Returns whether this factory has been initialized.
        Returns:
        whether this factory has been initialized
      • initialize

        public void initialize()
                        throws LdapException
        Prepares this factory for use.
        Throws:
        LdapException - if the connection cannot be opened
      • initializeConnectionProxy

        private void initializeConnectionProxy()
                                        throws LdapException
        Opens the connection and creates the connection proxy. Invokes onOpen and will tear down the connection if that function returns false.
        Throws:
        LdapException - if connection open fails
      • destroyConnectionProxy

        private void destroyConnectionProxy()
        Closes the connection and sets the proxy to null. Invokes onClose prior to closing the connection.