com.microsoft.tfs.core.clients.registration
Class RegistrationClient

java.lang.Object
  extended by com.microsoft.tfs.core.clients.registration.RegistrationClient

public class RegistrationClient
extends java.lang.Object

A client for accessing the registration data available from a Team Foundation server.

This client provides several services on top of the Registration web service:

A RegistrationClient should normally be obtained from a TFSTeamProjectCollection instead of being manually constructed.

Note: RegistrationClient is unlike other clients. TFSConnection calls into this client, and this calls back. Thus you need to be very careful of locking between TFSConnection and this.

Since:
TEE-SDK-10.1
Thread-safety:
thread-safe

Constructor Summary
RegistrationClient(TFSTeamProjectCollection connection)
          Creates a new RegistrationClient with a default refresh interval and disk caching enabled.
RegistrationClient(TFSTeamProjectCollection connection, long refreshIntervalMillis, boolean enableDiskCache)
          Creates a new RegistrationClient, specifying the refresh interval and disk caching policy.
 
Method Summary
 ArtifactType getArtifactType(java.lang.String toolId, java.lang.String artifactTypeName)
          Gets the specified ArtifactType for the specified tool.
 ArtifactType getArtifactType(java.lang.String toolId, java.lang.String artifactTypeName, boolean forceRefresh)
          Gets the specified ArtifactType for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 ArtifactType[] getArtifactTypes(java.lang.String toolId)
          Gets all of the ArtifactTypes for the specified tool.
 ArtifactType[] getArtifactTypes(java.lang.String toolId, boolean forceRefresh)
          Gets all of the ArtifactTypes for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 RegistrationExtendedAttribute getExtendedAttribute(java.lang.String toolId, java.lang.String attributeName)
          Gets the specified RegistrationExtendedAttribute for the specified tool.
 RegistrationExtendedAttribute getExtendedAttribute(java.lang.String toolId, java.lang.String attributeName, boolean forceRefresh)
          Gets the specified RegistrationExtendedAttribute for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 RegistrationExtendedAttribute[] getExtendedAttributes(java.lang.String toolId)
          Gets all of the RegistrationExtendedAttributes for the specified tool.
 RegistrationExtendedAttribute[] getExtendedAttributes(java.lang.String toolId, boolean forceRefresh)
          Gets all of the RegistrationExtendedAttributes for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 java.lang.String getExtendedAttributeValue(java.lang.String toolId, java.lang.String attributeName)
          Gets the specified extended attribute value for the specified tool.
 java.lang.String getExtendedAttributeValue(java.lang.String toolId, java.lang.String attributeName, boolean forceRefresh)
          Gets the specified extended attribute value for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 com.microsoft.tfs.util.GUID getInstanceID()
          Obtains the instance ID (server GUID) from the registration data.
 com.microsoft.tfs.util.GUID getInstanceID(boolean forceRefresh)
          Obtains the instance ID (server GUID) from the registration data, specifying whether to force a refresh of the registration data from the TF server.
 OutboundLinkType[] getOutboundLinkTypes(java.lang.String toolId, java.lang.String artifactTypeName)
          Gets all of the OutboundLinkTypes for the specified tool and artifact type.
 OutboundLinkType[] getOutboundLinkTypes(java.lang.String toolId, java.lang.String artifactTypeName, boolean forceRefresh)
          Gets all of the OutboundLinkTypes for the specified tool and artifact type, specifying whether to force a refresh of the registration data from the TF server.
 RegistrationEntry[] getRegistrationEntries()
          Gets all of the RegistrationEntrys.
 RegistrationEntry[] getRegistrationEntries(boolean forceRefresh)
          Gets all of the RegistrationEntrys, specifying whether to force a refresh of the registration data from the TF server.
 RegistrationEntry getRegistrationEntry(java.lang.String toolId)
          Gets the RegistrationEntry for the specified tool.
 RegistrationEntry getRegistrationEntry(java.lang.String toolId, boolean forceRefresh)
          Gets the RegistrationEntry for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 java.lang.String getRosarioURLForTeamProject(java.lang.String interfaceName, java.lang.String projectName)
           
 ServiceInterface getServiceInterface(java.lang.String toolId, java.lang.String serviceInterfaceName)
          Gets the specified ServiceInterface for the specified tool.
 ServiceInterface getServiceInterface(java.lang.String toolId, java.lang.String serviceInterfaceName, boolean forceRefresh)
          Gets the specified ServiceInterface for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 ServiceInterface[] getServiceInterfaces(java.lang.String toolId)
          Gets all of the ServiceInterfaces for the specified tool.
 ServiceInterface[] getServiceInterfaces(java.lang.String toolId, boolean forceRefresh)
          Gets all of the ServiceInterfaces for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 java.lang.String getServiceInterfaceURL(java.lang.String toolId, java.lang.String serviceInterfaceName)
          Gets the specified service interface URL for the specified tool.
 java.lang.String getServiceInterfaceURL(java.lang.String toolId, java.lang.String serviceInterfaceName, boolean forceRefresh, boolean relative)
          Gets the specified service interface URL for the specified tool, specifying whether to force a refresh of the registration data from the TF server.
 void refresh(boolean force)
          Called to ensure that the registration data is up to date, specifying whether to force a refresh of the data from the TF server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistrationClient

public RegistrationClient(TFSTeamProjectCollection connection)
Creates a new RegistrationClient with a default refresh interval and disk caching enabled.

Parameters:
connection - the TFSTeamProjectCollection to use (must not be null)

RegistrationClient

public RegistrationClient(TFSTeamProjectCollection connection,
                          long refreshIntervalMillis,
                          boolean enableDiskCache)
Creates a new RegistrationClient, specifying the refresh interval and disk caching policy.

Parameters:
connection - the TFSTeamProjectCollection to use (must not be null)
refreshIntervalMillis - specifies the amount of time between refreshes of the registration data from the server
enableDiskCache - true to enable caching of registration data to disk
Method Detail

getRegistrationEntries

public RegistrationEntry[] getRegistrationEntries()
Gets all of the RegistrationEntrys. The returned array is safe - no references to the returned RegistrationEntrys are held by this class.

Returns:
all of the RegistrationEntrys (never null)

getRegistrationEntries

public RegistrationEntry[] getRegistrationEntries(boolean forceRefresh)
Gets all of the RegistrationEntrys, specifying whether to force a refresh of the registration data from the TF server. The returned array is safe - no references to the returned RegistrationEntrys are held by this class.

Parameters:
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
all of the RegistrationEntrys (never null)

getRegistrationEntry

public RegistrationEntry getRegistrationEntry(java.lang.String toolId)
Gets the RegistrationEntry for the specified tool. The returned RegistrationEntry is safe - no reference to it is held by this class.

Parameters:
toolId - specifies the tool to get the RegistrationEntry for (case insensitive) (must not be null)
Returns:
the RegistrationEntry for the specified tool, or null if the specified tool does not have a registration entry

getRegistrationEntry

public RegistrationEntry getRegistrationEntry(java.lang.String toolId,
                                              boolean forceRefresh)
Gets the RegistrationEntry for the specified tool, specifying whether to force a refresh of the registration data from the TF server. The returned RegistrationEntry is safe - no reference to it is held by this class.

Parameters:
toolId - specifies the tool to get the RegistrationEntry for (case insensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
the RegistrationEntry for the specified tool, or null if the specified tool does not have a registration entry

getServiceInterfaces

public ServiceInterface[] getServiceInterfaces(java.lang.String toolId)
Gets all of the ServiceInterfaces for the specified tool. The returned array is safe - no references to the ServiceInterfaces are held by this class.

Parameters:
toolId - specifies the tool to get ServiceInterfaces for (case insensitive) (must not be null)
Returns:
all of the ServiceInterfaces for the specified tool, or null if the specified tool does not have a registration entry

getServiceInterfaces

public ServiceInterface[] getServiceInterfaces(java.lang.String toolId,
                                               boolean forceRefresh)
Gets all of the ServiceInterfaces for the specified tool, specifying whether to force a refresh of the registration data from the TF server. The returned array is safe - no references to the ServiceInterfaces are held by this class.

Parameters:
toolId - specifies the tool to get ServiceInterfaces for (case insensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
all of the ServiceInterfaces for the specified tool, or null if the specified tool does not have a registration entry

getServiceInterface

public ServiceInterface getServiceInterface(java.lang.String toolId,
                                            java.lang.String serviceInterfaceName)
Gets the specified ServiceInterface for the specified tool. The returned ServiceInterface is safe - no reference to it is held by this class.

Parameters:
toolId - specifies the tool to get the ServiceInterface for (case insensitive) (must not be null)
serviceInterfaceName - specifies the service interface to get (case insensitive) (must not be null)
Returns:
the specified ServiceInterface for the specified tool, or null if the requested service interface does not exist

getServiceInterface

public ServiceInterface getServiceInterface(java.lang.String toolId,
                                            java.lang.String serviceInterfaceName,
                                            boolean forceRefresh)
Gets the specified ServiceInterface for the specified tool, specifying whether to force a refresh of the registration data from the TF server. The returned ServiceInterface is safe - no reference to it is held by this class.

Parameters:
toolId - specifies the tool to get the ServiceInterface for (case insensitive) (must not be null)
serviceInterfaceName - specifies the service interface to get (case insensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
the specified ServiceInterface for the specified tool, or null if the requested service interface does not exist

getServiceInterfaceURL

public java.lang.String getServiceInterfaceURL(java.lang.String toolId,
                                               java.lang.String serviceInterfaceName)
Gets the specified service interface URL for the specified tool.

Parameters:
toolId - specifies the tool to get the ServiceInterface for (case insensitive) (must not be null)
serviceInterfaceName - specifies the service interface to get (case insensitive) (must not be null)
Returns:
the service interface url, or null if no such service interface exists

getServiceInterfaceURL

public java.lang.String getServiceInterfaceURL(java.lang.String toolId,
                                               java.lang.String serviceInterfaceName,
                                               boolean forceRefresh,
                                               boolean relative)
Gets the specified service interface URL for the specified tool, specifying whether to force a refresh of the registration data from the TF server.

Parameters:
toolId - specifies the tool to get the ServiceInterface for (case insensitive) (must not be null)
serviceInterfaceName - specifies the service interface to get (case insensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
the service interface url, or null if no such service interface exists

getArtifactTypes

public ArtifactType[] getArtifactTypes(java.lang.String toolId)
Gets all of the ArtifactTypes for the specified tool. The returned array is safe - no references to the ArtifactTypes are held by this class.

Parameters:
toolId - specifies the tool to get ArtifactTypes for (case insensitive) (must not be null)
Returns:
all of the ArtifactTypes for the specified tool, or null if the specified tool does not have a registration entry

getArtifactTypes

public ArtifactType[] getArtifactTypes(java.lang.String toolId,
                                       boolean forceRefresh)
Gets all of the ArtifactTypes for the specified tool, specifying whether to force a refresh of the registration data from the TF server. The returned array is safe - no references to the ArtifactTypes are held by this class.

Parameters:
toolId - specifies the tool to get ArtifactTypes for (case insensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
all of the ArtifactTypes for the specified tool, or null if the specified tool does not have a registration entry

getArtifactType

public ArtifactType getArtifactType(java.lang.String toolId,
                                    java.lang.String artifactTypeName)
Gets the specified ArtifactType for the specified tool. The returned ArtifactType is safe - no reference to it is held by this class.

Parameters:
toolId - specifies the tool to get the ArtifactType for (case insensitive) (must not be null)
artifactTypeName - specifies the artifact type to get (case insensitive) (must not be null)
Returns:
the specified ArtifactType for the specified tool, or null if the requested artifact type does not exist

getArtifactType

public ArtifactType getArtifactType(java.lang.String toolId,
                                    java.lang.String artifactTypeName,
                                    boolean forceRefresh)
Gets the specified ArtifactType for the specified tool, specifying whether to force a refresh of the registration data from the TF server. The returned ArtifactType is safe - no reference to it is held by this class.

Parameters:
toolId - specifies the tool to get the ArtifactType for (case insensitive) (must not be null)
artifactTypeName - specifies the artifact type to get (case insensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
the specified ArtifactType for the specified tool, or null if the requested artifact type does not exist

getOutboundLinkTypes

public OutboundLinkType[] getOutboundLinkTypes(java.lang.String toolId,
                                               java.lang.String artifactTypeName)
Gets all of the OutboundLinkTypes for the specified tool and artifact type. The returned array is safe - no references to the OutboundLinkTypes are held by this class.

Parameters:
toolId - specifies the tool to get OutboundLinkTypes for (case insensitive) (must not be null)
artifactTypeName - specifies the artifact type to get (case insensitive) (must not be null)
Returns:
all of the OutboundLinkTypes for the specified tool and artifact type, or null if there is no such tool and artifact type

getOutboundLinkTypes

public OutboundLinkType[] getOutboundLinkTypes(java.lang.String toolId,
                                               java.lang.String artifactTypeName,
                                               boolean forceRefresh)
Gets all of the OutboundLinkTypes for the specified tool and artifact type, specifying whether to force a refresh of the registration data from the TF server. The returned array is safe - no references to the OutboundLinkTypes are held by this class.

Parameters:
toolId - specifies the tool to get OutboundLinkTypes for (case insensitive) (must not be null)
artifactTypeName - specifies the artifact type to get (case insensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
all of the OutboundLinkTypes for the specified tool and artifact type, or null if there is no such tool and artifact type

getExtendedAttributes

public RegistrationExtendedAttribute[] getExtendedAttributes(java.lang.String toolId)
Gets all of the RegistrationExtendedAttributes for the specified tool. The returned array is safe - no references to the RegistrationExtendedAttributes are held by this class.

Parameters:
toolId - specifies the tool to get RegistrationExtendedAttributes for (case insensitive) (must not be null)
Returns:
all of the RegistrationExtendedAttributes for the specified tool, or null if the specified tool does not have a registration entry

getExtendedAttributes

public RegistrationExtendedAttribute[] getExtendedAttributes(java.lang.String toolId,
                                                             boolean forceRefresh)
Gets all of the RegistrationExtendedAttributes for the specified tool, specifying whether to force a refresh of the registration data from the TF server. The returned array is safe - no references to the RegistrationExtendedAttributes are held by this class.

Parameters:
toolId - specifies the tool to get RegistrationExtendedAttributes for (case insensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
all of the RegistrationExtendedAttributes for the specified tool, or null if the specified tool does not have a registration entry

getExtendedAttribute

public RegistrationExtendedAttribute getExtendedAttribute(java.lang.String toolId,
                                                          java.lang.String attributeName)
Gets the specified RegistrationExtendedAttribute for the specified tool. The returned RegistrationExtendedAttribute is safe - no reference to it is held by this class.

Parameters:
toolId - specifies the tool to get the RegistrationExtendedAttribute for (case insensitive) (must not be null)
attributeName - specifies the attribute to get (case sensitive) (must not be null)
Returns:
the specified RegistrationExtendedAttribute for the specified tool, or null if no such attribute exists

getExtendedAttribute

public RegistrationExtendedAttribute getExtendedAttribute(java.lang.String toolId,
                                                          java.lang.String attributeName,
                                                          boolean forceRefresh)
Gets the specified RegistrationExtendedAttribute for the specified tool, specifying whether to force a refresh of the registration data from the TF server. The returned RegistrationExtendedAttribute is safe - no reference to it is held by this class.

Parameters:
toolId - specifies the tool to get the RegistrationExtendedAttribute for (case insensitive) (must not be null)
attributeName - specifies the attribute to get (case sensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
the specified RegistrationExtendedAttribute for the specified tool, or null if no such attribute exists

getExtendedAttributeValue

public java.lang.String getExtendedAttributeValue(java.lang.String toolId,
                                                  java.lang.String attributeName)
Gets the specified extended attribute value for the specified tool.

Parameters:
toolId - specifies the tool to get the RegistrationExtendedAttribute for (case insensitive) (must not be null)
attributeName - specifies the attribute to get (case sensitive) (must not be null)
Returns:
the extended attribute value, or null if no such value exists

getExtendedAttributeValue

public java.lang.String getExtendedAttributeValue(java.lang.String toolId,
                                                  java.lang.String attributeName,
                                                  boolean forceRefresh)
Gets the specified extended attribute value for the specified tool, specifying whether to force a refresh of the registration data from the TF server.

Parameters:
toolId - specifies the tool to get the RegistrationExtendedAttribute for (case insensitive) (must not be null)
attributeName - specifies the attribute to get (case sensitive) (must not be null)
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
the extended attribute value, or null if no such value exists

getInstanceID

public com.microsoft.tfs.util.GUID getInstanceID()
Obtains the instance ID (server GUID) from the registration data.

Returns:
the server instance ID, or null if the instance ID could not be determined

getInstanceID

public com.microsoft.tfs.util.GUID getInstanceID(boolean forceRefresh)
Obtains the instance ID (server GUID) from the registration data, specifying whether to force a refresh of the registration data from the TF server.

Parameters:
forceRefresh - true to force a call to the server to refresh the registration data
Returns:
the server instance ID, or null if the instance ID could not be determined

refresh

public void refresh(boolean force)
Called to ensure that the registration data is up to date, specifying whether to force a refresh of the data from the TF server. If force is false and the cached data not stale, this method does nothing. Otherwise, the TF server is contacted to get the latest registration data.

Parameters:
force - true to force a server refresh even if the cached data is not stale

getRosarioURLForTeamProject

public java.lang.String getRosarioURLForTeamProject(java.lang.String interfaceName,
                                                    java.lang.String projectName)


© 2015 Microsoft. All rights reserved.