Class AbstractLDAPConnector

    • Method Detail

      • _delayedInitialize

        protected void _delayedInitialize​(String dataSourceId)
                                   throws Exception
        Call this method with the datasource id to initialize this component
        Parameters:
        dataSourceId - The id of the datasource
        Throws:
        Exception - If an error occurs.
      • _getFilter

        protected String _getFilter​(Configuration configuration,
                                    String filterKey)
                             throws ConfigurationException
        Get the filter from configuration key and check it
        Parameters:
        configuration - The configuration
        filterKey - The name of the child in configuration containing the filter config parameter name
        Returns:
        The value of the configured filter
        Throws:
        ConfigurationException - if the filter does not match
      • _getSearchScope

        protected int _getSearchScope​(Configuration configuration,
                                      String searchScopeKey)
                               throws ConfigurationException
        Get the search scope from configuration key
        Parameters:
        configuration - The configuration
        searchScopeKey - The name of the child in configuration containing the search scope parameter name
        Returns:
        The scope between SearchControls.ONELEVEL_SCOPE, SearchControls.SUBTREE_SCOPE and SearchControls.OBJECT_SCOPE.
        Throws:
        ConfigurationException - if a configuration problem occurs
      • isPagingSupported

        public boolean isPagingSupported()
        Test if paging is supported by the underlying directory server.
        Returns:
        true if the server supports paging.
      • _testPagingSupported

        protected boolean _testPagingSupported()
        Test if paging is supported by the underlying directory server.
        Returns:
        true if the server supports paging.
      • _testConnectionsPooled

        protected boolean _testConnectionsPooled()
        Test if connections are pooled
        Returns:
        true if connections are pooled
      • _cleanup

        protected void _cleanup​(Context context,
                                NamingEnumeration result)
        Clean a connection to an ldap server.
        Parameters:
        context - The connection to the database to close.
        result - The result to close.
      • _search

        protected List<SearchResult_search​(int pageSize,
                                             String name,
                                             String filter,
                                             SearchControls searchControls)
                                      throws NamingException
        Executes a LDAP search
        Parameters:
        pageSize - The number of entries in a page
        name - the name of the context or object to search
        filter - the filter expression to use for the search
        searchControls - the search controls that control the search.
        Returns:
        The results of the LDAP search
        Throws:
        NamingException - if a naming exception is encountered
      • _search

        protected List<SearchResult_search​(int pageSize,
                                             String name,
                                             String filter,
                                             SearchControls searchControls,
                                             boolean sorted)
                                      throws NamingException
        Executes a LDAP search
        Parameters:
        pageSize - The number of entries in a page
        name - the name of the context or object to search
        filter - the filter expression to use for the search
        searchControls - the search controls that control the search.
        sorted - True to sort the results
        Returns:
        The results of the LDAP search
        Throws:
        NamingException - if a naming exception is encountered
      • _search

        protected List<SearchResult_search​(int pageSize,
                                             String name,
                                             String filter,
                                             Object[] filterArgs,
                                             SearchControls searchControls,
                                             int offset,
                                             int limit)
                                      throws NamingException
        Executes a LDAP search
        Parameters:
        pageSize - The number of entries in a page
        name - the name of the context or object to search
        filter - the filter expression to use for the search
        filterArgs - the array of arguments to substitute for the variables in filter. Can be null.
        searchControls - the search controls that control the search.
        offset - the start index
        limit - The max number of results
        Returns:
        The results of the LDAP search
        Throws:
        NamingException - if a naming exception is encountered
      • _search

        protected List<SearchResult_search​(int pageSize,
                                             String name,
                                             String filter,
                                             Object[] filterArgs,
                                             SearchControls searchControls,
                                             int offset,
                                             int limit,
                                             boolean sorted)
                                      throws NamingException
        Executes a LDAP search
        Parameters:
        pageSize - The number of entries in a page
        name - the name of the context or object to search
        filter - the filter expression to use for the search
        filterArgs - the array of arguments to substitute for the variables in filter. Can be null.
        searchControls - the search controls that control the search.
        offset - the start index
        limit - The max number of results
        sorted - True to sort the results
        Returns:
        The results of the LDAP search
        Throws:
        NamingException - if a naming exception is encountered
      • _hasMoreEntries

        protected boolean _hasMoreEntries​(int pageSize,
                                          LdapContext context)
                                   throws NamingException
        Determines if there are more entries for the LDAP server to return based on server-generated cookie.
        Parameters:
        pageSize - The number of entries to be returned per page
        context - The ldap context
        Returns:
        false if there are no more entries.
        Throws:
        NamingException - If an error occurred while getting/setting the request controls
      • _setResultsControls

        protected void _setResultsControls​(int pageSize,
                                           LdapContext context,
                                           boolean sorted)
                                    throws NamingException
        Set paging on ldap if supported, and set the sort
        Parameters:
        pageSize - The page size to communicate with ldap
        context - The ldap context
        sorted - True add the sort controls
        Throws:
        NamingException - if an error occurred
      • getSortByFields

        protected String[] getSortByFields()
        Get the fields to sort by if the search is sorted
        Returns:
        The list of fields to sort by