A
- the connection service API typepublic abstract class ConnectionFactory<A> extends Object
Connection
instances.
Encapsulates the differences and knowledge of specific connection implementations, for example, the difference between OAuth1 and OAuth2 based connections.Constructor and Description |
---|
ConnectionFactory(String providerId,
ServiceProvider<A> serviceProvider,
ApiAdapter<A> apiAdapter)
Creates a new ConnectionFactory.
|
Modifier and Type | Method and Description |
---|---|
abstract Connection<A> |
createConnection(ConnectionData data) |
protected ApiAdapter<A> |
getApiAdapter()
Exposes the ApiAdapter to subclasses.
|
String |
getProviderId()
The unique id of the provider this factory creates connections to.
|
protected ServiceProvider<A> |
getServiceProvider()
Exposes the ServiceProvider instance to subclasses.
|
public ConnectionFactory(String providerId, ServiceProvider<A> serviceProvider, ApiAdapter<A> apiAdapter)
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 instanceapiAdapter
- the adapter that maps common operations exposed by the ServiceProvider's API to the uniform Connection
modelpublic String getProviderId()
ConnectionFactory
in a registry to support dynamic lookup operations.protected ServiceProvider<A> getServiceProvider()
protected ApiAdapter<A> getApiAdapter()
public abstract Connection<A> createConnection(ConnectionData data)