Class SystemHookManager

  • All Implemented Interfaces:
    HookManager
    Direct Known Subclasses:
    SystemHookManager

    public class SystemHookManager
    extends java.lang.Object
    implements HookManager
    This class provides a handler for processing GitLab System Hook callouts.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SYSTEM_HOOK_EVENT  
    • Constructor Summary

      Constructors 
      Constructor Description
      SystemHookManager()
      Create a HookManager to handle GitLab system hook events.
      SystemHookManager​(java.lang.String secretToken)
      Create a HookManager to handle GitLab system hook events which will be verified against the specified secretToken.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(org.gitlab4j.api.systemhooks.SystemHookListener listener)
      Adds a System Hook event listener.
      void fireEvent​(org.gitlab4j.api.systemhooks.SystemHookEvent event)
      Fire the event to the registered listeners.
      protected void fireGroupEvent​(org.gitlab4j.api.systemhooks.GroupSystemHookEvent event)  
      protected void fireGroupMemberEvent​(org.gitlab4j.api.systemhooks.GroupMemberSystemHookEvent event)  
      protected void fireKeyEvent​(org.gitlab4j.api.systemhooks.KeySystemHookEvent event)  
      protected void fireMergeRequestEvent​(org.gitlab4j.api.systemhooks.MergeRequestSystemHookEvent event)  
      protected void fireProjectEvent​(org.gitlab4j.api.systemhooks.ProjectSystemHookEvent event)  
      protected void firePushEvent​(org.gitlab4j.api.systemhooks.PushSystemHookEvent event)  
      protected void fireRepositoryEvent​(org.gitlab4j.api.systemhooks.RepositorySystemHookEvent event)  
      protected void fireTagPushEvent​(org.gitlab4j.api.systemhooks.TagPushSystemHookEvent event)  
      protected void fireTeamMemberEvent​(org.gitlab4j.api.systemhooks.TeamMemberSystemHookEvent event)  
      protected void fireUserEvent​(org.gitlab4j.api.systemhooks.UserSystemHookEvent event)  
      java.lang.String getSecretToken()
      Get the secret token that received hook events should be validated against.
      void handleEvent​(jakarta.servlet.http.HttpServletRequest request)
      Parses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners.
      void handleEvent​(org.gitlab4j.api.systemhooks.SystemHookEvent event)
      Verifies the provided Event and fires it off to the registered listeners.
      org.gitlab4j.api.systemhooks.SystemHookEvent handleRequest​(jakarta.servlet.http.HttpServletRequest request)
      Parses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners.
      void removeListener​(org.gitlab4j.api.systemhooks.SystemHookListener listener)
      Removes a System Hook event listener.
      void setSecretToken​(java.lang.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, wait
    • Field Detail

      • SYSTEM_HOOK_EVENT

        public static final java.lang.String SYSTEM_HOOK_EVENT
        See Also:
        Constant Field Values
    • Constructor Detail

      • SystemHookManager

        public SystemHookManager()
        Create a HookManager to handle GitLab system hook events.
      • SystemHookManager

        public SystemHookManager​(java.lang.String secretToken)
        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 Detail

      • getSecretToken

        public java.lang.String getSecretToken()
        Get the secret token that received hook events should be validated against.
        Specified by:
        getSecretToken in interface HookManager
        Returns:
        the secret token that received hook events should be validated against
      • setSecretToken

        public void setSecretToken​(java.lang.String secretToken)
        Set the secret token that received hook events should be validated against.
        Specified by:
        setSecretToken in interface HookManager
        Parameters:
        secretToken - the secret token to verify against
      • handleEvent

        public void handleEvent​(jakarta.servlet.http.HttpServletRequest request)
                         throws GitLabApiException
        Parses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners.
        Specified by:
        handleEvent in interface HookManager
        Parameters:
        request - the HttpServletRequest to read the Event instance from
        Throws:
        GitLabApiException - if the parsed event is not supported
      • handleRequest

        public org.gitlab4j.api.systemhooks.SystemHookEvent handleRequest​(jakarta.servlet.http.HttpServletRequest request)
                                                                   throws GitLabApiException
        Parses 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

        public void handleEvent​(org.gitlab4j.api.systemhooks.SystemHookEvent event)
                         throws GitLabApiException
        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

        public void addListener​(org.gitlab4j.api.systemhooks.SystemHookListener listener)
        Adds a System Hook event listener.
        Parameters:
        listener - the SystemHookListener to add
      • removeListener

        public void removeListener​(org.gitlab4j.api.systemhooks.SystemHookListener listener)
        Removes a System Hook event listener.
        Parameters:
        listener - the SystemHookListener to remove
      • fireEvent

        public void fireEvent​(org.gitlab4j.api.systemhooks.SystemHookEvent event)
                       throws GitLabApiException
        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

        protected void fireProjectEvent​(org.gitlab4j.api.systemhooks.ProjectSystemHookEvent event)
      • fireTeamMemberEvent

        protected void fireTeamMemberEvent​(org.gitlab4j.api.systemhooks.TeamMemberSystemHookEvent event)
      • fireUserEvent

        protected void fireUserEvent​(org.gitlab4j.api.systemhooks.UserSystemHookEvent event)
      • fireKeyEvent

        protected void fireKeyEvent​(org.gitlab4j.api.systemhooks.KeySystemHookEvent event)
      • fireGroupEvent

        protected void fireGroupEvent​(org.gitlab4j.api.systemhooks.GroupSystemHookEvent event)
      • fireGroupMemberEvent

        protected void fireGroupMemberEvent​(org.gitlab4j.api.systemhooks.GroupMemberSystemHookEvent event)
      • firePushEvent

        protected void firePushEvent​(org.gitlab4j.api.systemhooks.PushSystemHookEvent event)
      • fireTagPushEvent

        protected void fireTagPushEvent​(org.gitlab4j.api.systemhooks.TagPushSystemHookEvent event)
      • fireRepositoryEvent

        protected void fireRepositoryEvent​(org.gitlab4j.api.systemhooks.RepositorySystemHookEvent event)
      • fireMergeRequestEvent

        protected void fireMergeRequestEvent​(org.gitlab4j.api.systemhooks.MergeRequestSystemHookEvent event)