コード例 #1
0
 /**
  * Stores the OAuth Access Token <code>accessToken</code>.
  *
  * @param accessToken the access Token. null, to remove the Access Token.
  * @throws CredentialsAgentException thrown if something goes wrong
  */
 @Override
 public void storeOAuthAccessToken(OAuthToken accessToken) throws CredentialsAgentException {
   if (accessToken == null) {
     Main.pref.put("oauth.access-token.key", null);
     Main.pref.put("oauth.access-token.secret", null);
   } else {
     Main.pref.put("oauth.access-token.key", accessToken.getKey());
     Main.pref.put("oauth.access-token.secret", accessToken.getSecret());
   }
 }
コード例 #2
0
 /**
  * Sets the current Access Token. This will fire a property change event for {@link
  * #ACCESS_TOKEN_PROP} if the access token has changed
  *
  * @param accessToken the new access token. null, to clear the current access token
  */
 protected void setAccessToken(OAuthToken accessToken) {
   OAuthToken oldValue = this.accessToken;
   this.accessToken = accessToken;
   if (oldValue == null ^ this.accessToken == null) {
     fireAccessTokenChanged(oldValue, this.accessToken);
   } else if (oldValue == null && this.accessToken == null) {
     // no change - don't fire an event
   } else if (!oldValue.equals(this.accessToken)) {
     fireAccessTokenChanged(oldValue, this.accessToken);
   }
 }