List<LdapURL> urls = new ArrayList<LdapURL>();
{
while ( referralsInfo.hasMoreReferrals() )
{
Referral referral = referralsInfo.getNextReferral();
for ( IJndiLogger logger : ConnectionCorePlugin.getDefault().getJndiLoggers() )
{
logger.logSearchResultReference( connection, referral, referralsInfo, requestNum, null );
}
urls.addAll( referral.getLdapURLs() );
}
}
public SearchResult nextElement()
{
throw new UnsupportedOperationException( "Call next() instead of nextElement() !" );
}
public boolean hasMoreElements()
{
throw new UnsupportedOperationException( "Call hasMore() instead of hasMoreElements() !" );
}
public SearchResult next() throws NamingException
{
LdapURL url = urls.remove( 0 );
SearchResult searchResult = new SearchResult( url.getDn().getUpName(), null, new BasicAttributes(),
false );
searchResult.setNameInNamespace( url.getDn().getUpName() );
StudioSearchResult ssr = new StudioSearchResult( searchResult, null, false, url );
return ssr;
}
public boolean hasMore() throws NamingException
{
return !urls.isEmpty();
}
public void close() throws NamingException
{
urls.clear();
referralsInfo = null;
}
};
}
else if ( referralsHandlingMethod == ReferralHandlingMethod.FOLLOW )
{
Referral referral = referralsInfo.getNextReferral();
for ( IJndiLogger logger : ConnectionCorePlugin.getDefault().getJndiLoggers() )
{
logger.logSearchResultReference( connection, referral, referralsInfo, requestNum, null );
}
LdapURL url = referral.getLdapURLs().get( 0 );
Connection referralConnection = JNDIConnectionWrapper.getReferralConnection( referral, monitor, this );
if ( referralConnection != null )
{
done = false;
String referralSearchBase = url.getDn() != null && !url.getDn().isEmpty() ? url.getDn().getUpName()