Spring Social

org.springframework.social.connect
Class ConnectionFactory<A>

java.lang.Object
  extended by org.springframework.social.connect.ConnectionFactory<A>
Type Parameters:
A - the connection service API type
Direct Known Subclasses:
OAuth1ConnectionFactory, OAuth2ConnectionFactory

public abstract class ConnectionFactory<A>
extends java.lang.Object

Base abstraction for factories that construct service provider Connection instances. Encapsulates the differences and knowledge of specific connection implementations, for example, the difference between OAuth1 and OAuth2 based connections.

Author:
Keith Donald

Constructor Summary
ConnectionFactory(java.lang.String providerId, ServiceProvider<A> serviceProvider, ApiAdapter<A> apiAdapter)
          Creates a new ConnectionFactory.
 
Method Summary
abstract  Connection<A> createConnection(ConnectionData data)
           
protected  ApiAdapter<A> getApiAdapter()
          Exposes the ApiAdapter to subclasses.
 java.lang.String getProviderId()
          The unique id of the provider this factory creates connections to.
protected  ServiceProvider<A> getServiceProvider()
          Exposes the ServiceProvider instance to subclasses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionFactory

public ConnectionFactory(java.lang.String providerId,
                         ServiceProvider<A> serviceProvider,
                         ApiAdapter<A> apiAdapter)
Creates a new ConnectionFactory.

Parameters:
providerId - the assigned, unique id of the provider this factory creates connections to (used when indexing this factory in a registry)
serviceProvider - the model for the ServiceProvider used to conduct the connection authorization/refresh flow and obtain a native service API instance
apiAdapter - the adapter that maps common operations exposed by the ServiceProvider's API to the uniform Connection model
Method Detail

getProviderId

public java.lang.String getProviderId()
The unique id of the provider this factory creates connections to. Used to index this ConnectionFactory in a registry to support dynamic lookup operations.

See Also:
ConnectionFactoryLocator.getConnectionFactory(String).

getServiceProvider

protected ServiceProvider<A> getServiceProvider()
Exposes the ServiceProvider instance to subclasses.


getApiAdapter

protected ApiAdapter<A> getApiAdapter()
Exposes the ApiAdapter to subclasses.


createConnection

public abstract Connection<A> createConnection(ConnectionData data)

Spring Social