Spring Social

org.springframework.social.connect
Interface ApiAdapter<A>

Type Parameters:
A - the service provider's API interface

public interface ApiAdapter<A>

An adapter that bridges between the uniform Connection model and a specific provider API model.

Author:
Keith Donald

Method Summary
 UserProfile fetchUserProfile(A api)
          Implements Connection.fetchUserProfile() for connections to the given API.
 void setConnectionValues(A api, ConnectionValues values)
          Sets values for ConnectionKey.getProviderUserId(), Connection.getDisplayName(), Connection.getProfileUrl(), and Connection.getImageUrl() for connections to the given API.
 boolean test(A api)
          Implements Connection.test() for connections to the given API.
 void updateStatus(A api, java.lang.String message)
          Implements Connection.updateStatus(String) for connections to the given API.
 

Method Detail

test

boolean test(A api)
Implements Connection.test() for connections to the given API.

Parameters:
api - the API binding
Returns:
true if the API is functional, false if not

setConnectionValues

void setConnectionValues(A api,
                         ConnectionValues values)
Sets values for ConnectionKey.getProviderUserId(), Connection.getDisplayName(), Connection.getProfileUrl(), and Connection.getImageUrl() for connections to the given API.

Parameters:
api - the API binding
values - the connection values to set
Throws:
ApiException - if there is a problem fetching connection information from the provider.

fetchUserProfile

UserProfile fetchUserProfile(A api)
Implements Connection.fetchUserProfile() for connections to the given API. Should never return null. If the provider's API does not expose user profile data, this method should return UserProfile.EMPTY.

Parameters:
api - the API binding
Returns:
the service provider user profile
Throws:
ApiException - if there is a problem fetching a user profile from the provider.
See Also:
UserProfileBuilder

updateStatus

void updateStatus(A api,
                  java.lang.String message)
Implements Connection.updateStatus(String) for connections to the given API. If the provider does not have a status concept calling this method should have no effect.

Parameters:
api - the API binding
message - the status message
Throws:
ApiException - if there is a problem updating the user's status on the provider.

Spring Social