| | |
| | | */ |
| | | public class LDAPEntryReader extends BackgroundTask<CustomSearchResult> |
| | | { |
| | | private String dn; |
| | | private InitialLdapContext ctx; |
| | | private Set<EntryReadListener> listeners = new HashSet<EntryReadListener>(); |
| | | private final String dn; |
| | | private final InitialLdapContext ctx; |
| | | private final Set<EntryReadListener> listeners = |
| | | new HashSet<EntryReadListener>(); |
| | | private boolean isOver; |
| | | private boolean notifyListeners; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public CustomSearchResult processBackgroundTask() throws Throwable |
| | | { |
| | | isOver = false; |
| | |
| | | try |
| | | { |
| | | SearchControls controls = new SearchControls(); |
| | | controls.setCountLimit(1); |
| | | |
| | | String[] attrs = {"*", "+"}; |
| | | controls.setReturningAttributes(attrs); |
| | |
| | | |
| | | en = ctx.search(Utilities.getJNDIName(dn), filter, controls); |
| | | |
| | | SearchResult sr = en.next(); |
| | | SearchResult sr = null; |
| | | while (en.hasMore()) |
| | | { |
| | | sr = en.next(); |
| | | } |
| | | |
| | | return new CustomSearchResult(sr, dn); |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public void backgroundTaskCompleted(CustomSearchResult sr, |
| | | Throwable throwable) |
| | | { |