List<String> urls = new ArrayList<String>();
{
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() !" ); //$NON-NLS-1$
}
public boolean hasMoreElements()
{
throw new UnsupportedOperationException( "Call hasMore() instead of hasMoreElements() !" ); //$NON-NLS-1$
}
public SearchResult next() throws NamingException
{
try
{
LdapUrl url = new LdapUrl( urls.remove( 0 ) );
SearchResult searchResult = new SearchResult( url.getDn().getName(), null,
new BasicAttributes(),
false );
searchResult.setNameInNamespace( url.getDn().getName() );
StudioSearchResult ssr = new StudioSearchResult( searchResult, null, false, url );
return ssr;
}
catch ( LdapURLEncodingException e )
{
throw new NamingException( e.getMessage() );
}
}
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 );
}
List<String> urls = new ArrayList<String>( referral.getLdapUrls() );
LdapUrl url = new LdapUrl( urls.get( 0 ) );
Connection referralConnection = ConnectionWrapperUtils.getReferralConnection( referral, monitor, this );
if ( referralConnection != null )
{
done = false;