protected class JndiConnection.JndiSearchIterator extends Object implements SearchIterator
Modifier and Type | Field and Description |
---|---|
private SearchRequest |
request
Search request.
|
private Response<Void> |
response
Response data.
|
private ResultCode |
responseResultCode
Response result code.
|
private NamingEnumeration<SearchResult> |
results
Results read from the search operation.
|
private LdapContext |
searchContext
Ldap context to search with.
|
private List<String> |
searchReferences
Search reference URLs.
|
Constructor and Description |
---|
JndiSearchIterator(SearchRequest sr)
Creates a new jndi search iterator.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close any resources associated with this iterator.
|
protected String |
formatDn(SearchResult sr,
String baseDn)
Returns a fully-qualified DN for the supplied search result.
|
Response<Void> |
getResponse()
Returns the response data associated with this search or null if this iterator has more ldap entries to return.
|
protected SearchControls |
getSearchControls(SearchRequest sr)
Returns a search controls object configured with the supplied search request.
|
protected String |
getSearchDn(LdapContext ctx,
SearchRequest sr)
Determines the DN of the supplied search request.
|
protected int |
getSearchScope(SearchScope ss)
Returns the jndi integer constant for the supplied search scope.
|
boolean |
hasNext()
Returns true if the iteration has more elements.
|
protected ResultCode |
ignoreSearchException(ResultCode[] ignoreResultCodes,
NamingException e)
Determines whether the supplied naming exception should be ignored.
|
void |
initialize()
Initializes this jndi search iterator.
|
protected void |
initializeSearchContext(LdapContext ctx,
SearchRequest sr)
Adds any additional environment properties found in the supplied request to the supplied context.
|
SearchItem |
next()
Returns the next element in the iteration.
|
protected String |
readCompositeName(String s)
Uses a composite name to parse the supplied string.
|
protected String[] |
readReferralUrls(LdapReferralException refEx)
Reads all referral URLs associated with this exception by invoking the search operation on the referral context
until all referrals have been read.
|
protected NamingEnumeration<SearchResult> |
search(LdapContext ctx,
SearchRequest sr)
|
private final SearchRequest request
private ResultCode responseResultCode
private LdapContext searchContext
private NamingEnumeration<SearchResult> results
public JndiSearchIterator(SearchRequest sr)
sr
- search requestpublic void initialize() throws LdapException
LdapException
- if an error occursprotected void initializeSearchContext(LdapContext ctx, SearchRequest sr) throws NamingException
ctx
- to initialize for searchingsr
- to read properties fromNamingException
- if a property cannot be added to the contextprotected NamingEnumeration<SearchResult> search(LdapContext ctx, SearchRequest sr) throws NamingException
ctx
- to searchsr
- to read properties fromNamingException
- if an error occursprotected SearchControls getSearchControls(SearchRequest sr)
sr
- search request containing configuration to create search controlsprotected int getSearchScope(SearchScope ss)
ss
- search scopepublic boolean hasNext() throws LdapException
SearchIterator
hasNext
in interface SearchIterator
LdapException
- if an error occurspublic SearchItem next() throws LdapException
SearchIterator
next
in interface SearchIterator
LdapException
- if an error occursprotected ResultCode ignoreSearchException(ResultCode[] ignoreResultCodes, NamingException e)
ignoreResultCodes
- to match against the exceptione
- naming exception to matchprotected String[] readReferralUrls(LdapReferralException refEx)
refEx
- to read URLs frompublic Response<Void> getResponse()
SearchIterator
getResponse
in interface SearchIterator
protected String getSearchDn(LdapContext ctx, SearchRequest sr) throws NamingException
Context.getNameInNamespace()
if it is
available, otherwise returns SearchRequest.getBaseDn()
.ctx
- ldap context the search was performed onsr
- search requestNamingException
- if an error occursprotected String formatDn(SearchResult sr, String baseDn) throws NamingException
NameClassPair.getNameInNamespace()
. Otherwise the behavior is controlled by JndiProviderConfig.getRemoveDnUrls()
.sr
- to determine DN forbaseDn
- that search was performed onNamingException
- if search result name cannot be formatted as a DNprotected String readCompositeName(String s) throws InvalidNameException
s
- composite name to readInvalidNameException
- if the supplied string is not a valid composite namepublic void close() throws LdapException
SearchIterator
close
in interface SearchIterator
LdapException
- if an error occursCopyright © 2003-2019 Virginia Tech. All Rights Reserved.