Class GitHubEndpoint

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Endpoint, org.apache.camel.IsSingleton, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HasId, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @UriEndpoint(firstVersion="2.15.0",
                 scheme="github",
                 title="GitHub",
                 syntax="github:type/branchName",
                 category={FILE,CLOUD,API})
    public class GitHubEndpoint
    extends org.apache.camel.support.DefaultEndpoint
    Interact with the GitHub API. The endpoint encapsulates portions of the GitHub API, relying on the org.eclipse.egit.github.core Java SDK. Available endpoint URIs include: CONSUMERS github://pullRequest (new pull requests) github://pullRequestComment (new pull request comments) github://commit/[branch] (new commits) github://tag (new tags) PRODUCERS github://pullRequestComment (create a new pull request comment; see PullRequestCommentProducer for header requirements) The endpoints will respond with org.eclipse.egit.github.core-provided POJOs (PullRequest, CommitComment, RepositoryTag, RepositoryCommit, etc.) Note: Rather than webhooks, this endpoint relies on simple polling. Reasons include: - concerned about reliability/stability if this somehow relied on an exposed, embedded server (Jetty?) - the types of payloads we're polling aren't typically large (plus, paging is available in the API) - need to support apps running somewhere not publicly accessible where a webhook would fail
    • Field Summary

      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILDED, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTINGDOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)  
      org.apache.camel.Producer createProducer()  
      String getBranchName()  
      String getEncoding()  
      String getOauthToken()  
      String getPassword()  
      String getRepoName()  
      String getRepoOwner()  
      String getState()  
      String getTargetUrl()  
      GitHubType getType()  
      String getUsername()  
      boolean hasOauth()  
      void setBranchName​(String branchName)
      Name of branch
      void setEncoding​(String encoding)
      To use the given encoding when getting a git commit file
      void setOauthToken​(String oauthToken)
      GitHub OAuth token, required unless username & password are provided
      void setPassword​(String password)
      GitHub password, required unless oauthToken is provided
      void setRepoName​(String repoName)
      GitHub repository name
      void setRepoOwner​(String repoOwner)
      GitHub repository owner (organization)
      void setState​(String state)
      To set git commit status state
      void setTargetUrl​(String targetUrl)
      To set git commit status target url
      void setType​(GitHubType type)
      What git operation to execute
      void setUsername​(String username)
      GitHub username, required unless oauthToken is provided
      • Methods inherited from class org.apache.camel.support.DefaultEndpoint

        configureConsumer, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, doStart, doStop, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isBasicPropertyBinding, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isSingleton, isSynchronous, setBasicPropertyBinding, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
      • Methods inherited from interface org.apache.camel.Endpoint

        getEndpointBaseUri, isSingletonProducer
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Method Detail

      • createProducer

        public org.apache.camel.Producer createProducer()
                                                 throws Exception
        Throws:
        Exception
      • createConsumer

        public org.apache.camel.Consumer createConsumer​(org.apache.camel.Processor processor)
                                                 throws Exception
        Throws:
        Exception
      • setType

        public void setType​(GitHubType type)
        What git operation to execute
      • getBranchName

        public String getBranchName()
      • setBranchName

        public void setBranchName​(String branchName)
        Name of branch
      • getUsername

        public String getUsername()
      • setUsername

        public void setUsername​(String username)
        GitHub username, required unless oauthToken is provided
      • getPassword

        public String getPassword()
      • setPassword

        public void setPassword​(String password)
        GitHub password, required unless oauthToken is provided
      • getOauthToken

        public String getOauthToken()
      • setOauthToken

        public void setOauthToken​(String oauthToken)
        GitHub OAuth token, required unless username & password are provided
      • hasOauth

        public boolean hasOauth()
      • getRepoOwner

        public String getRepoOwner()
      • setRepoOwner

        public void setRepoOwner​(String repoOwner)
        GitHub repository owner (organization)
      • getRepoName

        public String getRepoName()
      • setRepoName

        public void setRepoName​(String repoName)
        GitHub repository name
      • getState

        public String getState()
      • setState

        public void setState​(String state)
        To set git commit status state
      • getTargetUrl

        public String getTargetUrl()
      • setTargetUrl

        public void setTargetUrl​(String targetUrl)
        To set git commit status target url
      • getEncoding

        public String getEncoding()
      • setEncoding

        public void setEncoding​(String encoding)
        To use the given encoding when getting a git commit file