Class GoogleApiReader

Direct Known Subclasses:
GmailMessageReader, GoogleAnalyticsReportReader, GoogleCalendarReader, GoogleContactsReader

public abstract class GoogleApiReader extends IntegrationReader
Base class for readers that call Google APIs, holding the OAuth credential, HTTP transport and application name used to build the API client.
  • Field Details

    • JSON_FACTORY

      protected static final JsonFactory JSON_FACTORY
    • credentials

      protected final Credential credentials
    • transport

      protected final HttpTransport transport
  • Constructor Details

    • GoogleApiReader

      public GoogleApiReader(Credential credentials, HttpTransport transport)
      Creates a reader that uses the given transport; the caller remains responsible for shutting it down.
    • GoogleApiReader

      public GoogleApiReader(Credential credential)
      Creates a reader with its own trusted HTTP transport, which is shut down when the reader is closed.
  • Method Details

    • getApplicationName

      public String getApplicationName()
      Returns the application name passed to the Google API client (defaults to "DataPipeline Analytics Reporting").
    • setApplicationName

      public GoogleApiReader setApplicationName(String applicationName)
      Sets the application name passed to the Google API client (defaults to "DataPipeline Analytics Reporting").
    • close

      public void close() throws DataException
      Description copied from class: DataEndpoint
      Indicates that this endpoint has finished reading or writing.
      Overrides:
      close in class DataEndpoint
      Throws:
      DataException
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class DataReader
    • setJsonFactory

      protected <T> T setJsonFactory(T object)
      Assigns the shared JSON factory to the given Google model object unless it already has one, and returns the object.
    • toException

      public static DataException toException(GoogleJsonError e, HttpHeaders responseHeaders)
      Converts a Google JSON error into a DataException holding its code and each error's message, domain, location, location type and reason; the response headers are not used.
    • toDate

      protected static Date toDate(DateTime dateTime)
      Converts a Google DateTime to a Date, returning null for null.