Interface IRequestHandler

All Known Implementing Classes:
RequestHandler

public interface IRequestHandler
  • Method Details

    • getManager

      IRequestManager getManager()
    • createRequest

      <Request extends IRequestable> IRequest<Request> createRequest(IRequester requester, Request request)
    • registerRequest

      void registerRequest(IRequest<?> request)
    • assignRequest

      void assignRequest(IRequest<?> request)
      Method used to assign a given request to a resolver. Does not take any blacklist into account.
      Parameters:
      request - The request to assign
      Throws:
      IllegalArgumentException - when the request is already assigned
    • assignRequest

      IToken<?> assignRequest(IRequest<?> request, Collection<IToken<?>> resolverTokenBlackList)
      Method used to assign a given request to a resolver. Does take a given blacklist of resolvers into account.
      Parameters:
      request - The request to assign.
      resolverTokenBlackList - Each resolver that has its token in this blacklist will be skipped when checking for a possible resolver.
      Returns:
      The token of the resolver that has gotten the request assigned, null if none was found.
      Throws:
      IllegalArgumentException - is thrown when the request is unknown to this manager.
    • assignRequestDefault

      IToken<?> assignRequestDefault(IRequest<?> request, Collection<IToken<?>> resolverTokenBlackList)
      Method used to assign a given request to a resolver. Does take a given blacklist of resolvers into account. Uses the default assigning strategy: AssigningStrategy.PRIORITY_BASED
      Parameters:
      request - The request to assign.
      resolverTokenBlackList - Each resolver that has its token in this blacklist will be skipped when checking for a possible resolver.
      Returns:
      The token of the resolver that has gotten the request assigned, null if none was found.
      Throws:
      IllegalArgumentException - is thrown when the request is unknown to this manager.
    • reassignRequest

      IToken<?> reassignRequest(IRequest<?> request, Collection<IToken<?>> resolverTokenBlackList)
      Method used to reassign the request to a resolver that is not in the given blacklist. Cancels the request internally without notify the requester, and attempts a reassign. If the reassignment failed, it is assigned back to the orignal resolver.
      Parameters:
      request - The request that is being reassigned.
      resolverTokenBlackList - The blacklist to which not to assign the request.
      Returns:
      The token of the resolver that has gotten the request assigned, null if none was found.
      Throws:
      IllegalArgumentException - Thrown when something went wrong.
    • isAssigned

      boolean isAssigned(IToken<?> token)
      Method used to check if a given request token is assigned to a resolver.
      Parameters:
      token - The request token to check for.
      Returns:
      True when the request token has been assigned, false when not.
    • onRequestResolved

      void onRequestResolved(IToken<?> token)
      Method used to handle the successful resolving of a request and the completion of its children.
      Parameters:
      token - The token of the requests that finished resolving.
    • onRequestCompleted

      void onRequestCompleted(IToken<?> token)
      Method used to handle the successful completion of a request, its children and the followups.
      Parameters:
      token - The token of the request that got completed successfully.
    • onRequestOverruled

      void onRequestOverruled(IToken<?> token)
      Method used to handle requests that were overruled or cancelled. Cancels all children first, handles the creation of clean up requests.
      Parameters:
      token - The token of the request that got cancelled or overruled
    • onRequestCancelled

      void onRequestCancelled(IToken<?> token)
      Method used to handle requests that were overruled or cancelled. Cancels all children first, handles the creation of clean up requests.
      Parameters:
      token - The token of the request that got cancelled or overruled
    • onChildRequestCancelled

      void onChildRequestCancelled(IToken<?> token)
    • onRequestCancelledDirectly

      void onRequestCancelledDirectly(IToken<?> token)
    • processDirectCancellationAndNotifyRequesterOf

      void processDirectCancellationAndNotifyRequesterOf(IRequest<?> request)
    • processDirectCancellationOf

      void processDirectCancellationOf(IRequest<?> request)
    • resolveRequest

      void resolveRequest(IRequest<?> request)
      Method used to resolve a request. When this method is called the given request has to be assigned.
      Parameters:
      request - The request about to be resolved.
      Throws:
      IllegalArgumentException - when the request is unknown, not resolved, or cannot be resolved.
    • cleanRequestData

      void cleanRequestData(IToken<?> token)
      Method called when the given manager gets notified of the receiving of a given task by its requester. All communication with the resolver should be aborted by this time, so overrullings and cancelations need to be processed, before this method is called.
      Parameters:
      token - The token of the request.
      Throws:
      IllegalArgumentException - Thrown when the token is unknown.
    • getRequest

      IRequest<?> getRequest(IToken<?> token)
      Method used to get a registered request from a given token.
      Parameters:
      token - The token to query
      Returns:
      the request.
      Throws:
      IllegalArgumentException - when the token is unknown to the given manager.
    • getRequestOrNull

      IRequest<?> getRequestOrNull(IToken<?> token)
      Method used to get a registered request fora given token.
      Parameters:
      token - The token to get the request for.
      Returns:
      The request or null when no request with that token exists.
    • getRequestsMadeByRequester

      Collection<IRequest<?>> getRequestsMadeByRequester(IRequester requester)
      Returns all requests made by a given requester.
      Parameters:
      requester - The requester in question.
      Returns:
      A collection with request instances that are made by the given requester.
    • removeRequester

      void removeRequester(IRequester requester)
      Remove a specific requester and all assigned requests from the manager.
      Parameters:
      requester - the requester.