SearchResultDoneCodec searchResultDoneCodec = (SearchResultDoneCodec)response;
searchResultDoneCodec.setMessageId( messageId );
searchResultDoneCodec.addControl( response.getCurrentControl() );
SearchResultDone searchResultDone = convert( searchResultDoneCodec );
SearchFuture searchFuture = (SearchFuture)responseFuture;
if ( searchFuture == null )
{
LOG.error( "SearchFuture is null" );
throw new LdapException( "SearchFuture is null" );
}
if ( LOG.isDebugEnabled() )
{
if ( searchResultDone.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
{
// Everything is fine, return the response
LOG.debug( "Search successful : {}", searchResultDone );
}
else
{
// We have had an error
LOG.debug( "Search failed : {}", searchResultDone );
}
}
// Store the response into the future
searchFuture.set( searchResultDone );
// Remove the future from the map
removeFromFutureMaps( messageId );
break;
case SEARCH_RESULT_ENTRY:
// Store the response into the responseQueue
SearchResultEntryCodec searchResultEntryCodec = (SearchResultEntryCodec)response;
searchResultEntryCodec.setMessageId( messageId );
searchResultEntryCodec.addControl( response.getCurrentControl() );
SearchResultEntry srchEntry = convert( searchResultEntryCodec );
searchFuture = (SearchFuture)responseFuture;
if ( searchFuture == null )
{
LOG.error( "SearchFuture is null" );
throw new LdapException( "SearchFuture is null" );
}
if ( LOG.isDebugEnabled() )
{
LOG.debug( "Search entry found : {}", srchEntry );
}
// Store the response into the future
searchFuture.set( srchEntry );
break;
case SEARCH_RESULT_REFERENCE:
// Store the response into the responseQueue
SearchResultReferenceCodec searchResultReferenceCodec = (SearchResultReferenceCodec)response;
searchResultReferenceCodec.setMessageId( messageId );
searchResultReferenceCodec.addControl( response.getCurrentControl() );
SearchResultReference searchResultReference = convert( searchResultReferenceCodec );
searchFuture = (SearchFuture)responseFuture;
if ( searchFuture == null )
{
LOG.error( "SearchFuture is null" );
throw new LdapException( "SearchFuture is null" );
}
if ( LOG.isDebugEnabled() )
{
LOG.debug( "Search reference found : {}", searchResultReference );
}
// Store the response into the future
searchFuture.set( searchResultReference );
break;
default:
LOG.error( "~~~~~~~~~~~~~~~~~~~~~ Unknown message type {} ~~~~~~~~~~~~~~~~~~~~~", response