public class AutoRefreshETClient
extends com.exacttarget.fuelsdk.ETClient
ETClient with Auto Refresh of Refresh TokenThe default ETClient does not refresh the refresh token and, as per OAuth standards, expires
after 14 days. This class extends ETClient and force refreshes the token after the configured
amount of time.
NOTE: Due to the methods available to sub-classes, when the refresh token requires refreshing, 2 API calls will be made to ExactTarget. Normal access token refreshes will behave as before.
(c) 2016 Sport Trades Ltd
License GPLv3
| Modifier and Type | Field and Description |
|---|---|
private static Duration |
DEFAULT_REFRESH_TOKEN_LIFE |
private DateTime |
lastRefreshTime |
private static Logger |
log |
private Duration |
refreshTokenLife |
| Modifier | Constructor and Description |
|---|---|
private |
AutoRefreshETClient(com.exacttarget.fuelsdk.ETConfiguration configuration)
Private constructor as calling this directly, without
initialiseRefreshTracking(Duration), just gives you an ETClient |
private |
AutoRefreshETClient(String file)
Private constructor as calling this directly, without
initialiseRefreshTracking(Duration), just gives you an ETClient |
| Modifier and Type | Method and Description |
|---|---|
DateTime |
getLastRefreshTime() |
private void |
initialiseRefreshTracking(Duration refreshTokenLife) |
static AutoRefreshETClient |
newRefreshClient(com.exacttarget.fuelsdk.ETConfiguration configuration,
Duration refreshTokenLife)
Provides a functionally equivalent version of
ETClient with automatic refresh of the refresh token based on
the supplied duration |
static AutoRefreshETClient |
newRefreshClient(String file,
Duration refreshTokenLife)
Provides a functionally equivalent version of
ETClient with automatic refresh of the refresh token based on
the supplied duration |
String |
refreshToken()
Performs the standard
ETClient.refreshToken() with the added refresh of the refresh token if
it has been greater than the specified duration (refreshTokenLife) since the last refresh. |
autoHydrateObjects, create, create, delete, delete, delete, delete, getAccessToken, getClientId, getConfiguration, getGson, getLegacyToken, getRestConnection, getRESTConnection, getSoapConnection, getSOAPConnection, instantiate, requestToken, requestToken, retrieve, retrieve, retrieve, retrieve, retrieve, retrieve, retrieve, retrieveObject, retrieveObject, retrieveObject, retrieveObjects, retrieveObjects, retrieveObjects, retrieveObjects, retrieveObjects, retrieveObjects, retrieveObjects, update, update, updateprivate static final Logger log
private static final Duration DEFAULT_REFRESH_TOKEN_LIFE
private Duration refreshTokenLife
private DateTime lastRefreshTime
private AutoRefreshETClient(String file) throws com.exacttarget.fuelsdk.ETSdkException
initialiseRefreshTracking(Duration), just gives you an ETClientcom.exacttarget.fuelsdk.ETSdkExceptionprivate AutoRefreshETClient(com.exacttarget.fuelsdk.ETConfiguration configuration)
throws com.exacttarget.fuelsdk.ETSdkException
initialiseRefreshTracking(Duration), just gives you an ETClientcom.exacttarget.fuelsdk.ETSdkExceptionpublic static AutoRefreshETClient newRefreshClient(String file, Duration refreshTokenLife) throws com.exacttarget.fuelsdk.ETSdkException
ETClient with automatic refresh of the refresh token based on
the supplied durationrefreshTokenLife - The duration between refresh token refreshes. Pass null to use the default
(DEFAULT_REFRESH_TOKEN_LIFE)com.exacttarget.fuelsdk.ETSdkExceptionETClient.ETClient(String)public static AutoRefreshETClient newRefreshClient(com.exacttarget.fuelsdk.ETConfiguration configuration, Duration refreshTokenLife) throws com.exacttarget.fuelsdk.ETSdkException
ETClient with automatic refresh of the refresh token based on
the supplied durationrefreshTokenLife - The duration between refresh token refreshes. Pass null to use the default
(DEFAULT_REFRESH_TOKEN_LIFE)com.exacttarget.fuelsdk.ETSdkExceptionETClient.ETClient(ETConfiguration)public String refreshToken() throws com.exacttarget.fuelsdk.ETSdkException
ETClient.refreshToken() with the added refresh of the refresh token if
it has been greater than the specified duration (refreshTokenLife) since the last refresh.refreshToken in class com.exacttarget.fuelsdk.ETClientcom.exacttarget.fuelsdk.ETSdkExceptionpublic DateTime getLastRefreshTime()
private void initialiseRefreshTracking(Duration refreshTokenLife) throws IllegalArgumentException
IllegalArgumentExceptionCopyright © 2016. All rights reserved.