Spring Social

org.springframework.social.connect.support
Class ConnectionFactoryRegistry

java.lang.Object
  extended by org.springframework.social.connect.support.ConnectionFactoryRegistry
All Implemented Interfaces:
ConnectionFactoryLocator

public class ConnectionFactoryRegistry
extends java.lang.Object
implements ConnectionFactoryLocator

A registry for service provider connection factories. Implements ConnectionFactoryLocator for locating registered factory instances. Call addConnectionFactory(ConnectionFactory) to add to this registry.

Author:
Keith Donald

Constructor Summary
ConnectionFactoryRegistry()
           
 
Method Summary
 void addConnectionFactory(ConnectionFactory<?> connectionFactory)
          Add a ConnectionFactory to this registry.
<A> ConnectionFactory<A>
getConnectionFactory(java.lang.Class<A> apiType)
          Lookup a ConnectionFactory by apiType; for example, FacebookApi.class.
 ConnectionFactory<?> getConnectionFactory(java.lang.String providerId)
          Lookup a ConnectionFactory by providerId; for example, "facebook".
 java.util.Set<java.lang.String> registeredProviderIds()
          Returns the set of providerIds for which a ConnectionFactory is registered; for example, { "twitter", "facebook", "foursquare" } Elements in this set can be passed to ConnectionFactoryLocator.getConnectionFactory(String) to fetch a specific factory instance.
 void setConnectionFactories(java.util.List<ConnectionFactory<?>> connectionFactories)
          Set the group of service provider connection factories registered in this registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionFactoryRegistry

public ConnectionFactoryRegistry()
Method Detail

addConnectionFactory

public void addConnectionFactory(ConnectionFactory<?> connectionFactory)
Add a ConnectionFactory to this registry.

Parameters:
connectionFactory - the connection factory

setConnectionFactories

public void setConnectionFactories(java.util.List<ConnectionFactory<?>> connectionFactories)
Set the group of service provider connection factories registered in this registry. JavaBean setter that allows for this object to be more easily configured by tools. For programmatic configuration, prefer addConnectionFactory(ConnectionFactory).

Parameters:
connectionFactories - the set of connection factories to register

getConnectionFactory

public ConnectionFactory<?> getConnectionFactory(java.lang.String providerId)
Description copied from interface: ConnectionFactoryLocator
Lookup a ConnectionFactory by providerId; for example, "facebook". The returned factory can be used to create connections to the provider. Used to support connection creation in a dynamic manner across the set of registered providers.

Specified by:
getConnectionFactory in interface ConnectionFactoryLocator

getConnectionFactory

public <A> ConnectionFactory<A> getConnectionFactory(java.lang.Class<A> apiType)
Description copied from interface: ConnectionFactoryLocator
Lookup a ConnectionFactory by apiType; for example, FacebookApi.class. The returned factory can be used to create connections to the provider. Primarily used in support of connection restoration requested by application code.

Specified by:
getConnectionFactory in interface ConnectionFactoryLocator
See Also:
ConnectionRepository.getPrimaryConnection(Class)

registeredProviderIds

public java.util.Set<java.lang.String> registeredProviderIds()
Description copied from interface: ConnectionFactoryLocator
Returns the set of providerIds for which a ConnectionFactory is registered; for example, { "twitter", "facebook", "foursquare" } Elements in this set can be passed to ConnectionFactoryLocator.getConnectionFactory(String) to fetch a specific factory instance.

Specified by:
registeredProviderIds in interface ConnectionFactoryLocator

Spring Social