Package org.gitlab4j.api.systemhooks
Class SystemHookManager
java.lang.Object
org.gitlab4j.api.systemhooks.SystemHookManager
- All Implemented Interfaces:
HookManager
public class SystemHookManager extends Object implements HookManager
This class provides a handler for processing GitLab System Hook callouts.
-
Field Summary
Fields Modifier and Type Field Description static StringSYSTEM_HOOK_EVENT -
Constructor Summary
Constructors Constructor Description SystemHookManager()Create a HookManager to handle GitLab system hook events.SystemHookManager(String secretToken)Create a HookManager to handle GitLab system hook events which will be verified against the specified secretToken. -
Method Summary
Modifier and Type Method Description voidaddListener(SystemHookListener listener)Adds a System Hook event listener.voidfireEvent(SystemHookEvent event)Fire the event to the registered listeners.protected voidfireGroupEvent(GroupSystemHookEvent event)protected voidfireGroupMemberEvent(GroupMemberSystemHookEvent event)protected voidfireKeyEvent(KeySystemHookEvent event)protected voidfireMergeRequestEvent(MergeRequestSystemHookEvent event)protected voidfireProjectEvent(ProjectSystemHookEvent event)protected voidfirePushEvent(PushSystemHookEvent event)protected voidfireRepositoryEvent(RepositorySystemHookEvent event)protected voidfireTagPushEvent(TagPushSystemHookEvent event)protected voidfireTeamMemberEvent(TeamMemberSystemHookEvent event)protected voidfireUserEvent(UserSystemHookEvent event)StringgetSecretToken()Get the secret token that received hook events should be validated against.voidhandleEvent(javax.servlet.http.HttpServletRequest request)Parses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners.voidhandleEvent(SystemHookEvent event)Verifies the provided Event and fires it off to the registered listeners.SystemHookEventhandleRequest(javax.servlet.http.HttpServletRequest request)Parses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners.voidremoveListener(SystemHookListener listener)Removes a System Hook event listener.voidsetSecretToken(String secretToken)Set the secret token that received hook events should be validated against.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gitlab4j.api.HookManager
isValidSecretToken, isValidSecretToken
-
Field Details
-
SYSTEM_HOOK_EVENT
- See Also:
- Constant Field Values
-
-
Constructor Details
-
SystemHookManager
public SystemHookManager()Create a HookManager to handle GitLab system hook events. -
SystemHookManager
Create a HookManager to handle GitLab system hook events which will be verified against the specified secretToken.- Parameters:
secretToken- the secret token to verify against
-
-
Method Details
-
getSecretToken
Get the secret token that received hook events should be validated against.- Specified by:
getSecretTokenin interfaceHookManager- Returns:
- the secret token that received hook events should be validated against
-
setSecretToken
Set the secret token that received hook events should be validated against.- Specified by:
setSecretTokenin interfaceHookManager- Parameters:
secretToken- the secret token to verify against
-
handleEvent
Parses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners.- Specified by:
handleEventin interfaceHookManager- Parameters:
request- the HttpServletRequest to read the Event instance from- Throws:
GitLabApiException- if the parsed event is not supported
-
handleRequest
public SystemHookEvent handleRequest(javax.servlet.http.HttpServletRequest request) throws GitLabApiExceptionParses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners.- Parameters:
request- the HttpServletRequest to read the Event instance from- Returns:
- the processed SystemHookEvent instance read from the request,null if the request not contain a system hook event
- Throws:
GitLabApiException- if the parsed event is not supported
-
handleEvent
Verifies the provided Event and fires it off to the registered listeners.- Parameters:
event- the Event instance to handle- Throws:
GitLabApiException- if the event is not supported
-
addListener
Adds a System Hook event listener.- Parameters:
listener- the SystemHookListener to add
-
removeListener
Removes a System Hook event listener.- Parameters:
listener- the SystemHookListener to remove
-
fireEvent
Fire the event to the registered listeners.- Parameters:
event- the SystemHookEvent instance to fire to the registered event listeners- Throws:
GitLabApiException- if the event is not supported
-
fireProjectEvent
-
fireTeamMemberEvent
-
fireUserEvent
-
fireKeyEvent
-
fireGroupEvent
-
fireGroupMemberEvent
-
firePushEvent
-
fireTagPushEvent
-
fireRepositoryEvent
-
fireMergeRequestEvent
-