Search in sources :

Example 11 with CompareResponseProtocolOp

use of com.unboundid.ldap.protocol.CompareResponseProtocolOp in project ldapsdk by pingidentity.

the class InMemoryOperationInterceptorRequestHandler method processCompareRequest.

/**
 * {@inheritDoc}
 */
@Override()
@NotNull()
public LDAPMessage processCompareRequest(final int messageID, @NotNull final CompareRequestProtocolOp request, @NotNull final List<Control> controls) {
    final InterceptedCompareOperation op = new InterceptedCompareOperation(connection, messageID, request, toArray(controls));
    activeOperations.put(messageID, op);
    try {
        for (final InMemoryOperationInterceptor i : interceptors) {
            try {
                i.processCompareRequest(op);
            } catch (final LDAPException le) {
                Debug.debugException(le);
                return new LDAPMessage(messageID, new CompareResponseProtocolOp(le.toLDAPResult()), le.getResponseControls());
            } catch (final Exception e) {
                Debug.debugException(e);
                return new LDAPMessage(messageID, new CompareResponseProtocolOp(ResultCode.OTHER_INT_VALUE, null, ERR_DS_INTERCEPTOR_REQUEST_ERROR.get(String.valueOf(op), i.getClass().getName(), StaticUtils.getExceptionMessage(e)), null));
            }
        }
        final LDAPMessage resultMessage = wrappedHandler.processCompareRequest(messageID, new CompareRequestProtocolOp((CompareRequest) op.getRequest()), op.getRequest().getControlList());
        op.setResult(resultMessage.getCompareResponseProtocolOp().toLDAPResult(toArray(resultMessage.getControls())));
        for (final InMemoryOperationInterceptor i : interceptors) {
            try {
                i.processCompareResult(op);
            } catch (final Exception e) {
                Debug.debugException(e);
                return new LDAPMessage(messageID, new CompareResponseProtocolOp(ResultCode.OTHER_INT_VALUE, null, ERR_DS_INTERCEPTOR_RESULT_ERROR.get(String.valueOf(op), i.getClass().getName(), StaticUtils.getExceptionMessage(e)), null));
            }
        }
        return new LDAPMessage(messageID, new CompareResponseProtocolOp(op.getResult()), op.getResult().getResponseControls());
    } finally {
        activeOperations.remove(messageID);
    }
}
Also used : CompareRequest(com.unboundid.ldap.sdk.CompareRequest) LDAPException(com.unboundid.ldap.sdk.LDAPException) CompareRequestProtocolOp(com.unboundid.ldap.protocol.CompareRequestProtocolOp) LDAPMessage(com.unboundid.ldap.protocol.LDAPMessage) CompareResponseProtocolOp(com.unboundid.ldap.protocol.CompareResponseProtocolOp) LDAPException(com.unboundid.ldap.sdk.LDAPException) NotNull(com.unboundid.util.NotNull)

Aggregations

CompareResponseProtocolOp (com.unboundid.ldap.protocol.CompareResponseProtocolOp)11 LDAPMessage (com.unboundid.ldap.protocol.LDAPMessage)9 NotNull (com.unboundid.util.NotNull)7 Control (com.unboundid.ldap.sdk.Control)5 LDAPException (com.unboundid.ldap.sdk.LDAPException)5 CompareRequestProtocolOp (com.unboundid.ldap.protocol.CompareRequestProtocolOp)3 CompareRequest (com.unboundid.ldap.sdk.CompareRequest)3 LogRecord (java.util.logging.LogRecord)3 Test (org.testng.annotations.Test)3 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)2 AddResponseProtocolOp (com.unboundid.ldap.protocol.AddResponseProtocolOp)2 BindResponseProtocolOp (com.unboundid.ldap.protocol.BindResponseProtocolOp)2 DeleteResponseProtocolOp (com.unboundid.ldap.protocol.DeleteResponseProtocolOp)2 ExtendedResponseProtocolOp (com.unboundid.ldap.protocol.ExtendedResponseProtocolOp)2 ModifyDNResponseProtocolOp (com.unboundid.ldap.protocol.ModifyDNResponseProtocolOp)2 ModifyResponseProtocolOp (com.unboundid.ldap.protocol.ModifyResponseProtocolOp)2 SearchResultDoneProtocolOp (com.unboundid.ldap.protocol.SearchResultDoneProtocolOp)2 LDAPResult (com.unboundid.ldap.sdk.LDAPResult)2 AuthorizationIdentityRequestControl (com.unboundid.ldap.sdk.controls.AuthorizationIdentityRequestControl)2 ManageDsaITRequestControl (com.unboundid.ldap.sdk.controls.ManageDsaITRequestControl)2