Class ReactiveHandlersUtils


  • public final class ReactiveHandlersUtils
    extends Object
    Utility class for reactive handlers.
    • Field Detail

      • NO_BACKEND

        public static final String NO_BACKEND
        Backend id value to use for an operation when there is no backend selected.
        See Also:
        Constant Field Values
      • LDAP_PROTOCOL_VERSION_3

        public static final int LDAP_PROTOCOL_VERSION_3
        Version 3 of the LDAP protocol.
        See Also:
        Constant Field Values
    • Method Detail

      • getFlowableEmitter

        public static FlowableEmitter<Response> getFlowableEmitter​(Operation operation)
        Returns the reactive emitter attached to the provided operation.
        Parameters:
        operation - The operation.
        Returns:
        the reactive emitter associated to the operation
      • operationToResult

        public static Result operationToResult​(Operation operation,
                                               int ldapVersion,
                                               long connectionId,
                                               SslOptions sslOptions)
        Generates a result from the provided operation.
        Parameters:
        operation - The operation to use to generate the response.
        ldapVersion - The LDAP protocol version.
        connectionId - The connection id to be used for logging
        sslOptions - Contains options to apply when a Start-TLS operation succeed.
        Returns:
        a result, that may be null if LDAP v2 is used or if the operation has no response.
      • requestToOperation

        public static Operation requestToOperation​(org.forgerock.services.context.Context context,
                                                   Request request)
        Returns an operation from the provided request.
        Parameters:
        request - The request.
        context - The request context to use.
        Returns:
        an operation
      • setResultDetails

        public static void setResultDetails​(Result result,
                                            Operation operation,
                                            LdapException e,
                                            int ldapVersion)
        Set details on the provided result with data from an operation.
        Parameters:
        result - The result to update.
        operation - The source operation.
        e - The ldap exception that was thrown.
        ldapVersion - The version of LDAP protocol.
      • addAttachmentsToOperation

        public static void addAttachmentsToOperation​(Operation op,
                                                     Request request,
                                                     FlowableEmitter<Response> out)
        Add to operation the attachments needed for correct behavior of the reactive handlers.
        Parameters:
        op - The operation to execute.
        request - The request to perform.
        out - The flowable emitter to use when response(s) are available.
      • getReplicatedRequestControl

        public static ReplicatedRequestControl getReplicatedRequestControl​(Request request)
        Returns the replicated request control from the provided request.
        Parameters:
        request - The request
        Returns:
        the replicated request control or null if there is none
      • getInternalModificationControl

        public static InternalModificationsRequestControl getInternalModificationControl​(Request request)
        Returns the internal modification control from the provided request.
        Parameters:
        request - The request
        Returns:
        the control or null if there is none
      • emitResult

        public static void emitResult​(Result result,
                                      FlowableEmitter<Response> out)
        Emits a result to the provided reactive emitter, to signal completion of a request.
        Parameters:
        result - The result to emit, which may be null.
        out - The reactive emitter.