/** * Get the referrals * * @return Returns the referrals. */ public List<String> getReferrals() { return ( List<String> ) result.getReferral().getLdapUrls(); }
/** * {@inheritDoc} */ @Override public void addReplicatedContexts( String replicatedContext ) { replicatedContexts.addLdapUrl( replicatedContext ); } }
/** * Encode the Referral message to a PDU. * * @param buffer The buffer where to put the PDU * @param referral The referral to encode * @exception EncoderException If the encoding failed */ public static void encodeReferral( ByteBuffer buffer, Referral referral ) throws EncoderException { Collection<byte[]> ldapUrlsBytes = referral.getLdapUrlsBytes(); if ( ( ldapUrlsBytes != null ) && ( !ldapUrlsBytes.isEmpty() ) ) { // Encode the referrals sequence // The referrals length MUST have been computed before ! buffer.put( ( byte ) LdapCodecConstants.LDAP_RESULT_REFERRAL_SEQUENCE_TAG ); buffer.put( TLV.getBytes( referral.getReferralLength() ) ); // Each referral for ( byte[] ldapUrlBytes : ldapUrlsBytes ) { // Encode the current referral BerValue.encode( buffer, ldapUrlBytes ); } } }
Collection<String> ldapUrls = referral.getLdapUrls(); referral.addLdapUrlBytes( ldapUrlBytes ); referral.setReferralLength( referralLength );
referral.addLdapUrl( "" ); referral.addLdapUrl( new LdapUrl( url ).toString() ); referral.addLdapUrl( LdapUrl.EMPTY_URL.toString() ); boolean isFirst = true; for ( String url : ldapResult.getReferral().getLdapUrls() )
/** * Determines if the supplied response should result in an operation retry. * * @param request that produced the exception * @param resultResponse provider response * * @throws LdapException wrapping the ldap exception */ protected void throwOperationException(final Request request, final ResultResponse resultResponse) throws LdapException { final LdapResult ldapResult = resultResponse.getLdapResult(); final Referral ref = ldapResult.getReferral(); ProviderUtils.throwOperationException( config.getOperationExceptionResultCodes(), String.format("Ldap returned result code: %s", ldapResult.getResultCode()), ldapResult.getResultCode().getResultCode(), ldapResult.getMatchedDn() != null ? ldapResult.getMatchedDn().getName() : null, processResponseControls(config.getControlProcessor(), request.getControls(), resultResponse), ref != null ? ref.getLdapUrls().toArray(new String[ref.getReferralLength()]) : null, false); }
for ( byte[] ldapUrlBytes : referral.getLdapUrlsBytes() )
referral.addLdapUrl( "" ); referral.addLdapUrl( new LdapUrl( url ).toString() ); referral.addLdapUrl( LdapUrl.EMPTY_URL.toString() ); boolean isFirst = true; for ( String url : ldapResult.getReferral().getLdapUrls() )
Collection<String> ldapUrls = referral.getLdapUrls(); referral.addLdapUrlBytes( ldapUrlBytes ); referral.setReferralLength( referralLength );
/** * Creates an operation response with the supplied response data. * * @param <T> type of response * @param request containing controls * @param result of the operation * @param resultResponse provider response * * @return operation response */ protected <T> Response<T> createResponse(final Request request, final T result, final ResultResponse resultResponse) { final LdapResult ldapResult = resultResponse.getLdapResult(); final Referral ref = ldapResult.getReferral(); return new Response<>( result, ResultCode.valueOf(ldapResult.getResultCode().getValue()), ldapResult.getDiagnosticMessage(), ldapResult.getMatchedDn() != null ? ldapResult.getMatchedDn().getName() : null, processResponseControls(config.getControlProcessor(), request.getControls(), resultResponse), ref != null ? ref.getLdapUrls().toArray(new String[ref.getReferralLength()]) : null, resultResponse.getMessageId()); }
for ( byte[] ldapUrlBytes : referral.getLdapUrlsBytes() )
/** * Gets the next referral URL or null. * * @return the next referral URL or null */ public Referral getNextReferral() { if ( !referralsToProcess.isEmpty() ) { Referral referral = referralsToProcess.removeFirst(); for ( String url : referral.getLdapUrls() ) { processedUrls.add( url ); } return referral; } else { return null; } }
/** * {@inheritDoc} */ @Override public void addReplicatedContexts( String replicatedContext ) { replicatedContexts.addLdapUrl( replicatedContext ); } }
referral.addLdapUrl( "" ); referral.addLdapUrl( new LdapUrl( url ).toString() ); referral.addLdapUrl( LdapUrl.EMPTY_URL.toString() ); boolean isFirst = true; for ( String url : ldapResult.getReferral().getLdapUrls() )
Collection<String> ldapUrls = referral.getLdapUrls(); referral.addLdapUrlBytes( ldapUrlBytes ); referral.setReferralLength( referralLength );
/** * Encode the Referral message to a PDU. * * @param buffer The buffer where to put the PDU * @param referral The referral to encode * @exception EncoderException If the encoding failed */ public static void encodeReferral( ByteBuffer buffer, Referral referral ) throws EncoderException { Collection<byte[]> ldapUrlsBytes = referral.getLdapUrlsBytes(); if ( ( ldapUrlsBytes != null ) && ( !ldapUrlsBytes.isEmpty() ) ) { // Encode the referrals sequence // The referrals length MUST have been computed before ! buffer.put( ( byte ) LdapCodecConstants.LDAP_RESULT_REFERRAL_SEQUENCE_TAG ); buffer.put( TLV.getBytes( referral.getReferralLength() ) ); // Each referral for ( byte[] ldapUrlBytes : ldapUrlsBytes ) { // Encode the current referral BerValue.encode( buffer, ldapUrlBytes ); } } }
for ( byte[] ldapUrlBytes : referral.getLdapUrlsBytes() )
/** * Returns the Search Result Reference string * * @return The Search Result Reference string */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( " Search Result Reference\n" ); if ( ( referral == null ) || ( referral.getLdapUrls() == null ) || referral.getLdapUrls().isEmpty() ) { sb.append( " No Reference\n" ); } else { sb.append( " References\n" ); for ( String url : referral.getLdapUrls() ) { sb.append( " '" ).append( url ).append( "'\n" ); } } return super.toString( sb.toString() ); } }
/** * {@inheritDoc} */ @Override public void addReplicatedContexts( String replicatedContext ) { replicatedContexts.addLdapUrl( replicatedContext ); } }
/** * Encode the Referral message to a PDU. * * @param buffer The buffer where to put the PDU * @param referral The referral to encode * @exception EncoderException If the encoding failed */ public static void encodeReferral( ByteBuffer buffer, Referral referral ) throws EncoderException { Collection<byte[]> ldapUrlsBytes = referral.getLdapUrlsBytes(); if ( ( ldapUrlsBytes != null ) && ( !ldapUrlsBytes.isEmpty() ) ) { // Encode the referrals sequence // The referrals length MUST have been computed before ! buffer.put( ( byte ) LdapCodecConstants.LDAP_RESULT_REFERRAL_SEQUENCE_TAG ); buffer.put( TLV.getBytes( referral.getReferralLength() ) ); // Each referral for ( byte[] ldapUrlBytes : ldapUrlsBytes ) { // Encode the current referral BerValue.encode( buffer, ldapUrlBytes ); } } }