Search in sources :

Example 6 with LdapOperationException

use of org.codelibs.fess.exception.LdapOperationException in project fess by codelibs.

the class LdapManager method getDirContext.

protected DirContextHolder getDirContext(final Supplier<Hashtable<String, String>> envSupplier) {
    DirContextHolder holder = contextLocal.get();
    if (holder == null) {
        final Hashtable<String, String> env = envSupplier.get();
        try {
            holder = new DirContextHolder(new InitialDirContext(env));
            contextLocal.set(holder);
            return holder;
        } catch (final NamingException e) {
            throw new LdapOperationException("Failed to create DirContext.", e);
        }
    } else {
        holder.inc();
        return holder;
    }
}
Also used : LdapOperationException(org.codelibs.fess.exception.LdapOperationException) NamingException(javax.naming.NamingException) InitialDirContext(javax.naming.directory.InitialDirContext)

Aggregations

LdapOperationException (org.codelibs.fess.exception.LdapOperationException)6 NamingException (javax.naming.NamingException)5 ArrayList (java.util.ArrayList)2 Hashtable (java.util.Hashtable)1 Attribute (javax.naming.directory.Attribute)1 Attributes (javax.naming.directory.Attributes)1 BasicAttribute (javax.naming.directory.BasicAttribute)1 BasicAttributes (javax.naming.directory.BasicAttributes)1 InitialDirContext (javax.naming.directory.InitialDirContext)1 ModificationItem (javax.naming.directory.ModificationItem)1 SearchControls (javax.naming.directory.SearchControls)1 SearchResult (javax.naming.directory.SearchResult)1 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)1