com.microsoft.tfs.core.config
Class DefaultConnectionAdvisor

java.lang.Object
  extended by com.microsoft.tfs.core.config.DefaultConnectionAdvisor
All Implemented Interfaces:
ConnectionAdvisor

public class DefaultConnectionAdvisor
extends java.lang.Object
implements ConnectionAdvisor

The default ConnectionAdvisor implementation.

Non-trivial client applications will almost certainly want to extend this class, if only to override #getBasePersistenceStore(ConnectionInstanceData) so cache data goes into a custom location (perhaps named for the vendor).

Since:
TEE-SDK-10.1
Thread-safety:
immutable

Constructor Summary
DefaultConnectionAdvisor(java.util.Locale locale, java.util.TimeZone timeZone)
          Creates a DefaultConnectionAdvisor that will return the specified Locale and TimeZone for all ConnectionInstanceDatas.
 
Method Summary
 ClientFactory getClientFactory(ConnectionInstanceData instanceData)
          Called by the TFSConnection the first time that a client is requested.
 HTTPClientFactory getHTTPClientFactory(ConnectionInstanceData instanceData)
          Called by the TFSConnection the first time that the TFSConnection's HttpClient is requested.
 java.util.Locale getLocale(ConnectionInstanceData instanceData)
           Called by the TFSConnection the first time that the TFSConnection's Locale is requested.
 PersistenceStoreProvider getPersistenceStoreProvider(ConnectionInstanceData instanceData)
          Called by the TFSConnection the first time that the TFSConnection's PersistenceStoreProvider is requested.
 ServerURIProvider getServerURIProvider(ConnectionInstanceData instanceData)
          Called by the TFSConnection the first time that the TFSConnection's server URI is requested.
 TFProxyServerSettingsFactory getTFProxyServerSettingsFactory(ConnectionInstanceData instanceData)
          Called by the TFSConnection the first time that the TFSConnection's TFProxyServerSettings is requested.
 java.util.TimeZone getTimeZone(ConnectionInstanceData instanceData)
          Called by the TFSConnection the first time that the TFSConnection's TimeZone is requested.
 WebServiceFactory getWebServiceFactory(ConnectionInstanceData instanceData)
          Called by the TFSConnection the first time that a web service is requested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConnectionAdvisor

public DefaultConnectionAdvisor(java.util.Locale locale,
                                java.util.TimeZone timeZone)
Creates a DefaultConnectionAdvisor that will return the specified Locale and TimeZone for all ConnectionInstanceDatas.

Parameters:
locale - the locale (must not be null)
timeZone - the time zone (must not be null)
Method Detail

getLocale

public java.util.Locale getLocale(ConnectionInstanceData instanceData)
Description copied from interface: ConnectionAdvisor

Called by the TFSConnection the first time that the TFSConnection's Locale is requested.

This value will be sent to the server with web service requests to identify the client's preferred language and country (via the HTTP Accept-Language header). It is also used by core classes to compare strings, format output, etc., in the correct way for the current connection.

Specified by:
getLocale in interface ConnectionAdvisor
Parameters:
instanceData - the TFSConnection's instance data
Returns:
a Locale for the TFSConnection to use, never null

getTimeZone

public java.util.TimeZone getTimeZone(ConnectionInstanceData instanceData)
Description copied from interface: ConnectionAdvisor
Called by the TFSConnection the first time that the TFSConnection's TimeZone is requested.

Specified by:
getTimeZone in interface ConnectionAdvisor
Parameters:
instanceData - the TFSConnection's instance data
Returns:
a TimeZone for the TFSConnection to use, never null

getPersistenceStoreProvider

public PersistenceStoreProvider getPersistenceStoreProvider(ConnectionInstanceData instanceData)
Description copied from interface: ConnectionAdvisor
Called by the TFSConnection the first time that the TFSConnection's PersistenceStoreProvider is requested.

Specified by:
getPersistenceStoreProvider in interface ConnectionAdvisor
Parameters:
instanceData - the TFSConnection's instance data
Returns:
a PersistenceStoreProvider for the TFSConnection to use, never null

getClientFactory

public ClientFactory getClientFactory(ConnectionInstanceData instanceData)
Description copied from interface: ConnectionAdvisor
Called by the TFSConnection the first time that a client is requested.

Specified by:
getClientFactory in interface ConnectionAdvisor
Parameters:
instanceData - the TFSConnection's instance data
Returns:
a ClientFactory for the TFSConnection to use (must not be null)

getHTTPClientFactory

public HTTPClientFactory getHTTPClientFactory(ConnectionInstanceData instanceData)
Description copied from interface: ConnectionAdvisor
Called by the TFSConnection the first time that the TFSConnection's HttpClient is requested.

Specified by:
getHTTPClientFactory in interface ConnectionAdvisor
Parameters:
instanceData - the TFSConnection's instance data
Returns:
a HTTPClientFactory for the TFSConnection to use (must not be null)

getServerURIProvider

public ServerURIProvider getServerURIProvider(ConnectionInstanceData instanceData)
Description copied from interface: ConnectionAdvisor
Called by the TFSConnection the first time that the TFSConnection's server URI is requested.

Specified by:
getServerURIProvider in interface ConnectionAdvisor
Parameters:
instanceData - the TFSConnection's instance data
Returns:
a ServerURIProvider for the TFSConnection to use (must not be null)

getTFProxyServerSettingsFactory

public TFProxyServerSettingsFactory getTFProxyServerSettingsFactory(ConnectionInstanceData instanceData)
Description copied from interface: ConnectionAdvisor
Called by the TFSConnection the first time that the TFSConnection's TFProxyServerSettings is requested.

Specified by:
getTFProxyServerSettingsFactory in interface ConnectionAdvisor
Parameters:
instanceData - the TFSConnection's instance data (never null )
Returns:
a TFProxyServerSettings object for the TFSConnection to use, or null to not use a TFS proxy server

getWebServiceFactory

public WebServiceFactory getWebServiceFactory(ConnectionInstanceData instanceData)
Called by the TFSConnection the first time that a web service is requested.

Returns a DefaultWebServiceFactory that uses the Locale returned by getLocale(ConnectionInstanceData) and a DefaultTransportRequestHandler, which can only fetch OAuth WRAP credentials for the TFSConnection in use. Derived classes that want different federated authentication behavior, but keep the other DefaultWebServiceFactory behavior, can return a DefaultWebServiceFactory created with a different TransportRequestHandler.

Specified by:
getWebServiceFactory in interface ConnectionAdvisor
Parameters:
instanceData - the TFSConnection's instance data
Returns:
a WebServiceFactory for the TFSConnection to use (must not be null)


© 2015 Microsoft. All rights reserved.