Class OAuthService

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    OAuth10aService, OAuth20Service

    public abstract class OAuthService
    extends java.lang.Object
    implements java.io.Closeable
    • Field Detail

      • apiKey

        private final java.lang.String apiKey
      • apiSecret

        private final java.lang.String apiSecret
      • callback

        private final java.lang.String callback
      • userAgent

        private final java.lang.String userAgent
      • debugStream

        private final java.io.OutputStream debugStream
    • Constructor Detail

      • OAuthService

        public OAuthService​(java.lang.String apiKey,
                            java.lang.String apiSecret,
                            java.lang.String callback,
                            java.io.OutputStream debugStream,
                            java.lang.String userAgent,
                            HttpClientConfig httpClientConfig,
                            HttpClient httpClient)
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • getApiKey

        public java.lang.String getApiKey()
      • getApiSecret

        public java.lang.String getApiSecret()
      • getCallback

        public java.lang.String getCallback()
      • getVersion

        public abstract java.lang.String getVersion()
        Returns the OAuth version of the service.
        Returns:
        OAuth version as string
      • executeAsync

        public java.util.concurrent.Future<Response> executeAsync​(OAuthRequest request)
      • execute

        public Response execute​(OAuthRequest request)
                         throws java.lang.InterruptedException,
                                java.util.concurrent.ExecutionException,
                                java.io.IOException
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.io.IOException
      • log

        public void log​(java.lang.String message)
        No need to wrap usages in isDebug().
        Parameters:
        message - message to log
      • log

        public void log​(java.lang.String messagePattern,
                        java.lang.Object... params)
        Wrap usages in isDebug(). It was made for optimization - to not calculate "params" in production mode.
        Parameters:
        messagePattern - messagePattern
        params - params
      • isDebug

        protected boolean isDebug()