com.microsoft.tfs.core.clients.framework.catalog
Class CatalogService

java.lang.Object
  extended by com.microsoft.tfs.core.clients.framework.catalog.CatalogService
All Implemented Interfaces:
ICatalogService

public class CatalogService
extends java.lang.Object
implements ICatalogService

The TFS catalog service. Implements the ICatalogService interface.

Since:
TEE-SDK-10.1

Constructor Summary
CatalogService(TFSConfigurationServer connection)
          Construct the TFS Catalog Service.
 
Method Summary
 CatalogChangeContext createChangeContext()
          Creates a change context in which many changes can be batched
 ILocationService getLocationService()
          Returns the location service that this catalog uses for its service definition references.
 CatalogNode[] getRootNodes()
           
 CatalogNode[] queryNodes(java.lang.String[] pathSpecs, com.microsoft.tfs.util.GUID[] resourceTypeFilters, CatalogQueryOptions queryOptions)
          Returns the catalog nodes that exist below the parentPath and have a type that is listed in resourceTypeFilters.
 CatalogNode[] queryNodes(java.lang.String[] pathSpecs, com.microsoft.tfs.util.GUID[] resourceTypeFilters, CatalogResourceProperty[] propertyFilters, CatalogQueryOptions queryOptions)
          Returns the catalog nodes that exist below the parentPath and have a type that is listed in resourceTypeFilters.
 CatalogNode[] queryParents(com.microsoft.tfs.util.GUID resourceIdentifier, java.lang.String[] pathFilters, com.microsoft.tfs.util.GUID[] resourceTypeFilters, boolean recurseToRoot, CatalogQueryOptions queryOptions)
          Returns the nodes for the resource provided as well as the parents.
 CatalogResource[] queryResources(com.microsoft.tfs.util.GUID[] resourceIdentifiers, CatalogQueryOptions queryOptions)
          Returns the resource that is associated with the identifier.
 CatalogResource[] queryResources(com.microsoft.tfs.util.GUID[] resourceTypeIdentifiers, CatalogResourceProperty[] propertyFilters, CatalogQueryOptions queryOptions)
          Returns the resource that is associated with the identifier.
 CatalogResource[] queryResourcesByType(com.microsoft.tfs.util.GUID[] resourceTypeIdentifiers, CatalogQueryOptions queryOptions)
          Returns all of the catalog resources of the provided type.
 CatalogResourceType[] queryResourceTypes(com.microsoft.tfs.util.GUID[] resourceTypeIdentifiers)
          Returns the resource types for all of the specified identifiers.
 CatalogNode queryRootNode(CatalogTree tree)
          Returns the specified root node.
 CatalogNode[] queryUpTree(java.lang.String path, com.microsoft.tfs.util.GUID[] resourceTypeFilters, CatalogQueryOptions queryOptions)
          Queries "up" the tree from the provided path looking for the provided types in its parent nodes' children.
 void saveDelete(CatalogNode node, java.lang.Boolean recurse)
          Deletes this node from the catalog.
 void saveMove(CatalogNode nodeToMove, CatalogNode newParent)
          Adds this move to the change context.
 void saveNode(CatalogNode node)
          Saves the updated node and its resource in the catalog.
 void saveResource(CatalogResource resource)
          Saves the updated resource in the catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogService

public CatalogService(TFSConfigurationServer connection)
Construct the TFS Catalog Service.

Parameters:
connection - a TFSConfigurationServer
Method Detail

getLocationService

public ILocationService getLocationService()
Returns the location service that this catalog uses for its service definition references.

Specified by:
getLocationService in interface ICatalogService
Returns:
The TFS location service.

queryResourceTypes

public CatalogResourceType[] queryResourceTypes(com.microsoft.tfs.util.GUID[] resourceTypeIdentifiers)
Returns the resource types for all of the specified identifiers. If null or an empty list is passed in, all resource types will be returned.

Specified by:
queryResourceTypes in interface ICatalogService
Parameters:
resourceTypeIdentifiers - Identifiers for the resource types that should be returned. If this has a value of null or empty, all resource types will be returned.
Returns:
Resource types for the requested identifiers.

queryResources

public CatalogResource[] queryResources(com.microsoft.tfs.util.GUID[] resourceIdentifiers,
                                        CatalogQueryOptions queryOptions)
Returns the resource that is associated with the identifier.

Specified by:
queryResources in interface ICatalogService
Parameters:
resourceIdentifiers - The identifiers for the resources that are being search for.
queryOptions - If ExpandDependencies is specified, the Dependencies property on nodes will contain the nodes they are dependent on. If IncludeParents is specified, the ParentNode property on the CatalogNode will contain the parent node. Leaving a given option will result in the returned catalog nodes to have null for that value. Extra data should only be retrieved if it is needed since computing and sending information can be expensive.
Returns:
The resources with the specified identifiers.

queryResourcesByType

public CatalogResource[] queryResourcesByType(com.microsoft.tfs.util.GUID[] resourceTypeIdentifiers,
                                              CatalogQueryOptions queryOptions)
Returns all of the catalog resources of the provided type. If GUID.EMPTY is passed in, all resources are returned.

Specified by:
queryResourcesByType in interface ICatalogService
Parameters:
resourceTypeIdentifiers - The identifier for the type of resource to filter on.
queryOptions - If ExpandDependencies is specified, the Dependencies property on nodes will contain the nodes they are dependent on. If IncludeParents is specified, the ParentNode property on the CatalogNode will contain the parent node. Leaving a given option will result in the returned catalog nodes to have null for that value. Extra data should only be retrieved if it is needed since computing and sending information can be expensive.
Returns:
the catalog resources of the specified type.

queryResources

public CatalogResource[] queryResources(com.microsoft.tfs.util.GUID[] resourceTypeIdentifiers,
                                        CatalogResourceProperty[] propertyFilters,
                                        CatalogQueryOptions queryOptions)
Returns the resource that is associated with the identifier.

Specified by:
queryResources in interface ICatalogService
Parameters:
resourceTypeIdentifiers - The identifiers for the resources that are being search for.
propertyFilters - The set of property filters to apply to the nodes found. Matches will be based on both the key and the value of the property matching. If the value of a certain filter is null or empty then it will be assumed that all nodes with the supplied property should be returned. A match consists of a node/resource that matches all of the propertyFilters.
queryOptions - If ExpandDependencies is specified, the Dependencies property on nodes will contain the nodes they are dependent on. If IncludeParents is specified, the ParentNode property on the CatalogNode will contain the parent node. Leaving a given option will result in the returned catalog nodes to have null for that value. Extra data should only be retrieved if it is needed since computing and sending information can be expensive.
Returns:
the resources with the specified identifiers.

getRootNodes

public CatalogNode[] getRootNodes()
Specified by:
getRootNodes in interface ICatalogService
Returns:
the root nodes in the tree.

queryRootNode

public CatalogNode queryRootNode(CatalogTree tree)
Returns the specified root node. Well-known root paths can be found in Microsoft.TeamFoundation.Framework.Common.Catalog.CatalogTree.

Specified by:
queryRootNode in interface ICatalogService
Parameters:
tree - The tree of the desired root.
Returns:
The CatalogNode for the tree.

queryNodes

public CatalogNode[] queryNodes(java.lang.String[] pathSpecs,
                                com.microsoft.tfs.util.GUID[] resourceTypeFilters,
                                CatalogQueryOptions queryOptions)
Returns the catalog nodes that exist below the parentPath and have a type that is listed in resourceTypeFilters.

Specified by:
queryNodes in interface ICatalogService
Parameters:
pathSpecs - The paths of the element or elements that are being searched for. This path can contain the wildcards "*", "**" and "..." where "*" means one-level and "**" and "..." means any number of levels.
resourceTypeFilters - The list of types that this query should include. If this is null or empty, all types will be included.
queryOptions - If ExpandDependencies is specified, the Dependencies property on nodes will contain the nodes they are dependent on. If IncludeParents is specified, the ParentNode property on the CatalogNode will contain the parent node. Leaving a given option will result in the returned catalog nodes to have null for that value. Extra data should only be retrieved if it is needed since computing and sending information can be expensive.
Returns:
The catalog nodes that exist below the parentPath and have a type that is listed in resourceTypeFilters.

queryNodes

public CatalogNode[] queryNodes(java.lang.String[] pathSpecs,
                                com.microsoft.tfs.util.GUID[] resourceTypeFilters,
                                CatalogResourceProperty[] propertyFilters,
                                CatalogQueryOptions queryOptions)
Returns the catalog nodes that exist below the parentPath and have a type that is listed in resourceTypeFilters.

Specified by:
queryNodes in interface ICatalogService
Parameters:
pathSpecs - The paths of the element or elements that are being searched for. This path can contain the wildcards "*", "**" and "..." where "*" means one-level and "**" and "..." means any number of levels.
resourceTypeFilters - The list of types that this query should include. If this is null or empty, all types will be included.
propertyFilters - The set of property filters to apply to the nodes found. Matches will be based on both the key and the value of the property matching. If the value of a certain filter is null or empty then it will be assumed that all nodes with the supplied property should be returned. A match consists of a node/resource that matches all of the propertyFilters.
queryOptions - If ExpandDependencies is specified, the Dependencies property on nodes will contain the nodes they are dependent on. If IncludeParents is specified, the ParentNode property on the CatalogNode will contain the parent node. Leaving a given option will result in the returned catalog nodes to have null for that value. Extra data should only be retrieved if it is needed since computing and sending information can be expensive.
Returns:
The catalog nodes that exist below the parentPath and have a type that is listed in resourceTypeFilters.

queryParents

public CatalogNode[] queryParents(com.microsoft.tfs.util.GUID resourceIdentifier,
                                  java.lang.String[] pathFilters,
                                  com.microsoft.tfs.util.GUID[] resourceTypeFilters,
                                  boolean recurseToRoot,
                                  CatalogQueryOptions queryOptions)
Returns the nodes for the resource provided as well as the parents. The direct nodes and the parent nodes will not be returned if they are filtered out. For the following tree: PG1 / \ PG2 PG3 / \ \ TPC1 TPC2 TPC3 / \ TP1 TP2 Query for TP1's identifier with no filters and recursing to the root would yield TP1, TPC1, PG2 and PG1.

Specified by:
queryParents in interface ICatalogService
Parameters:
resourceIdentifier - The identifier for the resource who's parents are being queried. The resource and its nodes will only be returned if they are not filtered out.
pathFilters - Nodes will only be returned if they live under one of the paths provided here. If this value is null or empty it will be assumed that parents from all places within the tree are valid.
resourceTypeFilters - The list of types that this query should include. If this is null or empty, all types will be included.
recurseToRoot - If this is true then parent nodes will be enumerated all the way to the root. If this is false then only the first level of parents will be returned.
queryOptions - If ExpandDependencies is specified, the Dependencies property on nodes will contain the nodes they are dependent on. If IncludeParents is specified, the ParentNode property on the CatalogNode will contain the parent node. Leaving a given option will result in the returned catalog nodes to have null for that value. Extra data should only be retrieved if it is needed since computing and sending information can be expensive.
Returns:
The nodes for the resource provided as well as the parents of those nodes that apply to the provided filters.

queryUpTree

public CatalogNode[] queryUpTree(java.lang.String path,
                                 com.microsoft.tfs.util.GUID[] resourceTypeFilters,
                                 CatalogQueryOptions queryOptions)
Queries "up" the tree from the provided path looking for the provided types in its parent nodes' children. If the path is "TFSInstance1/PG1/TPC1/TP1" this query will be translated into a series of QueryNodes calls that have the following pathSpecs: "TFSInstance1/*" "TFSInstance1/PG1/*" "TFSInstance1/PG1/TPC1/*" An example of when this could be used is when a ReportingSite is being added to a node and it must find the ReportServer that is a child of one of its parent nodes.

Specified by:
queryUpTree in interface ICatalogService
Parameters:
path - The path of the item from where the "up" query should originate. Wildcards cannot be used in this path.
resourceTypeFilters - The list of types that this query should include. If this is null or empty, all types will be included.
queryOptions - If ExpandDependencies is specified, the Dependencies property on nodes will contain the nodes they are dependent on. If IncludeParents is specified, the ParentNode property on the CatalogNode will contain the parent node. Leaving a given option will result in the returned catalog nodes to have null for that value. Extra data should only be retrieved if it is needed since computing and sending information can be expensive.
Returns:
The catalog nodes that match the specified query.

createChangeContext

public CatalogChangeContext createChangeContext()
Creates a change context in which many changes can be batched

Specified by:
createChangeContext in interface ICatalogService
Returns:
A change context in which many changes can be batched together.

saveDelete

public void saveDelete(CatalogNode node,
                       java.lang.Boolean recurse)
Deletes this node from the catalog. If this node is the only node that points to the resource it points to then this resource will also be deleted. If this node exists in the infrastructure tree then the resource that is associated with this node will also be deleted and it will be inherently recursive.

Specified by:
saveDelete in interface ICatalogService
Parameters:
node - The node to delete.
recurse - True if the children nodes of this node should be deleted.

saveMove

public void saveMove(CatalogNode nodeToMove,
                     CatalogNode newParent)
Adds this move to the change context. It will be sent to the server when Save() is called. Note that if nodeToMove or newParent also have updated properties then those will be committed as well. Any node that is explicitly moved will have IsDefault set to 0.

Specified by:
saveMove in interface ICatalogService
Parameters:
nodeToMove - The node to move under the newParent.
newParent - The newParent to place nodeToMove under.

saveNode

public void saveNode(CatalogNode node)
Saves the updated node and its resource in the catalog.

Specified by:
saveNode in interface ICatalogService
Parameters:
node - The node that has been created or updated.

saveResource

public void saveResource(CatalogResource resource)
Saves the updated resource in the catalog. Note that service definitions that exist as service references will be created if they are new and updated if they are not.

Specified by:
saveResource in interface ICatalogService
Parameters:
resource - The resource to update.


© 2015 Microsoft. All rights reserved.