/** * Creates an operation response with the supplied response data. * * @param <T> type of response * @param request containing controls * @param result of the operation * @param ldapResponse provider response * @return operation response */ protected <T> Response<T> createResponse( final Request request, final T result, final LDAPResponse ldapResponse) { return new Response<T>( result, ResultCode.valueOf(ldapResponse.getResultCode()), ldapResponse.getErrorMessage(), ldapResponse.getMatchedDN(), config.getControlProcessor().processResponseControls(ldapResponse.getControls()), ldapResponse.getReferrals(), ldapResponse.getMessageID()); }
/** * Determines if the supplied response should result in an operation retry. * * @param request that produced the exception * @param ldapResponse provider response * @throws LdapException wrapping the ldap exception */ protected void throwOperationException(final Request request, final LDAPResponse ldapResponse) throws LdapException { ProviderUtils.throwOperationException( config.getOperationExceptionResultCodes(), String.format("Ldap returned result code: %s", ldapResponse.getResultCode()), ldapResponse.getResultCode(), ldapResponse.getMatchedDN(), config.getControlProcessor().processResponseControls(ldapResponse.getControls()), ldapResponse.getReferrals(), false); }