Class CachePolicyDecisionRequestHandler

    • Constructor Detail

      • CachePolicyDecisionRequestHandler

        public CachePolicyDecisionRequestHandler​(com.github.benmanes.caffeine.cache.Caffeine<Object,​Object> caffeine,
                                                 Clock clock,
                                                 Duration defaultTimeout,
                                                 Duration maximumTimeout,
                                                 NotificationService notificationService,
                                                 DisconnectionStrategy disconnectionStrategy,
                                                 RequestHandler requestHandler)
        Builds a CachePolicyDecisionFilter.
        Parameters:
        caffeine - The caffeine cache to use. Not null.
        clock - A clock providing access to the current instant, date and time using a time-zone, not null.
        defaultTimeout - The default duration for which to cache AM policy decisions. If an AM policy decision provides a valid ttl value to specify the time until which the policy decision remains valid, IG uses that value or the maxTimeout.
        maximumTimeout - The maximum duration for which to cache AM policy decisions. If the ttl value provided by the AM policy decision is after the current time plus the maxTimeout, IG uses the maxTimeout. Can be null.
        notificationService - The notification service used to connect on AM websocket notifications.
        disconnectionStrategy - The strategy to apply in case of notifications' disconnection.
        requestHandler - The RequestHandler to use to fetch the policy decisions.
        Throws:
        NullPointerException - If caffeine or clock are null.
    • Method Detail

      • handleAction

        public Promise<ActionResponse,​ResourceException> handleAction​(Context context,
                                                                            ActionRequest actionRequest)
        Description copied from interface: RequestHandler
        Handles performing an action on a resource, and optionally returns an associated result. The execution of an action is allowed to incur side effects.

        Actions are parametric; a set of named parameters is provided as input to the action. The action result is a JSON object structure composed of basic Java types; its overall structure is defined by a specific implementation.

        On completion, the action result (or null) must be used to complete the returned Promise. On failure, the returned Promise must be completed with the exception.

        Action expects failure exceptions as follows: ForbiddenException if access to the resource is forbidden. NotSupportedException if the requested functionality is not implemented/supported BadRequestException if the passed identifier, parameters or filter is invalid NotFoundException if the specified resource could not be found.

        Specified by:
        handleAction in interface RequestHandler
        Parameters:
        context - The request server context, such as associated principal.
        actionRequest - The action request.
        Returns:
        A Promise containing the result of the operation.