Interface IRequestHandler
- All Known Implementing Classes:
RequestHandler
public interface IRequestHandler
-
Method Summary
Modifier and TypeMethodDescriptionvoidassignRequest(IRequest<?> request) Method used to assign a given request to a resolver.IToken<?> assignRequest(IRequest<?> request, Collection<IToken<?>> resolverTokenBlackList) Method used to assign a given request to a resolver.IToken<?> assignRequestDefault(IRequest<?> request, Collection<IToken<?>> resolverTokenBlackList) Method used to assign a given request to a resolver.voidcleanRequestData(IToken<?> token) Method called when the given manager gets notified of the receiving of a given task by its requester.<Request extends IRequestable>
IRequest<Request> createRequest(IRequester requester, Request request) IRequest<?> getRequest(IToken<?> token) Method used to get a registered request from a given token.IRequest<?> getRequestOrNull(IToken<?> token) Method used to get a registered request fora given token.Collection<IRequest<?>> getRequestsMadeByRequester(IRequester requester) Returns all requests made by a given requester.booleanisAssigned(IToken<?> token) Method used to check if a given request token is assigned to a resolver.voidonChildRequestCancelled(IToken<?> token) voidonRequestCancelled(IToken<?> token) Method used to handle requests that were overruled or cancelled.voidonRequestCancelledDirectly(IToken<?> token) voidonRequestCompleted(IToken<?> token) Method used to handle the successful completion of a request, its children and the followups.voidonRequestOverruled(IToken<?> token) Method used to handle requests that were overruled or cancelled.voidonRequestResolved(IToken<?> token) Method used to handle the successful resolving of a request and the completion of its children.voidvoidprocessDirectCancellationOf(IRequest<?> request) IToken<?> reassignRequest(IRequest<?> request, Collection<IToken<?>> resolverTokenBlackList) Method used to reassign the request to a resolver that is not in the given blacklist.voidregisterRequest(IRequest<?> request) voidremoveRequester(IRequester requester) Remove a specific requester and all assigned requests from the manager.voidresolveRequest(IRequest<?> request) Method used to resolve a request.
-
Method Details
-
getManager
IRequestManager getManager() -
createRequest
<Request extends IRequestable> IRequest<Request> createRequest(IRequester requester, Request request) -
registerRequest
-
assignRequest
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
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
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
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
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
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
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
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
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
-
onRequestCancelledDirectly
-
processDirectCancellationAndNotifyRequesterOf
-
processDirectCancellationOf
-
resolveRequest
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
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
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
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
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
Remove a specific requester and all assigned requests from the manager.- Parameters:
requester- the requester.
-