Interface Operation

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String LOCALBACKENDOPERATIONS
      Identifier used to get the local operation [if any] in the attachments.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void abort​(CancelRequest cancelRequest)
      Attempts to abort this operation before processing has completed.
      void addAdditionalLogItem​(AdditionalLogItem item)
      Adds an additional log item to this operation, which should be written to the log but not included in the response to the client.
      void addRequestControl​(Control control)
      Adds the provided control to the set of request controls for this operation.
      void addResponseControl​(Control control)
      Adds the provided control to the set of controls to include in the response to the client.
      void appendErrorMessage​(org.forgerock.i18n.LocalizableMessage message)
      Appends the provided message to the error message buffer.
      void appendMaskedErrorMessage​(org.forgerock.i18n.LocalizableMessage maskedMessage)
      Appends the provided message to the real, masked error message buffer.
      CancelResult cancel​(CancelRequest cancelRequest)
      Attempts to cancel this operation before processing has completed.
      void checkIfCanceled​(boolean signalTooLate)
      Checks to see if this operation requested to cancel in which case CanceledOperationException will be thrown.
      void disconnectClient​(DisconnectReason disconnectReason, boolean sendNotification, org.forgerock.i18n.LocalizableMessage message)
      Terminates the client connection being used to process this operation.
      boolean dontSynchronize()
      Indicates whether this operation needs to be synchronized to other copies of the data.
      List<AdditionalLogItem> getAdditionalLogItems()
      Returns an unmodifiable list containing the additional log items for this operation, which should be written to the log but not included in the response to the client.
      <T> T getAttachment​(String name)
      Retrieves the attachment with the specified name.
      Map<String,​Object> getAttachments()
      Retrieves the set of attachments defined for this operation, as a mapping between the attachment name and the associated object.
      DN getAuthorizationDN()
      Retrieves the authorization DN for this operation.
      Entry getAuthorizationEntry()
      Retrieves the entry for the user that should be considered the authorization identity for this operation.
      CancelRequest getCancelRequest()
      Retrieves the cancel request that has been issued for this operation, if there is one.
      CancelResult getCancelResult()
      Retrieves the cancel result for this operation.
      ClientConnection getClientConnection()
      Retrieves the client connection with which this operation is associated.
      long getConnectionID()
      Retrieves the unique identifier that is assigned to the client connection that submitted this operation.
      org.forgerock.i18n.LocalizableMessageBuilder getErrorMessage()
      Retrieves the error message for this operation.
      org.forgerock.i18n.LocalizableMessageBuilder getMaskedErrorMessage()
      Retrieves the real, masked error message for this operation.
      ResultCode getMaskedResultCode()
      Retrieves the real, masked result code for this operation.
      DN getMatchedDN()
      Retrieves the matched DN for this operation.
      int getMessageID()
      Retrieves the message ID assigned to this operation.
      long getOperationID()
      Retrieves the operation ID for this operation.
      OperationType getOperationType()
      Retrieves the operation type for this operation.
      long getProcessingNanoTime()
      Retrieves the length of time in nanoseconds that the server spent processing this operation if available.
      long getProcessingStartTime()
      Retrieves the time that processing started for this operation.
      long getProcessingStopTime()
      Retrieves the time that processing stopped for this operation.
      long getProcessingTime()
      Retrieves the length of time in milliseconds that the server spent processing this operation.
      DN getProxiedAuthorizationDN()
      Retrieves the proxied authorization DN for this operation if proxied authorization has been requested.
      List<String> getReferralURLs()
      Retrieves the set of referral URLs for this operation.
      <T extends Control>
      T
      getRequestControl​(ControlDecoder<T> d)
      Retrieves a control included in the request from the client.
      List<Control> getRequestControls()
      Retrieves the set of controls included in the request from the client.
      List<Control> getResponseControls()
      Retrieves the set of controls to include in the response to the client.
      ResultCode getResultCode()
      Retrieves the result code for this operation.
      boolean isInnerOperation()
      Indicates whether this is an inner operation rather than one that was directly requested by an external client.
      boolean isInternalOperation()
      Indicates whether this is an internal operation rather than one that was requested by an external client.
      boolean isSynchronizationOperation()
      Indicates whether this is a synchronization operation rather than one that was requested by an external client.
      void operationCompleted()
      Indicates that processing on this operation has completed successfully and that the client should perform any associated cleanup work.
      void registerPostResponseCallback​(Runnable callback)
      Registers a callback which should be run once this operation has completed and the response sent back to the client.
      <T> T removeAttachment​(String name)
      Removes the attachment with the specified name.
      void removeResponseControl​(Control control)
      Removes the provided control from the set of controls to include in the response to the client.
      void run()
      Performs the work of actually processing this operation.
      <T> T setAttachment​(String name, Object value)
      Sets the value of the specified attachment.
      void setAttachments​(Map<String,​Object> attachments)
      Set the attachments to the operation.
      void setAuthorizationEntry​(Entry authorizationEntry)
      Provides the entry for the user that should be considered the authorization identity for this operation.
      void setDontSynchronize​(boolean dontSynchronize)
      Specifies whether this operation must be synchronized to other copies of the data.
      void setErrorMessage​(org.forgerock.i18n.LocalizableMessageBuilder errorMessage)
      Specifies the error message for this operation.
      void setInnerOperation​(boolean isInnerOperation)
      Specifies whether this is an inner operation rather than one that was directly requested by an external client.
      void setInternalOperation​(boolean isInternalOperation)
      Specifies whether this is an internal operation rather than one that was requested by an external client.
      void setMaskedErrorMessage​(org.forgerock.i18n.LocalizableMessageBuilder maskedErrorMessage)
      Specifies the real, masked error message for this operation.
      void setMaskedResultCode​(ResultCode maskedResultCode)
      Specifies the real, masked result code for this operation.
      void setMatchedDN​(DN matchedDN)
      Specifies the matched DN for this operation.
      void setProxiedAuthorizationDN​(DN proxiedAuthorizationDN)
      Set the proxied authorization DN for this operation if proxied authorization has been requested.
      void setReferralURLs​(List<String> referralURLs)
      Specifies the set of referral URLs for this operation.
      void setResponseData​(DirectoryException directoryException)
      Sets the response elements for this operation based on the information contained in the provided DirectoryException object.
      void setResultCode​(ResultCode resultCode)
      Specifies the result code for this operation.
      void setSynchronizationOperation​(boolean isSynchronizationOperation)
      Specifies whether this is a synchronization operation rather than one that was requested by an external client.
      String toString()
      Retrieves a string representation of this operation.
      void toString​(StringBuilder buffer)
      Appends a string representation of this operation to the provided buffer.
    • Field Detail

      • LOCALBACKENDOPERATIONS

        static final String LOCALBACKENDOPERATIONS
        Identifier used to get the local operation [if any] in the attachments.
        See Also:
        Constant Field Values
    • Method Detail

      • getOperationType

        OperationType getOperationType()
        Retrieves the operation type for this operation.
        Returns:
        The operation type for this operation.
      • disconnectClient

        void disconnectClient​(DisconnectReason disconnectReason,
                              boolean sendNotification,
                              org.forgerock.i18n.LocalizableMessage message)
        Terminates the client connection being used to process this operation. If this is called by a plugin, then that plugin must return a result indicating that the client connection has been terminated.
        Parameters:
        disconnectReason - The disconnect reason that provides the generic cause for the disconnect.
        sendNotification - Indicates whether to try to provide notification to the client that the connection will be closed.
        message - The message to send to the client. It may be null if no notification is to be sent.
      • getClientConnection

        ClientConnection getClientConnection()
        Retrieves the client connection with which this operation is associated.
        Returns:
        The client connection with which this operation is associated.
      • getConnectionID

        long getConnectionID()
        Retrieves the unique identifier that is assigned to the client connection that submitted this operation.
        Returns:
        The unique identifier that is assigned to the client connection that submitted this operation.
      • getOperationID

        long getOperationID()
        Retrieves the operation ID for this operation.
        Returns:
        The operation ID for this operation.
      • getMessageID

        int getMessageID()
        Retrieves the message ID assigned to this operation.
        Returns:
        The message ID assigned to this operation.
      • getRequestControls

        List<Control> getRequestControls()
        Retrieves the set of controls included in the request from the client. The returned list must not be altered.
        Returns:
        The set of controls included in the request from the client.
      • getRequestControl

        <T extends Control> T getRequestControl​(ControlDecoder<T> d)
                                         throws DirectoryException
        Retrieves a control included in the request from the client.
        Type Parameters:
        T - The type of control requested.
        Parameters:
        d - The requested control's decoder.
        Returns:
        The decoded form of the requested control included in the request from the client or null if the control was not found.
        Throws:
        DirectoryException - if an error occurs while decoding the control.
      • addRequestControl

        void addRequestControl​(Control control)
        Adds the provided control to the set of request controls for this operation. This method may only be called by pre-parse plugins.
        Parameters:
        control - The control to add to the set of request controls for this operation.
      • getResponseControls

        List<Control> getResponseControls()
        Retrieves the set of controls to include in the response to the client. The contents of this list must not be altered.
        Returns:
        The set of controls to include in the response to the client.
      • addResponseControl

        void addResponseControl​(Control control)
        Adds the provided control to the set of controls to include in the response to the client. This method may not be called by post-response plugins.
        Parameters:
        control - The control to add to the set of controls to include in the response to the client.
      • removeResponseControl

        void removeResponseControl​(Control control)
        Removes the provided control from the set of controls to include in the response to the client. This method may not be called by post-response plugins.
        Parameters:
        control - The control to remove from the set of controls to include in the response to the client.
      • getResultCode

        ResultCode getResultCode()
        Retrieves the result code for this operation.
        Returns:
        The result code associated for this operation, or UNDEFINED if the operation has not yet completed.
      • setResultCode

        void setResultCode​(ResultCode resultCode)
        Specifies the result code for this operation. This method may not be called by post-response plugins.
        Parameters:
        resultCode - The result code for this operation.
      • getMaskedResultCode

        ResultCode getMaskedResultCode()
        Retrieves the real, masked result code for this operation.
        Returns:
        The real, masked result code associated for this operation, or UNDEFINED if the operation has not yet completed.
      • setMaskedResultCode

        void setMaskedResultCode​(ResultCode maskedResultCode)
        Specifies the real, masked result code for this operation. This method may not be called by post-response plugins.
        Parameters:
        maskedResultCode - The real, masked result code for this operation.
      • getErrorMessage

        org.forgerock.i18n.LocalizableMessageBuilder getErrorMessage()
        Retrieves the error message for this operation. Its contents may be altered by pre-parse, pre-operation, and post-operation plugins, but not by post-response plugins.
        Returns:
        The error message for this operation.
      • setErrorMessage

        void setErrorMessage​(org.forgerock.i18n.LocalizableMessageBuilder errorMessage)
        Specifies the error message for this operation. This method may not be called by post-response plugins.
        Parameters:
        errorMessage - The error message for this operation.
      • appendErrorMessage

        void appendErrorMessage​(org.forgerock.i18n.LocalizableMessage message)
        Appends the provided message to the error message buffer. If the buffer has not yet been created, then this will create it first and then add the provided message. This method may not be called by post-response plugins.
        Parameters:
        message - The message to append to the error message
      • getMaskedErrorMessage

        org.forgerock.i18n.LocalizableMessageBuilder getMaskedErrorMessage()
        Retrieves the real, masked error message for this operation. Its contents may be altered by pre-parse, pre-operation, and post-operation plugins, but not by post-response plugins.
        Returns:
        The real, masked error message for this operation.
      • setMaskedErrorMessage

        void setMaskedErrorMessage​(org.forgerock.i18n.LocalizableMessageBuilder maskedErrorMessage)
        Specifies the real, masked error message for this operation. This method may not be called by post-response plugins.
        Parameters:
        maskedErrorMessage - The real, masked error message for this operation.
      • appendMaskedErrorMessage

        void appendMaskedErrorMessage​(org.forgerock.i18n.LocalizableMessage maskedMessage)
        Appends the provided message to the real, masked error message buffer. If the buffer has not yet been created, then this will create it first and then add the provided message. This method may not be called by post-response plugins.
        Parameters:
        maskedMessage - The message to append to the real, masked error message
      • getAdditionalLogItems

        List<AdditionalLogItem> getAdditionalLogItems()
        Returns an unmodifiable list containing the additional log items for this operation, which should be written to the log but not included in the response to the client.
        Returns:
        An unmodifiable list containing the additional log items for this operation.
      • addAdditionalLogItem

        void addAdditionalLogItem​(AdditionalLogItem item)
        Adds an additional log item to this operation, which should be written to the log but not included in the response to the client. This method may not be called by post-response plugins.
        Parameters:
        item - The additional log item for this operation.
      • getMatchedDN

        DN getMatchedDN()
        Retrieves the matched DN for this operation.
        Returns:
        The matched DN for this operation, or null if the operation has not yet completed or does not have a matched DN.
      • setMatchedDN

        void setMatchedDN​(DN matchedDN)
        Specifies the matched DN for this operation. This may not be called by post-response plugins.
        Parameters:
        matchedDN - The matched DN for this operation.
      • getReferralURLs

        List<String> getReferralURLs()
        Retrieves the set of referral URLs for this operation. Its contents must not be altered by the caller.
        Returns:
        The set of referral URLs for this operation, or null if the operation is not yet complete or does not have a set of referral URLs.
      • setReferralURLs

        void setReferralURLs​(List<String> referralURLs)
        Specifies the set of referral URLs for this operation. This may not be called by post-response plugins.
        Parameters:
        referralURLs - The set of referral URLs for this operation.
      • setResponseData

        void setResponseData​(DirectoryException directoryException)
        Sets the response elements for this operation based on the information contained in the provided DirectoryException object. This method may not be called by post-response plugins.
        Parameters:
        directoryException - The exception containing the information to use for the response elements.
      • isInternalOperation

        boolean isInternalOperation()
        Indicates whether this is an internal operation rather than one that was requested by an external client.
        Returns:
        true if this is an internal operation, or false if it is not.
      • setInternalOperation

        void setInternalOperation​(boolean isInternalOperation)
        Specifies whether this is an internal operation rather than one that was requested by an external client. This may not be called from within a plugin.
        Parameters:
        isInternalOperation - Specifies whether this is an internal operation rather than one that was requested by an external client.
      • isInnerOperation

        boolean isInnerOperation()
        Indicates whether this is an inner operation rather than one that was directly requested by an external client. Said otherwise, inner operations include internal operations, but also operations in the server indirectly mandated by external requests like Rest2LDAP for example. This may not be called from within a plugin.
        Returns:
        true if this is an inner operation, or false if it is not.
      • setInnerOperation

        void setInnerOperation​(boolean isInnerOperation)
        Specifies whether this is an inner operation rather than one that was directly requested by an external client. Said otherwise, inner operations include internal operations, but also operations in the server indirectly mandated by external requests like Rest2LDAP for example. This may not be called from within a plugin.
        Parameters:
        isInnerOperation - Specifies whether this is an inner operation rather than one that was requested by an external client.
      • isSynchronizationOperation

        boolean isSynchronizationOperation()
        Indicates whether this is a synchronization operation rather than one that was requested by an external client.
        Returns:
        true if this is a data synchronization operation, or false if it is not.
      • setSynchronizationOperation

        void setSynchronizationOperation​(boolean isSynchronizationOperation)
        Specifies whether this is a synchronization operation rather than one that was requested by an external client. This method may not be called from within a plugin.
        Parameters:
        isSynchronizationOperation - Specifies whether this is a synchronization operation rather than one that was requested by an external client.
      • setDontSynchronize

        void setDontSynchronize​(boolean dontSynchronize)
        Specifies whether this operation must be synchronized to other copies of the data.
        Parameters:
        dontSynchronize - Specifies whether this operation must be synchronized to other copies of the data.
      • getAuthorizationEntry

        Entry getAuthorizationEntry()
        Retrieves the entry for the user that should be considered the authorization identity for this operation. In many cases, it will be the same as the authorization entry for the underlying client connection, or null if no authentication has been performed on that connection. However, it may be some other value if special processing has been requested (e.g., the operation included a proxied authorization control). This method should not be called by pre-parse plugins because the correct value may not yet have been determined.
        Returns:
        The entry for the user that should be considered the authorization identity for this operation, or null if the authorization identity should be the unauthenticated user.
      • setAuthorizationEntry

        void setAuthorizationEntry​(Entry authorizationEntry)
        Provides the entry for the user that should be considered the authorization identity for this operation. This must not be called from within a plugin.
        Parameters:
        authorizationEntry - The entry for the user that should be considered the authorization identity for this operation, or null if it should be the unauthenticated user.
      • getAuthorizationDN

        DN getAuthorizationDN()
        Retrieves the authorization DN for this operation. In many cases, it will be the same as the DN of the authenticated user for the underlying connection, or the null DN if no authentication has been performed on that connection. However, it may be some other value if special processing has been requested (e.g., the operation included a proxied authorization control). This method should not be called by pre-parse plugins because the correct value may not have yet been determined.
        Returns:
        The authorization DN for this operation, or the null DN if it should be the unauthenticated user..
      • getProxiedAuthorizationDN

        DN getProxiedAuthorizationDN()
        Retrieves the proxied authorization DN for this operation if proxied authorization has been requested.
        Returns:
        The proxied authorization DN for this operation if proxied authorization has been requested, or null if proxied authorization has not been requested.
      • setProxiedAuthorizationDN

        void setProxiedAuthorizationDN​(DN proxiedAuthorizationDN)
        Set the proxied authorization DN for this operation if proxied authorization has been requested.
        Parameters:
        proxiedAuthorizationDN - The proxied authorization DN for this operation if proxied authorization has been requested, or null if proxied authorization has not been requested.
      • getAttachments

        Map<String,​Object> getAttachments()
        Retrieves the set of attachments defined for this operation, as a mapping between the attachment name and the associated object.
        Returns:
        The set of attachments defined for this operation.
      • getAttachment

        <T> T getAttachment​(String name)
        Retrieves the attachment with the specified name.
        Type Parameters:
        T - the type of the attached object
        Parameters:
        name - The name for the attachment to retrieve. It will be treated in a case-sensitive manner.
        Returns:
        The requested attachment object, or null if it does not exist.
      • removeAttachment

        <T> T removeAttachment​(String name)
        Removes the attachment with the specified name.
        Type Parameters:
        T - the type of the attached object
        Parameters:
        name - The name for the attachment to remove. It will be treated in a case-sensitive manner.
        Returns:
        The attachment that was removed, or null if it does not exist.
      • setAttachment

        <T> T setAttachment​(String name,
                            Object value)
        Sets the value of the specified attachment. If an attachment already exists with the same name, it will be replaced. Otherwise, a new attachment will be added.
        Type Parameters:
        T - the type of the attached object
        Parameters:
        name - The name to use for the attachment.
        value - The value to use for the attachment.
        Returns:
        The former value held by the attachment with the given name, or null if there was previously no such attachment.
      • getProcessingStartTime

        long getProcessingStartTime()
        Retrieves the time that processing started for this operation.
        Returns:
        The time that processing started for this operation.
      • getProcessingStopTime

        long getProcessingStopTime()
        Retrieves the time that processing stopped for this operation. This will actually hold a time immediately before the response was sent to the client.
        Returns:
        The time that processing stopped for this operation.
      • getProcessingTime

        long getProcessingTime()
        Retrieves the length of time in milliseconds that the server spent processing this operation. This should not be called until after the server has sent the response to the client.
        Returns:
        The length of time in milliseconds that the server spent processing this operation.
      • getProcessingNanoTime

        long getProcessingNanoTime()
        Retrieves the length of time in nanoseconds that the server spent processing this operation if available. This should not be called until after the server has sent the response to the client.
        Returns:
        The length of time in nanoseconds that the server spent processing this operation or -1 if its not available.
      • operationCompleted

        void operationCompleted()
        Indicates that processing on this operation has completed successfully and that the client should perform any associated cleanup work.
      • cancel

        CancelResult cancel​(CancelRequest cancelRequest)
        Attempts to cancel this operation before processing has completed.
        Parameters:
        cancelRequest - Information about the way in which the operation should be canceled.
        Returns:
        A code providing information on the result of the cancellation.
      • abort

        void abort​(CancelRequest cancelRequest)
        Attempts to abort this operation before processing has completed.
        Parameters:
        cancelRequest - Information about the way in which the operation should be canceled.
      • getCancelRequest

        CancelRequest getCancelRequest()
        Retrieves the cancel request that has been issued for this operation, if there is one. This method should not be called by post-operation or post-response plugins.
        Returns:
        The cancel request that has been issued for this operation, or null if there has not been any request to cancel.
      • getCancelResult

        CancelResult getCancelResult()
        Retrieves the cancel result for this operation.
        Returns:
        The cancel result for this operation. It will be null if the operation has not seen and reacted to a cancel request.
      • toString

        String toString()
        Retrieves a string representation of this operation.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this operation.
      • toString

        void toString​(StringBuilder buffer)
        Appends a string representation of this operation to the provided buffer.
        Parameters:
        buffer - The buffer into which a string representation of this operation should be appended.
      • dontSynchronize

        boolean dontSynchronize()
        Indicates whether this operation needs to be synchronized to other copies of the data.
        Returns:
        true if this operation should not be synchronized, or false if it should be synchronized.
      • setAttachments

        void setAttachments​(Map<String,​Object> attachments)
        Set the attachments to the operation.
        Parameters:
        attachments - - Attachments to register within the operation
      • checkIfCanceled

        void checkIfCanceled​(boolean signalTooLate)
                      throws CanceledOperationException
        Checks to see if this operation requested to cancel in which case CanceledOperationException will be thrown.
        Parameters:
        signalTooLate - true to signal that any further cancel requests will be too late after return from this call or false otherwise.
        Throws:
        CanceledOperationException - if this operation should be cancelled.
      • registerPostResponseCallback

        void registerPostResponseCallback​(Runnable callback)
        Registers a callback which should be run once this operation has completed and the response sent back to the client.
        Parameters:
        callback - The callback to be run once this operation has completed and the response sent back to the client.
      • run

        void run()
        Performs the work of actually processing this operation. This should include all processing for the operation, including invoking pre-parse and post-response plugins, logging messages and any other work that might need to be done in the course of processing.
        Specified by:
        run in interface Runnable