org.wso2.carbon.dataservices.sql.driver.util

## Class GSpreadFeedProcessor

- java.lang.Object
- - org.wso2.carbon.dataservices.sql.driver.util.GSpreadFeedProcessor

-     public class GSpreadFeedProcessor
      extends Object

  Helper class to manipulate feed requests with access tokens

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GSpreadFeedProcessor(String clientId, String clientSecret, String refReshToken, String visibility, String baseRegistryOauthTokenPath)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `URL` | `generateWorksheetFeedURL(String key)`
    `String` | `getClientId()`
    `String` | `getClientSecret()`
    `<F extends com.google.gdata.data.IFeed> F` | `getFeed(com.google.gdata.client.Query query, Class<F> feedClass)` this method has the logic implemented to use access token to access spreadsheet api and it will be shared between cluster nodes via registry as well.
    `<F extends com.google.gdata.data.IFeed> F` | `getFeed(URL feedUrl, Class<F> feedClass)` this method has the logic implemented to use access token to access spreadsheet api and it will be shared between cluster nodes via registry as well.
    `String` | `getRefreshToken()`
    `com.google.gdata.client.spreadsheet.SpreadsheetService` | `getService()`
    `URL` | `getSpreadSheetFeedUrl()`
    `<E extends com.google.gdata.data.IEntry> E` | `insert(URL feedUrl, E entry)`
    `boolean` | `requiresAuth()` method to check whether authentication is required or not
    `void` | `setClientId(String clientId)`
    `void` | `setClientSecret(String clientSecret)`
    `void` | `setRefreshToken(String refreshToken)`
    `void` | `setService(com.google.gdata.client.spreadsheet.SpreadsheetService service)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GSpreadFeedProcessor

          public GSpreadFeedProcessor(String clientId,
                                      String clientSecret,
                                      String refReshToken,
                                      String visibility,
                                      String baseRegistryOauthTokenPath)
                               throws SQLException

      Throws:
        `SQLException`

  - ### Method Detail

    - #### setClientId

          public void setClientId(String clientId)

    - #### getClientId

          public String getClientId()

    - #### setClientSecret

          public void setClientSecret(String clientSecret)

    - #### getClientSecret

          public String getClientSecret()

    - #### setRefreshToken

          public void setRefreshToken(String refreshToken)

    - #### getRefreshToken

          public String getRefreshToken()

    - #### setService

          public void setService(com.google.gdata.client.spreadsheet.SpreadsheetService service)

    - #### getService

          public com.google.gdata.client.spreadsheet.SpreadsheetService getService()

    - #### insert

          public <E extends com.google.gdata.data.IEntry> E insert(URL feedUrl,
                                                                   E entry)
                                                            throws SQLException

      Throws:
        `SQLException`

    - #### getFeed

          public <F extends com.google.gdata.data.IFeed> F getFeed(URL feedUrl,
                                                                   Class<F> feedClass)
                                                            throws SQLException

      this method has the logic implemented to use access token to access spreadsheet api and it will be shared between cluster nodes via registry as well. this will refresh the access token if access tokens stored in memory and registry are expired, then it will store the new access token in registry so that it will be shared among nodes
      Type Parameters:
        `F` -
      Parameters:
        `feedUrl` -
        `feedClass` -
      Returns:
        feed
      Throws:
        `Exception`
        `SQLException`

    - #### getFeed

          public <F extends com.google.gdata.data.IFeed> F getFeed(com.google.gdata.client.Query query,
                                                                   Class<F> feedClass)
                                                            throws SQLException

      this method has the logic implemented to use access token to access spreadsheet api and it will be shared between cluster nodes via registry as well. this will refresh the access token if access tokens stored in memory and registry are expired, then it will store the new access token in registry so that it will be shared among nodes
      Type Parameters:
        `F` -
      Parameters:
        `query` -
        `feedClass` -
      Returns:
        feed
      Throws:
        `Exception`
        `SQLException`

    - #### getSpreadSheetFeedUrl

          public URL getSpreadSheetFeedUrl()
                                    throws MalformedURLException

      Throws:
        `MalformedURLException`

    - #### generateWorksheetFeedURL

          public URL generateWorksheetFeedURL(String key)
                                       throws MalformedURLException

      Throws:
        `MalformedURLException`

    - #### requiresAuth

          public boolean requiresAuth()

      method to check whether authentication is required or not
      Returns:
        true if authentication is required else false

Copyright © 2023 WSO2. All rights reserved.