Package org.ldaptive

Class DefaultConnectionFactory

    • Field Detail

      • DEFAULT_PROVIDER

        protected static final Provider<?> DEFAULT_PROVIDER
        Static reference to the default ldap provider.
      • provider

        private Provider<?> provider
        Provider used by this factory.
      • config

        private ConnectionConfig config
        Connection configuration used by this factory.
    • Constructor Detail

      • DefaultConnectionFactory

        public DefaultConnectionFactory()
        Default constructor.
      • DefaultConnectionFactory

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

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

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

      • getConnectionConfig

        public ConnectionConfig getConnectionConfig()
        Returns the connection config.
        Returns:
        connection config
      • setConnectionConfig

        public void setConnectionConfig​(ConnectionConfig cc)
        Sets the connection config. Once invoked the supplied connection config is made immutable. See AbstractConfig.makeImmutable().
        Parameters:
        cc - connection config
      • getProvider

        public Provider<?> getProvider()
        Returns the ldap provider.
        Returns:
        ldap provider
      • setProvider

        public void setProvider​(Provider<?> p)
        Sets the ldap provider.
        Parameters:
        p - ldap provider to set
      • getConnection

        public Connection getConnection()
        Creates a new connection. Connections returned from this method must be opened before they can perform ldap operations.
        Specified by:
        getConnection in interface ConnectionFactory
        Returns:
        connection
      • getConnection

        public static Connection getConnection​(String ldapUrl)
        Creates a new connection. Connections returned from this method must be opened before they can be used.
        Parameters:
        ldapUrl - to connect to
        Returns:
        connection
      • getConnection

        public static Connection getConnection​(ConnectionConfig cc)
        Creates a new connection. Connections returned from this method must be opened before they can be used.
        Parameters:
        cc - connection configuration
        Returns:
        connection
      • getDefaultProvider

        public static Provider<?> getDefaultProvider()
        The PROVIDER property is checked and that class is loaded if provided. Otherwise the JNDI provider is returned.
        Returns:
        default provider