Class ConnectionFactory<A>

  extended by<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 ServiceProviderConnection instances. Encapsulates the differences and knowledge of specific connection implementations, for example, the difference between OAuth1 and OAuth2 based connections.

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


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

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 ServiceProviderConnection model
Method Detail


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

See Also:


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


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


public abstract Connection<A> createConnection(ConnectionData data)