* {@inheritDoc}
*/
@Override
public boolean restoreAccessToken(OAuth1Adapter adapter)
{
RestoreAccessTokenCallback restore = adapter.getOauthRestoreAccessToken();
if (restore != null)
{
if (getLogger().isDebugEnabled())
{
getLogger().debug("Attempting to restore access token...");
}
try
{
restore.restoreAccessToken();
adapter.setAccessToken(restore.getAccessToken());
adapter.setAccessTokenSecret(restore.getAccessTokenSecret());
this.getConsumer(adapter).setTokenWithSecret(restore.getAccessToken(),
restore.getAccessTokenSecret());
if (getLogger().isDebugEnabled())
{
getLogger().debug(
String.format(
"Access token and secret has been restored successfully [accessToken = %s] [accessTokenSecret = %s]",
restore.getAccessToken(), restore.getAccessTokenSecret()));
}
return true;
}
catch (Exception e)